2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
11 #define MALLOC(a, _) malloc(a)
12 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
13 #define DO_ASSERT(a) (void)(a)
16 static jmethodID ordinal_meth = NULL;
17 static jmethodID slicedef_meth = NULL;
18 static jclass slicedef_cls = NULL;
19 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
20 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
21 CHECK(ordinal_meth != NULL);
22 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
23 CHECK(slicedef_meth != NULL);
24 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
25 CHECK(slicedef_cls != NULL);
28 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
37 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
38 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
39 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
43 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
44 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
45 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
48 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
49 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
50 vec->datalen = (*env)->GetArrayLength(env, bytes);
51 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
52 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
55 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
56 LDKTransaction *txdata = (LDKTransaction*)ptr;
58 slice.data = txdata->data;
59 slice.datalen = txdata->datalen;
60 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
62 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
63 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
64 txdata->datalen = (*env)->GetArrayLength(env, bytes);
65 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
66 txdata->data_is_owned = false;
67 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
68 return (uint64_t)txdata;
70 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
71 LDKTransaction *tx = (LDKTransaction*)ptr;
72 tx->data_is_owned = true;
73 Transaction_free(*tx);
76 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
77 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
82 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
83 return (uint64_t)vec->datalen;
85 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
86 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
91 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
97 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
98 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
100 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
103 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
104 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
106 typedef jlongArray int64_tArray;
107 typedef jbyteArray int8_tArray;
109 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
110 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
111 char* conv_buf = MALLOC(len + 1, "str conv buf");
112 memcpy(conv_buf, chars, len);
114 jstring ret = (*env)->NewStringUTF(env, conv_buf);
118 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
119 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
120 char* newchars = MALLOC(str_len + 1, "String chars");
121 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
122 memcpy(newchars, jchars, str_len);
123 newchars[str_len] = 0;
124 (*env)->ReleaseStringUTFChars(env, str, jchars);
128 .chars_is_owned = true
133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
137 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
140 static jclass arr_of_B_clz = NULL;
141 static jclass arr_of_J_clz = NULL;
142 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
143 arr_of_B_clz = (*env)->FindClass(env, "[B");
144 CHECK(arr_of_B_clz != NULL);
145 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
146 arr_of_J_clz = (*env)->FindClass(env, "[J");
147 CHECK(arr_of_J_clz != NULL);
148 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
150 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
151 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
152 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
153 case 0: return LDKAccessError_UnknownChain;
154 case 1: return LDKAccessError_UnknownTx;
158 static jclass AccessError_class = NULL;
159 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
160 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
161 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
162 AccessError_class = (*env)->NewGlobalRef(env, clz);
163 CHECK(AccessError_class != NULL);
164 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
165 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
166 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
167 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
169 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
171 case LDKAccessError_UnknownChain:
172 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
173 case LDKAccessError_UnknownTx:
174 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
179 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
180 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
181 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
182 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
186 static jclass ChannelMonitorUpdateErr_class = NULL;
187 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
188 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
189 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
190 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
191 CHECK(ChannelMonitorUpdateErr_class != NULL);
192 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
193 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
194 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
195 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
197 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
199 case LDKChannelMonitorUpdateErr_TemporaryFailure:
200 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
201 case LDKChannelMonitorUpdateErr_PermanentFailure:
202 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
207 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
208 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
209 case 0: return LDKConfirmationTarget_Background;
210 case 1: return LDKConfirmationTarget_Normal;
211 case 2: return LDKConfirmationTarget_HighPriority;
215 static jclass ConfirmationTarget_class = NULL;
216 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
217 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
219 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
220 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
221 CHECK(ConfirmationTarget_class != NULL);
222 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
223 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
224 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
225 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
229 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
231 case LDKConfirmationTarget_Background:
232 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
233 case LDKConfirmationTarget_Normal:
234 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
235 case LDKConfirmationTarget_HighPriority:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
241 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
242 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
243 case 0: return LDKCreationError_DescriptionTooLong;
244 case 1: return LDKCreationError_RouteTooLong;
245 case 2: return LDKCreationError_TimestampOutOfBounds;
246 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
250 static jclass CreationError_class = NULL;
251 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
252 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
253 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
254 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
255 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
256 CreationError_class = (*env)->NewGlobalRef(env, clz);
257 CHECK(CreationError_class != NULL);
258 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
259 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
260 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
261 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
262 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
264 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
267 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
269 case LDKCreationError_DescriptionTooLong:
270 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
271 case LDKCreationError_RouteTooLong:
272 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
273 case LDKCreationError_TimestampOutOfBounds:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
275 case LDKCreationError_ExpiryTimeOutOfBounds:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
281 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
282 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
283 case 0: return LDKCurrency_Bitcoin;
284 case 1: return LDKCurrency_BitcoinTestnet;
285 case 2: return LDKCurrency_Regtest;
286 case 3: return LDKCurrency_Simnet;
287 case 4: return LDKCurrency_Signet;
291 static jclass Currency_class = NULL;
292 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
293 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
294 static jfieldID Currency_LDKCurrency_Regtest = NULL;
295 static jfieldID Currency_LDKCurrency_Simnet = NULL;
296 static jfieldID Currency_LDKCurrency_Signet = NULL;
297 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
298 Currency_class = (*env)->NewGlobalRef(env, clz);
299 CHECK(Currency_class != NULL);
300 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
301 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
302 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
303 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
304 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_Regtest != NULL);
306 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_Simnet != NULL);
308 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Signet != NULL);
311 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
313 case LDKCurrency_Bitcoin:
314 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
315 case LDKCurrency_BitcoinTestnet:
316 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
317 case LDKCurrency_Regtest:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
319 case LDKCurrency_Simnet:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
321 case LDKCurrency_Signet:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
327 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
328 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
329 case 0: return LDKIOError_NotFound;
330 case 1: return LDKIOError_PermissionDenied;
331 case 2: return LDKIOError_ConnectionRefused;
332 case 3: return LDKIOError_ConnectionReset;
333 case 4: return LDKIOError_ConnectionAborted;
334 case 5: return LDKIOError_NotConnected;
335 case 6: return LDKIOError_AddrInUse;
336 case 7: return LDKIOError_AddrNotAvailable;
337 case 8: return LDKIOError_BrokenPipe;
338 case 9: return LDKIOError_AlreadyExists;
339 case 10: return LDKIOError_WouldBlock;
340 case 11: return LDKIOError_InvalidInput;
341 case 12: return LDKIOError_InvalidData;
342 case 13: return LDKIOError_TimedOut;
343 case 14: return LDKIOError_WriteZero;
344 case 15: return LDKIOError_Interrupted;
345 case 16: return LDKIOError_Other;
346 case 17: return LDKIOError_UnexpectedEof;
350 static jclass IOError_class = NULL;
351 static jfieldID IOError_LDKIOError_NotFound = NULL;
352 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
353 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
354 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
356 static jfieldID IOError_LDKIOError_NotConnected = NULL;
357 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
358 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
359 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
360 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
361 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
362 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
363 static jfieldID IOError_LDKIOError_InvalidData = NULL;
364 static jfieldID IOError_LDKIOError_TimedOut = NULL;
365 static jfieldID IOError_LDKIOError_WriteZero = NULL;
366 static jfieldID IOError_LDKIOError_Interrupted = NULL;
367 static jfieldID IOError_LDKIOError_Other = NULL;
368 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
369 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
370 IOError_class = (*env)->NewGlobalRef(env, clz);
371 CHECK(IOError_class != NULL);
372 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
373 CHECK(IOError_LDKIOError_NotFound != NULL);
374 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
375 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
376 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
378 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
380 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
382 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_NotConnected != NULL);
384 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_AddrInUse != NULL);
386 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
388 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
390 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
392 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_WouldBlock != NULL);
394 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_InvalidInput != NULL);
396 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_InvalidData != NULL);
398 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_TimedOut != NULL);
400 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_WriteZero != NULL);
402 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_Interrupted != NULL);
404 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_Other != NULL);
406 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
409 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
411 case LDKIOError_NotFound:
412 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
413 case LDKIOError_PermissionDenied:
414 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
415 case LDKIOError_ConnectionRefused:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
417 case LDKIOError_ConnectionReset:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
419 case LDKIOError_ConnectionAborted:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
421 case LDKIOError_NotConnected:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
423 case LDKIOError_AddrInUse:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
425 case LDKIOError_AddrNotAvailable:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
427 case LDKIOError_BrokenPipe:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
429 case LDKIOError_AlreadyExists:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
431 case LDKIOError_WouldBlock:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
433 case LDKIOError_InvalidInput:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
435 case LDKIOError_InvalidData:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
437 case LDKIOError_TimedOut:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
439 case LDKIOError_WriteZero:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
441 case LDKIOError_Interrupted:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
443 case LDKIOError_Other:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
445 case LDKIOError_UnexpectedEof:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
451 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
452 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
453 case 0: return LDKLevel_Trace;
454 case 1: return LDKLevel_Debug;
455 case 2: return LDKLevel_Info;
456 case 3: return LDKLevel_Warn;
457 case 4: return LDKLevel_Error;
461 static jclass Level_class = NULL;
462 static jfieldID Level_LDKLevel_Trace = NULL;
463 static jfieldID Level_LDKLevel_Debug = NULL;
464 static jfieldID Level_LDKLevel_Info = NULL;
465 static jfieldID Level_LDKLevel_Warn = NULL;
466 static jfieldID Level_LDKLevel_Error = NULL;
467 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
468 Level_class = (*env)->NewGlobalRef(env, clz);
469 CHECK(Level_class != NULL);
470 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
471 CHECK(Level_LDKLevel_Trace != NULL);
472 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
473 CHECK(Level_LDKLevel_Debug != NULL);
474 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Info != NULL);
476 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Warn != NULL);
478 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Error != NULL);
481 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
484 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
486 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
488 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
497 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
498 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
499 case 0: return LDKNetwork_Bitcoin;
500 case 1: return LDKNetwork_Testnet;
501 case 2: return LDKNetwork_Regtest;
502 case 3: return LDKNetwork_Signet;
506 static jclass Network_class = NULL;
507 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
508 static jfieldID Network_LDKNetwork_Testnet = NULL;
509 static jfieldID Network_LDKNetwork_Regtest = NULL;
510 static jfieldID Network_LDKNetwork_Signet = NULL;
511 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
512 Network_class = (*env)->NewGlobalRef(env, clz);
513 CHECK(Network_class != NULL);
514 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
515 CHECK(Network_LDKNetwork_Bitcoin != NULL);
516 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
517 CHECK(Network_LDKNetwork_Testnet != NULL);
518 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
519 CHECK(Network_LDKNetwork_Regtest != NULL);
520 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
521 CHECK(Network_LDKNetwork_Signet != NULL);
523 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
525 case LDKNetwork_Bitcoin:
526 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
527 case LDKNetwork_Testnet:
528 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
529 case LDKNetwork_Regtest:
530 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
531 case LDKNetwork_Signet:
532 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
537 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
538 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
539 case 0: return LDKSecp256k1Error_IncorrectSignature;
540 case 1: return LDKSecp256k1Error_InvalidMessage;
541 case 2: return LDKSecp256k1Error_InvalidPublicKey;
542 case 3: return LDKSecp256k1Error_InvalidSignature;
543 case 4: return LDKSecp256k1Error_InvalidSecretKey;
544 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
545 case 6: return LDKSecp256k1Error_InvalidTweak;
546 case 7: return LDKSecp256k1Error_TweakCheckFailed;
547 case 8: return LDKSecp256k1Error_NotEnoughMemory;
551 static jclass Secp256k1Error_class = NULL;
552 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
553 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
554 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
561 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
562 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
563 CHECK(Secp256k1Error_class != NULL);
564 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
565 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
566 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
567 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
568 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
569 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
570 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
571 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
572 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
578 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
580 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
583 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
585 case LDKSecp256k1Error_IncorrectSignature:
586 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
587 case LDKSecp256k1Error_InvalidMessage:
588 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
589 case LDKSecp256k1Error_InvalidPublicKey:
590 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
591 case LDKSecp256k1Error_InvalidSignature:
592 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
593 case LDKSecp256k1Error_InvalidSecretKey:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
595 case LDKSecp256k1Error_InvalidRecoveryId:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
597 case LDKSecp256k1Error_InvalidTweak:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
599 case LDKSecp256k1Error_TweakCheckFailed:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
601 case LDKSecp256k1Error_NotEnoughMemory:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
607 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
608 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
609 case 0: return LDKSemanticError_NoPaymentHash;
610 case 1: return LDKSemanticError_MultiplePaymentHashes;
611 case 2: return LDKSemanticError_NoDescription;
612 case 3: return LDKSemanticError_MultipleDescriptions;
613 case 4: return LDKSemanticError_NoPaymentSecret;
614 case 5: return LDKSemanticError_MultiplePaymentSecrets;
615 case 6: return LDKSemanticError_InvalidFeatures;
616 case 7: return LDKSemanticError_InvalidRecoveryId;
617 case 8: return LDKSemanticError_InvalidSignature;
618 case 9: return LDKSemanticError_ImpreciseAmount;
622 static jclass SemanticError_class = NULL;
623 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
624 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
625 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
626 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
627 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
628 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
629 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
630 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
632 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
633 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
634 SemanticError_class = (*env)->NewGlobalRef(env, clz);
635 CHECK(SemanticError_class != NULL);
636 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
637 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
638 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
639 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
640 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
642 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
644 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
646 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
648 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
650 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
652 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
654 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
657 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
659 case LDKSemanticError_NoPaymentHash:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
661 case LDKSemanticError_MultiplePaymentHashes:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
663 case LDKSemanticError_NoDescription:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
665 case LDKSemanticError_MultipleDescriptions:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
667 case LDKSemanticError_NoPaymentSecret:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
669 case LDKSemanticError_MultiplePaymentSecrets:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
671 case LDKSemanticError_InvalidFeatures:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
673 case LDKSemanticError_InvalidRecoveryId:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
675 case LDKSemanticError_InvalidSignature:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
677 case LDKSemanticError_ImpreciseAmount:
678 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
683 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
684 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
685 case 0: return LDKSiPrefix_Milli;
686 case 1: return LDKSiPrefix_Micro;
687 case 2: return LDKSiPrefix_Nano;
688 case 3: return LDKSiPrefix_Pico;
692 static jclass SiPrefix_class = NULL;
693 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
694 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
695 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
696 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
697 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
698 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
699 CHECK(SiPrefix_class != NULL);
700 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
702 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
704 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
706 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
707 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
709 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
711 case LDKSiPrefix_Milli:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
713 case LDKSiPrefix_Micro:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
715 case LDKSiPrefix_Nano:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
717 case LDKSiPrefix_Pico:
718 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
724 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
725 ret->datalen = (*env)->GetArrayLength(env, elems);
726 if (ret->datalen == 0) {
729 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
730 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
731 for (size_t i = 0; i < ret->datalen; i++) {
732 ret->data[i] = java_elems[i];
734 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
736 return (uint64_t)ret;
738 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
739 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
740 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
743 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
744 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
745 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
748 CVec_u8Z_free(ret_var);
752 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
753 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
754 int64_t ret_val = TxOut_get_value(thing_conv);
758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
759 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
762 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
763 CHECK(val->result_ok);
764 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
765 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
769 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
770 CHECK(!val->result_ok);
771 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
775 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
778 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
779 CHECK(val->result_ok);
780 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
781 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
784 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
785 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
786 CHECK(!val->result_ok);
787 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
791 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
794 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
795 CHECK(val->result_ok);
796 LDKTxCreationKeys res_var = (*val->contents.result);
797 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
798 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
799 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
803 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
804 CHECK(!val->result_ok);
805 LDKDecodeError err_var = (*val->contents.err);
806 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
807 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
808 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
812 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
815 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
816 CHECK(val->result_ok);
817 LDKChannelPublicKeys res_var = (*val->contents.result);
818 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
819 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
820 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
824 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
825 CHECK(!val->result_ok);
826 LDKDecodeError err_var = (*val->contents.err);
827 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
828 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
829 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
833 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
836 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
837 CHECK(val->result_ok);
838 LDKTxCreationKeys res_var = (*val->contents.result);
839 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
840 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
841 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
844 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
845 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
846 CHECK(!val->result_ok);
847 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
850 static jclass LDKCOption_u32Z_Some_class = NULL;
851 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
852 static jclass LDKCOption_u32Z_None_class = NULL;
853 static jmethodID LDKCOption_u32Z_None_meth = NULL;
854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
855 LDKCOption_u32Z_Some_class =
856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
857 CHECK(LDKCOption_u32Z_Some_class != NULL);
858 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
859 CHECK(LDKCOption_u32Z_Some_meth != NULL);
860 LDKCOption_u32Z_None_class =
861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
862 CHECK(LDKCOption_u32Z_None_class != NULL);
863 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
864 CHECK(LDKCOption_u32Z_None_meth != NULL);
866 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
867 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
869 case LDKCOption_u32Z_Some: {
870 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
872 case LDKCOption_u32Z_None: {
873 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
879 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
882 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
883 CHECK(val->result_ok);
884 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
885 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
886 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
887 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
891 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
892 CHECK(!val->result_ok);
893 LDKDecodeError err_var = (*val->contents.err);
894 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
895 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
896 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
900 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
903 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
904 CHECK(val->result_ok);
905 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
906 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
907 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
908 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
912 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
913 CHECK(!val->result_ok);
914 LDKDecodeError err_var = (*val->contents.err);
915 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
916 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
917 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
921 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
924 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
925 CHECK(val->result_ok);
926 LDKChannelTransactionParameters res_var = (*val->contents.result);
927 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
928 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
929 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
933 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
934 CHECK(!val->result_ok);
935 LDKDecodeError err_var = (*val->contents.err);
936 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
942 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
945 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
946 CHECK(val->result_ok);
947 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
948 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
954 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
955 CHECK(!val->result_ok);
956 LDKDecodeError err_var = (*val->contents.err);
957 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
959 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
963 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
966 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
967 CHECK(val->result_ok);
968 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
969 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
970 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
971 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
975 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
976 CHECK(!val->result_ok);
977 LDKDecodeError err_var = (*val->contents.err);
978 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
979 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
980 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
984 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
987 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
988 CHECK(val->result_ok);
989 LDKTrustedClosingTransaction res_var = (*val->contents.result);
990 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
991 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
992 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
996 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
997 CHECK(!val->result_ok);
998 return *val->contents.err;
1000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1001 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1004 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1005 CHECK(val->result_ok);
1006 LDKCommitmentTransaction res_var = (*val->contents.result);
1007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1009 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1013 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1014 CHECK(!val->result_ok);
1015 LDKDecodeError err_var = (*val->contents.err);
1016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1022 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1025 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1026 CHECK(val->result_ok);
1027 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1028 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1029 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1030 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1034 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1035 CHECK(!val->result_ok);
1036 return *val->contents.err;
1038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1039 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1041 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1042 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1043 CHECK(val->result_ok);
1044 LDKCVec_SignatureZ res_var = (*val->contents.result);
1045 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1047 for (size_t i = 0; i < res_var.datalen; i++) {
1048 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1049 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1050 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1055 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1056 CHECK(!val->result_ok);
1057 return *val->contents.err;
1059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1060 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1063 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1064 CHECK(val->result_ok);
1065 LDKShutdownScript res_var = (*val->contents.result);
1066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1072 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1073 CHECK(!val->result_ok);
1074 LDKDecodeError err_var = (*val->contents.err);
1075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1081 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1084 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1085 CHECK(val->result_ok);
1086 LDKShutdownScript res_var = (*val->contents.result);
1087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1093 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1094 CHECK(!val->result_ok);
1095 LDKInvalidShutdownScript err_var = (*val->contents.err);
1096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1102 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1105 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1106 CHECK(val->result_ok);
1107 return *val->contents.result;
1109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1110 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1111 CHECK(!val->result_ok);
1112 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1116 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1119 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1120 CHECK(val->result_ok);
1121 LDKRouteHop res_var = (*val->contents.result);
1122 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1123 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1124 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1128 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1129 CHECK(!val->result_ok);
1130 LDKDecodeError err_var = (*val->contents.err);
1131 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1132 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1133 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1137 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1138 ret->datalen = (*env)->GetArrayLength(env, elems);
1139 if (ret->datalen == 0) {
1142 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1143 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1144 for (size_t i = 0; i < ret->datalen; i++) {
1145 int64_t arr_elem = java_elems[i];
1146 LDKRouteHop arr_elem_conv;
1147 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1148 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1149 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1150 ret->data[i] = arr_elem_conv;
1152 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1154 return (uint64_t)ret;
1156 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1157 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1158 for (size_t i = 0; i < ret.datalen; i++) {
1159 ret.data[i] = RouteHop_clone(&orig->data[i]);
1163 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1164 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1165 for (size_t i = 0; i < ret.datalen; i++) {
1166 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1171 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1174 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1175 CHECK(val->result_ok);
1176 LDKRoute res_var = (*val->contents.result);
1177 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1178 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1179 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1183 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1184 CHECK(!val->result_ok);
1185 LDKDecodeError err_var = (*val->contents.err);
1186 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1191 static jclass LDKCOption_u64Z_Some_class = NULL;
1192 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1193 static jclass LDKCOption_u64Z_None_class = NULL;
1194 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1196 LDKCOption_u64Z_Some_class =
1197 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1198 CHECK(LDKCOption_u64Z_Some_class != NULL);
1199 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1200 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1201 LDKCOption_u64Z_None_class =
1202 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1203 CHECK(LDKCOption_u64Z_None_class != NULL);
1204 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1205 CHECK(LDKCOption_u64Z_None_meth != NULL);
1207 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1208 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1210 case LDKCOption_u64Z_Some: {
1211 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1213 case LDKCOption_u64Z_None: {
1214 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1220 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1221 ret->datalen = (*env)->GetArrayLength(env, elems);
1222 if (ret->datalen == 0) {
1225 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1226 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1227 for (size_t i = 0; i < ret->datalen; i++) {
1228 int64_t arr_elem = java_elems[i];
1229 LDKChannelDetails arr_elem_conv;
1230 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1231 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1232 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1233 ret->data[i] = arr_elem_conv;
1235 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1237 return (uint64_t)ret;
1239 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1240 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1241 for (size_t i = 0; i < ret.datalen; i++) {
1242 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1247 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1248 ret->datalen = (*env)->GetArrayLength(env, elems);
1249 if (ret->datalen == 0) {
1252 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1253 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1254 for (size_t i = 0; i < ret->datalen; i++) {
1255 int64_t arr_elem = java_elems[i];
1256 LDKRouteHint arr_elem_conv;
1257 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1258 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1259 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1260 ret->data[i] = arr_elem_conv;
1262 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1264 return (uint64_t)ret;
1266 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1267 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1268 for (size_t i = 0; i < ret.datalen; i++) {
1269 ret.data[i] = RouteHint_clone(&orig->data[i]);
1273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1274 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1277 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1278 CHECK(val->result_ok);
1279 LDKRoute res_var = (*val->contents.result);
1280 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1281 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1282 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1286 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1287 CHECK(!val->result_ok);
1288 LDKLightningError err_var = (*val->contents.err);
1289 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1290 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1291 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1295 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1298 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1299 CHECK(val->result_ok);
1300 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1301 return (uint64_t)res_ref;
1303 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1304 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1305 CHECK(!val->result_ok);
1306 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1310 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1312 LDKTransaction b_ref;
1313 b_ref.datalen = (*env)->GetArrayLength(env, b);
1314 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1315 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1316 b_ref.data_is_owned = false;
1318 return (uint64_t)ret;
1320 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
1324 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1325 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1329 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
1333 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1334 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1337 Transaction_free(ret_var);
1341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1342 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1343 ret->datalen = (*env)->GetArrayLength(env, elems);
1344 if (ret->datalen == 0) {
1347 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1348 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1349 for (size_t i = 0; i < ret->datalen; i++) {
1350 int64_t arr_elem = java_elems[i];
1351 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1352 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1353 ret->data[i] = arr_elem_conv;
1355 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1357 return (uint64_t)ret;
1359 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1360 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1361 for (size_t i = 0; i < ret.datalen; i++) {
1362 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1366 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1367 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1368 for (size_t i = 0; i < ret.datalen; i++) {
1369 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1374 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1377 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1378 CHECK(val->result_ok);
1379 return *val->contents.result;
1381 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1382 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1383 CHECK(!val->result_ok);
1384 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1387 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1388 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1389 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1390 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1392 LDKMonitorEvent_HTLCEvent_class =
1393 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1394 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1395 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1396 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1397 LDKMonitorEvent_CommitmentTxConfirmed_class =
1398 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1399 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1400 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1401 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1403 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1404 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1406 case LDKMonitorEvent_HTLCEvent: {
1407 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1408 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1409 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1410 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1411 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1413 case LDKMonitorEvent_CommitmentTxConfirmed: {
1414 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1415 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1416 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1417 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1418 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1424 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1425 ret->datalen = (*env)->GetArrayLength(env, elems);
1426 if (ret->datalen == 0) {
1429 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1430 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1431 for (size_t i = 0; i < ret->datalen; i++) {
1432 int64_t arr_elem = java_elems[i];
1433 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1434 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1435 ret->data[i] = arr_elem_conv;
1437 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1439 return (uint64_t)ret;
1441 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1442 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1443 for (size_t i = 0; i < ret.datalen; i++) {
1444 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1448 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1449 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1450 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1451 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1453 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1454 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1455 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1456 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1457 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1458 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1459 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1460 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1461 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1462 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1464 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1465 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1467 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1468 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1469 *some_conv = obj->some;
1470 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1471 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uint64_t)some_conv));
1473 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1474 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1479 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1480 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1481 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1482 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1483 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1484 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1486 LDKNetworkUpdate_ChannelUpdateMessage_class =
1487 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1488 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1489 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1490 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1491 LDKNetworkUpdate_ChannelClosed_class =
1492 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1493 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1494 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1495 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1496 LDKNetworkUpdate_NodeFailure_class =
1497 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1498 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1499 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1500 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1502 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1503 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1505 case LDKNetworkUpdate_ChannelUpdateMessage: {
1506 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1507 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1508 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1509 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1510 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1512 case LDKNetworkUpdate_ChannelClosed: {
1513 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1515 case LDKNetworkUpdate_NodeFailure: {
1516 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1517 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1518 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1523 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1524 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1525 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1526 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1528 LDKCOption_NetworkUpdateZ_Some_class =
1529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1530 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1531 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1532 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1533 LDKCOption_NetworkUpdateZ_None_class =
1534 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1535 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1536 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1537 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1539 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1540 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1542 case LDKCOption_NetworkUpdateZ_Some: {
1543 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1544 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1546 case LDKCOption_NetworkUpdateZ_None: {
1547 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1552 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1553 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1554 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1555 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1556 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1557 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1559 LDKSpendableOutputDescriptor_StaticOutput_class =
1560 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1561 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1562 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1563 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1564 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1565 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1566 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1567 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1568 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1569 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1570 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1571 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1572 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1573 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1575 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1576 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1578 case LDKSpendableOutputDescriptor_StaticOutput: {
1579 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1580 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1583 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1584 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1586 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1587 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1588 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1589 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1590 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1591 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1593 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1594 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1595 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1596 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1597 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1598 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1604 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1605 ret->datalen = (*env)->GetArrayLength(env, elems);
1606 if (ret->datalen == 0) {
1609 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1610 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1611 for (size_t i = 0; i < ret->datalen; i++) {
1612 int64_t arr_elem = java_elems[i];
1613 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1614 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1615 ret->data[i] = arr_elem_conv;
1617 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1619 return (uint64_t)ret;
1621 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1622 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1623 for (size_t i = 0; i < ret.datalen; i++) {
1624 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1628 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1629 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1630 static jclass LDKErrorAction_IgnoreError_class = NULL;
1631 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1632 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1633 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1634 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1635 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1637 LDKErrorAction_DisconnectPeer_class =
1638 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1639 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1640 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1641 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1642 LDKErrorAction_IgnoreError_class =
1643 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1644 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1645 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1646 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1647 LDKErrorAction_IgnoreAndLog_class =
1648 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1649 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1650 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1651 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1652 LDKErrorAction_SendErrorMessage_class =
1653 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1654 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1655 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1656 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1658 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1659 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1661 case LDKErrorAction_DisconnectPeer: {
1662 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1663 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1664 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1665 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1666 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1668 case LDKErrorAction_IgnoreError: {
1669 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1671 case LDKErrorAction_IgnoreAndLog: {
1672 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1673 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1675 case LDKErrorAction_SendErrorMessage: {
1676 LDKErrorMessage msg_var = obj->send_error_message.msg;
1677 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1678 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1679 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1680 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1685 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1686 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1687 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1688 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1689 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1690 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1691 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1692 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1693 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1694 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1695 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1696 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1697 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1698 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1699 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1700 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1701 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1702 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1703 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1704 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1705 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1706 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1707 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1708 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1709 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1710 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1711 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1712 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1713 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1714 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1715 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1716 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1717 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1718 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1719 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1720 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1721 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1722 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1724 LDKMessageSendEvent_SendAcceptChannel_class =
1725 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1726 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1727 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1728 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1729 LDKMessageSendEvent_SendOpenChannel_class =
1730 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1731 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1732 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1733 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1734 LDKMessageSendEvent_SendFundingCreated_class =
1735 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1736 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1737 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1738 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1739 LDKMessageSendEvent_SendFundingSigned_class =
1740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1741 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1742 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1743 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1744 LDKMessageSendEvent_SendFundingLocked_class =
1745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1746 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1747 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1748 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1749 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1751 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1752 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1753 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1754 LDKMessageSendEvent_UpdateHTLCs_class =
1755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1756 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1757 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1758 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1759 LDKMessageSendEvent_SendRevokeAndACK_class =
1760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1761 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1762 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1763 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1764 LDKMessageSendEvent_SendClosingSigned_class =
1765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1766 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1767 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1768 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1769 LDKMessageSendEvent_SendShutdown_class =
1770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1771 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1772 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1773 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1774 LDKMessageSendEvent_SendChannelReestablish_class =
1775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1776 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1777 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1778 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1779 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1781 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1782 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1783 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1784 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1785 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1786 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1787 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1788 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1789 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1790 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1791 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1792 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1793 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1794 LDKMessageSendEvent_SendChannelUpdate_class =
1795 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1796 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1797 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1798 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1799 LDKMessageSendEvent_HandleError_class =
1800 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1801 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1802 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1803 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1804 LDKMessageSendEvent_SendChannelRangeQuery_class =
1805 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1806 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1807 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1808 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1809 LDKMessageSendEvent_SendShortIdsQuery_class =
1810 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1811 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1812 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1813 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1814 LDKMessageSendEvent_SendReplyChannelRange_class =
1815 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1816 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1817 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1818 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1820 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1821 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1823 case LDKMessageSendEvent_SendAcceptChannel: {
1824 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1825 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1826 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1827 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1828 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1829 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1830 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1832 case LDKMessageSendEvent_SendOpenChannel: {
1833 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1834 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1835 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1836 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1837 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1838 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1839 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1841 case LDKMessageSendEvent_SendFundingCreated: {
1842 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1843 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1844 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1845 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1846 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1847 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1848 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1850 case LDKMessageSendEvent_SendFundingSigned: {
1851 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1852 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1853 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1854 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1855 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1856 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1857 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1859 case LDKMessageSendEvent_SendFundingLocked: {
1860 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1861 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1862 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1865 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1866 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1868 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1869 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1870 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1871 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1872 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1873 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1874 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1875 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1877 case LDKMessageSendEvent_UpdateHTLCs: {
1878 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1879 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1880 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1881 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1882 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1883 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1884 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1886 case LDKMessageSendEvent_SendRevokeAndACK: {
1887 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1888 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1889 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1890 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1891 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1892 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1893 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1895 case LDKMessageSendEvent_SendClosingSigned: {
1896 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1897 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1898 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1899 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1900 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1901 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1902 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1904 case LDKMessageSendEvent_SendShutdown: {
1905 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1906 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1907 LDKShutdown msg_var = obj->send_shutdown.msg;
1908 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1909 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1910 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1911 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1913 case LDKMessageSendEvent_SendChannelReestablish: {
1914 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1915 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1916 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1917 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1918 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1919 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1920 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1922 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1923 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1924 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1925 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1926 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1927 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1928 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1929 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1930 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1931 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1933 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1934 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1935 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1938 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1940 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1941 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1942 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1943 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1944 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1945 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1947 case LDKMessageSendEvent_SendChannelUpdate: {
1948 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1949 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1950 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1951 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1952 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1953 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1954 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1956 case LDKMessageSendEvent_HandleError: {
1957 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1958 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1959 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1960 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1962 case LDKMessageSendEvent_SendChannelRangeQuery: {
1963 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1964 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1965 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1966 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1969 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1971 case LDKMessageSendEvent_SendShortIdsQuery: {
1972 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1973 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1974 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1975 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1978 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1980 case LDKMessageSendEvent_SendReplyChannelRange: {
1981 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1982 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1983 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1984 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1985 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1986 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1987 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1993 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1994 ret->datalen = (*env)->GetArrayLength(env, elems);
1995 if (ret->datalen == 0) {
1998 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1999 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2000 for (size_t i = 0; i < ret->datalen; i++) {
2001 int64_t arr_elem = java_elems[i];
2002 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
2003 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
2004 ret->data[i] = arr_elem_conv;
2006 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2008 return (uint64_t)ret;
2010 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2011 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2012 for (size_t i = 0; i < ret.datalen; i++) {
2013 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2018 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2021 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2022 CHECK(val->result_ok);
2023 LDKInitFeatures res_var = (*val->contents.result);
2024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2026 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2030 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2031 CHECK(!val->result_ok);
2032 LDKDecodeError err_var = (*val->contents.err);
2033 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2039 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2042 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2043 CHECK(val->result_ok);
2044 LDKNodeFeatures res_var = (*val->contents.result);
2045 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2046 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2047 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2051 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2052 CHECK(!val->result_ok);
2053 LDKDecodeError err_var = (*val->contents.err);
2054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2060 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2063 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2064 CHECK(val->result_ok);
2065 LDKChannelFeatures res_var = (*val->contents.result);
2066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2072 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2073 CHECK(!val->result_ok);
2074 LDKDecodeError err_var = (*val->contents.err);
2075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2081 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2084 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2085 CHECK(val->result_ok);
2086 LDKInvoiceFeatures res_var = (*val->contents.result);
2087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2093 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2094 CHECK(!val->result_ok);
2095 LDKDecodeError err_var = (*val->contents.err);
2096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2102 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2105 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2106 CHECK(val->result_ok);
2107 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2108 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2109 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2110 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2114 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2115 CHECK(!val->result_ok);
2116 LDKDecodeError err_var = (*val->contents.err);
2117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2123 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2126 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2127 CHECK(val->result_ok);
2128 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2129 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2130 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2131 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2135 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2136 CHECK(!val->result_ok);
2137 LDKDecodeError err_var = (*val->contents.err);
2138 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2139 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2140 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2144 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2147 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2148 CHECK(val->result_ok);
2149 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2153 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2154 CHECK(!val->result_ok);
2155 LDKDecodeError err_var = (*val->contents.err);
2156 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2157 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2158 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2162 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2165 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2166 CHECK(val->result_ok);
2167 return *val->contents.result;
2169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2170 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2171 CHECK(!val->result_ok);
2172 return *val->contents.err;
2174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2175 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2177 CHECK((*env)->GetArrayLength(env, a) == 64);
2178 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2180 LDKCVec_SignatureZ b_constr;
2181 b_constr.datalen = (*env)->GetArrayLength(env, b);
2182 if (b_constr.datalen > 0)
2183 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2185 b_constr.data = NULL;
2186 for (size_t i = 0; i < b_constr.datalen; i++) {
2187 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2188 LDKSignature b_conv_8_ref;
2189 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2190 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2191 b_constr.data[i] = b_conv_8_ref;
2194 return (uint64_t)ret;
2196 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
2200 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2201 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form);
2206 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2209 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
2210 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2211 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
2212 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2214 for (size_t i = 0; i < ret_var.datalen; i++) {
2215 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2216 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2217 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2224 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2227 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2228 CHECK(val->result_ok);
2229 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2230 *res_conv = (*val->contents.result);
2231 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
2232 return ((uint64_t)res_conv);
2234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2235 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2236 CHECK(!val->result_ok);
2237 return *val->contents.err;
2239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2240 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2243 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2244 CHECK(val->result_ok);
2245 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2246 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2250 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2251 CHECK(!val->result_ok);
2252 return *val->contents.err;
2254 typedef struct LDKBaseSign_JCalls {
2255 atomic_size_t refcnt;
2258 jmethodID get_per_commitment_point_meth;
2259 jmethodID release_commitment_secret_meth;
2260 jmethodID validate_holder_commitment_meth;
2261 jmethodID channel_keys_id_meth;
2262 jmethodID sign_counterparty_commitment_meth;
2263 jmethodID validate_counterparty_revocation_meth;
2264 jmethodID sign_holder_commitment_and_htlcs_meth;
2265 jmethodID sign_justice_revoked_output_meth;
2266 jmethodID sign_justice_revoked_htlc_meth;
2267 jmethodID sign_counterparty_htlc_transaction_meth;
2268 jmethodID sign_closing_transaction_meth;
2269 jmethodID sign_channel_announcement_meth;
2270 jmethodID ready_channel_meth;
2271 } LDKBaseSign_JCalls;
2272 static void LDKBaseSign_JCalls_free(void* this_arg) {
2273 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2274 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2277 if (get_jenv_res == JNI_EDETACHED) {
2278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2280 DO_ASSERT(get_jenv_res == JNI_OK);
2282 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2283 if (get_jenv_res == JNI_EDETACHED) {
2284 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2289 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2290 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2292 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2293 if (get_jenv_res == JNI_EDETACHED) {
2294 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2296 DO_ASSERT(get_jenv_res == JNI_OK);
2298 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2300 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2301 if ((*env)->ExceptionCheck(env)) {
2302 (*env)->ExceptionDescribe(env);
2303 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2305 LDKPublicKey ret_ref;
2306 CHECK((*env)->GetArrayLength(env, ret) == 33);
2307 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2308 if (get_jenv_res == JNI_EDETACHED) {
2309 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2313 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2314 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2316 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2317 if (get_jenv_res == JNI_EDETACHED) {
2318 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2320 DO_ASSERT(get_jenv_res == JNI_OK);
2322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2324 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2325 if ((*env)->ExceptionCheck(env)) {
2326 (*env)->ExceptionDescribe(env);
2327 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2329 LDKThirtyTwoBytes ret_ref;
2330 CHECK((*env)->GetArrayLength(env, ret) == 32);
2331 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2332 if (get_jenv_res == JNI_EDETACHED) {
2333 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2337 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2338 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2340 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2341 if (get_jenv_res == JNI_EDETACHED) {
2342 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2344 DO_ASSERT(get_jenv_res == JNI_OK);
2346 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2347 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2348 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2349 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2350 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
2351 if (holder_tx_var.is_owned) {
2354 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2356 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2357 if ((*env)->ExceptionCheck(env)) {
2358 (*env)->ExceptionDescribe(env);
2359 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2361 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2362 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2363 if (get_jenv_res == JNI_EDETACHED) {
2364 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2368 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2369 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2371 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2372 if (get_jenv_res == JNI_EDETACHED) {
2373 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2375 DO_ASSERT(get_jenv_res == JNI_OK);
2377 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2379 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2380 if ((*env)->ExceptionCheck(env)) {
2381 (*env)->ExceptionDescribe(env);
2382 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2384 LDKThirtyTwoBytes ret_ref;
2385 CHECK((*env)->GetArrayLength(env, ret) == 32);
2386 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2387 if (get_jenv_res == JNI_EDETACHED) {
2388 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2392 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2393 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2396 if (get_jenv_res == JNI_EDETACHED) {
2397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2399 DO_ASSERT(get_jenv_res == JNI_OK);
2401 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2402 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2403 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2404 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2405 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2406 if (commitment_tx_var.is_owned) {
2407 commitment_tx_ref |= 1;
2409 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2411 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2412 if ((*env)->ExceptionCheck(env)) {
2413 (*env)->ExceptionDescribe(env);
2414 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2416 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2417 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2418 if (get_jenv_res == JNI_EDETACHED) {
2419 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2423 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2424 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2426 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2427 if (get_jenv_res == JNI_EDETACHED) {
2428 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2430 DO_ASSERT(get_jenv_res == JNI_OK);
2432 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2433 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2436 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2437 if ((*env)->ExceptionCheck(env)) {
2438 (*env)->ExceptionDescribe(env);
2439 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2441 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2442 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2443 if (get_jenv_res == JNI_EDETACHED) {
2444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2448 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2449 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2451 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2452 if (get_jenv_res == JNI_EDETACHED) {
2453 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2455 DO_ASSERT(get_jenv_res == JNI_OK);
2457 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2458 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2459 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2460 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2461 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2462 if (commitment_tx_var.is_owned) {
2463 commitment_tx_ref |= 1;
2465 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2467 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2468 if ((*env)->ExceptionCheck(env)) {
2469 (*env)->ExceptionDescribe(env);
2470 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2472 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2473 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2474 if (get_jenv_res == JNI_EDETACHED) {
2475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2479 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2480 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2482 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2483 if (get_jenv_res == JNI_EDETACHED) {
2484 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2486 DO_ASSERT(get_jenv_res == JNI_OK);
2488 LDKTransaction justice_tx_var = justice_tx;
2489 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2490 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2491 Transaction_free(justice_tx_var);
2492 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2493 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2494 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2496 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2497 if ((*env)->ExceptionCheck(env)) {
2498 (*env)->ExceptionDescribe(env);
2499 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2501 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2502 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2503 if (get_jenv_res == JNI_EDETACHED) {
2504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2508 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2509 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2511 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2512 if (get_jenv_res == JNI_EDETACHED) {
2513 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2515 DO_ASSERT(get_jenv_res == JNI_OK);
2517 LDKTransaction justice_tx_var = justice_tx;
2518 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2519 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2520 Transaction_free(justice_tx_var);
2521 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2522 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2523 LDKHTLCOutputInCommitment htlc_var = *htlc;
2524 htlc_var = HTLCOutputInCommitment_clone(htlc);
2525 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2526 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2527 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2528 if (htlc_var.is_owned) {
2531 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2533 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2534 if ((*env)->ExceptionCheck(env)) {
2535 (*env)->ExceptionDescribe(env);
2536 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2538 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2539 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2540 if (get_jenv_res == JNI_EDETACHED) {
2541 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2545 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2546 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2548 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2549 if (get_jenv_res == JNI_EDETACHED) {
2550 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2552 DO_ASSERT(get_jenv_res == JNI_OK);
2554 LDKTransaction htlc_tx_var = htlc_tx;
2555 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2556 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2557 Transaction_free(htlc_tx_var);
2558 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2559 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2560 LDKHTLCOutputInCommitment htlc_var = *htlc;
2561 htlc_var = HTLCOutputInCommitment_clone(htlc);
2562 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2563 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2564 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2565 if (htlc_var.is_owned) {
2568 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2570 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2571 if ((*env)->ExceptionCheck(env)) {
2572 (*env)->ExceptionDescribe(env);
2573 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2575 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2576 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2577 if (get_jenv_res == JNI_EDETACHED) {
2578 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2582 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2583 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2585 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2586 if (get_jenv_res == JNI_EDETACHED) {
2587 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2589 DO_ASSERT(get_jenv_res == JNI_OK);
2591 LDKClosingTransaction closing_tx_var = *closing_tx;
2592 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
2593 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2594 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2595 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
2596 if (closing_tx_var.is_owned) {
2597 closing_tx_ref |= 1;
2599 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2601 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2602 if ((*env)->ExceptionCheck(env)) {
2603 (*env)->ExceptionDescribe(env);
2604 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2606 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2607 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2608 if (get_jenv_res == JNI_EDETACHED) {
2609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2613 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2614 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2616 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2617 if (get_jenv_res == JNI_EDETACHED) {
2618 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2620 DO_ASSERT(get_jenv_res == JNI_OK);
2622 LDKUnsignedChannelAnnouncement msg_var = *msg;
2623 msg_var = UnsignedChannelAnnouncement_clone(msg);
2624 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2625 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2626 uint64_t msg_ref = (uint64_t)msg_var.inner;
2627 if (msg_var.is_owned) {
2630 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2632 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2633 if ((*env)->ExceptionCheck(env)) {
2634 (*env)->ExceptionDescribe(env);
2635 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2637 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2638 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2639 if (get_jenv_res == JNI_EDETACHED) {
2640 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2644 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2645 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2647 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2648 if (get_jenv_res == JNI_EDETACHED) {
2649 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2651 DO_ASSERT(get_jenv_res == JNI_OK);
2653 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2654 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2655 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2656 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2657 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2658 if (channel_parameters_var.is_owned) {
2659 channel_parameters_ref |= 1;
2661 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2663 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2664 if ((*env)->ExceptionCheck(env)) {
2665 (*env)->ExceptionDescribe(env);
2666 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2668 if (get_jenv_res == JNI_EDETACHED) {
2669 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2672 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2673 jclass c = (*env)->GetObjectClass(env, o);
2675 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2676 atomic_init(&calls->refcnt, 1);
2677 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2678 calls->o = (*env)->NewWeakGlobalRef(env, o);
2679 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2680 CHECK(calls->get_per_commitment_point_meth != NULL);
2681 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2682 CHECK(calls->release_commitment_secret_meth != NULL);
2683 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2684 CHECK(calls->validate_holder_commitment_meth != NULL);
2685 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2686 CHECK(calls->channel_keys_id_meth != NULL);
2687 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2688 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2689 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2690 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2691 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2692 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2693 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2694 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2695 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2696 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2697 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2698 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2699 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2700 CHECK(calls->sign_closing_transaction_meth != NULL);
2701 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2702 CHECK(calls->sign_channel_announcement_meth != NULL);
2703 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2704 CHECK(calls->ready_channel_meth != NULL);
2706 LDKChannelPublicKeys pubkeys_conv;
2707 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2708 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2709 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2712 .this_arg = (void*) calls,
2713 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2714 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2715 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2716 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2717 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2718 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2719 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2720 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2721 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2722 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2723 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2724 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2725 .ready_channel = ready_channel_LDKBaseSign_jcall,
2726 .free = LDKBaseSign_JCalls_free,
2727 .pubkeys = pubkeys_conv,
2728 .set_pubkeys = NULL,
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2733 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2734 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2735 return (uint64_t)res_ptr;
2737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2738 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2739 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2740 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2745 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2746 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2747 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
2752 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2753 LDKHolderCommitmentTransaction holder_tx_conv;
2754 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2755 holder_tx_conv.is_owned = false;
2756 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2757 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2758 return (uint64_t)ret_conv;
2761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2762 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2763 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2764 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2769 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2770 LDKCommitmentTransaction commitment_tx_conv;
2771 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2772 commitment_tx_conv.is_owned = false;
2773 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2774 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2775 return (uint64_t)ret_conv;
2778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
2779 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2780 unsigned char secret_arr[32];
2781 CHECK((*env)->GetArrayLength(env, secret) == 32);
2782 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2783 unsigned char (*secret_ref)[32] = &secret_arr;
2784 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2785 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2786 return (uint64_t)ret_conv;
2789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2790 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2791 LDKHolderCommitmentTransaction commitment_tx_conv;
2792 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2793 commitment_tx_conv.is_owned = false;
2794 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2795 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2796 return (uint64_t)ret_conv;
2799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2800 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2801 LDKTransaction justice_tx_ref;
2802 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2803 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2804 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2805 justice_tx_ref.data_is_owned = true;
2806 unsigned char per_commitment_key_arr[32];
2807 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2808 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2809 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2810 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2811 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2812 return (uint64_t)ret_conv;
2815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2816 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2817 LDKTransaction justice_tx_ref;
2818 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2819 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2820 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2821 justice_tx_ref.data_is_owned = true;
2822 unsigned char per_commitment_key_arr[32];
2823 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2824 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2825 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2826 LDKHTLCOutputInCommitment htlc_conv;
2827 htlc_conv.inner = (void*)(htlc & (~1));
2828 htlc_conv.is_owned = false;
2829 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2830 *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2831 return (uint64_t)ret_conv;
2834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2835 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2836 LDKTransaction htlc_tx_ref;
2837 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2838 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2839 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2840 htlc_tx_ref.data_is_owned = true;
2841 LDKPublicKey per_commitment_point_ref;
2842 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2843 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2844 LDKHTLCOutputInCommitment htlc_conv;
2845 htlc_conv.inner = (void*)(htlc & (~1));
2846 htlc_conv.is_owned = false;
2847 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2848 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
2849 return (uint64_t)ret_conv;
2852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
2853 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2854 LDKClosingTransaction closing_tx_conv;
2855 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2856 closing_tx_conv.is_owned = false;
2857 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2858 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2859 return (uint64_t)ret_conv;
2862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2863 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2864 LDKUnsignedChannelAnnouncement msg_conv;
2865 msg_conv.inner = (void*)(msg & (~1));
2866 msg_conv.is_owned = false;
2867 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2868 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2869 return (uint64_t)ret_conv;
2872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2873 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2874 LDKChannelTransactionParameters channel_parameters_conv;
2875 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2876 channel_parameters_conv.is_owned = false;
2877 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2880 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2881 if (this_arg->set_pubkeys != NULL)
2882 this_arg->set_pubkeys(this_arg);
2883 return this_arg->pubkeys;
2885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2886 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2887 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2890 uint64_t ret_ref = (uint64_t)ret_var.inner;
2891 if (ret_var.is_owned) {
2897 typedef struct LDKSign_JCalls {
2898 atomic_size_t refcnt;
2901 LDKBaseSign_JCalls* BaseSign;
2902 jmethodID write_meth;
2904 static void LDKSign_JCalls_free(void* this_arg) {
2905 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2906 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2909 if (get_jenv_res == JNI_EDETACHED) {
2910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2912 DO_ASSERT(get_jenv_res == JNI_OK);
2914 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2915 if (get_jenv_res == JNI_EDETACHED) {
2916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2921 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2922 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2924 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2925 if (get_jenv_res == JNI_EDETACHED) {
2926 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2928 DO_ASSERT(get_jenv_res == JNI_OK);
2930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2932 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2933 if ((*env)->ExceptionCheck(env)) {
2934 (*env)->ExceptionDescribe(env);
2935 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2937 LDKCVec_u8Z ret_ref;
2938 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2939 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2940 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2941 if (get_jenv_res == JNI_EDETACHED) {
2942 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2946 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2947 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2948 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2949 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2951 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2952 jclass c = (*env)->GetObjectClass(env, o);
2954 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2955 atomic_init(&calls->refcnt, 1);
2956 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2957 calls->o = (*env)->NewWeakGlobalRef(env, o);
2958 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2959 CHECK(calls->write_meth != NULL);
2961 LDKChannelPublicKeys pubkeys_conv;
2962 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2963 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2964 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2967 .this_arg = (void*) calls,
2968 .write = write_LDKSign_jcall,
2969 .cloned = LDKSign_JCalls_cloned,
2970 .free = LDKSign_JCalls_free,
2971 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2973 calls->BaseSign = ret.BaseSign.this_arg;
2976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2977 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2978 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2979 return (uint64_t)res_ptr;
2981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2982 LDKSign *inp = (LDKSign *)(arg & ~1);
2983 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2984 DO_ASSERT((res_ptr & 1) == 0);
2985 return (int64_t)(res_ptr | 1);
2987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2988 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2989 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2992 CVec_u8Z_free(ret_var);
2996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2997 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3000 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3001 CHECK(val->result_ok);
3002 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
3003 *res_ret = Sign_clone(&(*val->contents.result));
3004 return (uint64_t)res_ret;
3006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3007 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3008 CHECK(!val->result_ok);
3009 LDKDecodeError err_var = (*val->contents.err);
3010 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3016 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
3018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3019 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3020 CHECK(val->result_ok);
3021 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3022 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3026 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3027 CHECK(!val->result_ok);
3028 return *val->contents.err;
3030 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3031 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3032 for (size_t i = 0; i < ret.datalen; i++) {
3033 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3038 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3040 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3041 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3042 CHECK(val->result_ok);
3043 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3044 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3046 for (size_t i = 0; i < res_var.datalen; i++) {
3047 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3048 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3049 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3050 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3055 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3056 CHECK(!val->result_ok);
3057 return *val->contents.err;
3059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3060 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3063 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3064 CHECK(val->result_ok);
3065 LDKInMemorySigner res_var = (*val->contents.result);
3066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3072 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3073 CHECK(!val->result_ok);
3074 LDKDecodeError err_var = (*val->contents.err);
3075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3081 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3082 ret->datalen = (*env)->GetArrayLength(env, elems);
3083 if (ret->datalen == 0) {
3086 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3087 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3088 for (size_t i = 0; i < ret->datalen; i++) {
3089 int64_t arr_elem = java_elems[i];
3090 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3091 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3092 ret->data[i] = arr_elem_conv;
3094 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3096 return (uint64_t)ret;
3098 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3099 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3100 for (size_t i = 0; i < ret.datalen; i++) {
3101 ret.data[i] = TxOut_clone(&orig->data[i]);
3105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3106 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3109 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3110 CHECK(val->result_ok);
3111 LDKTransaction res_var = (*val->contents.result);
3112 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3113 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3117 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3118 CHECK(!val->result_ok);
3119 return *val->contents.err;
3121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3122 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3123 LDKThirtyTwoBytes a_ref;
3124 CHECK((*env)->GetArrayLength(env, a) == 32);
3125 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3127 LDKChannelMonitor b_conv;
3128 b_conv.inner = (void*)(b & (~1));
3129 b_conv.is_owned = (b & 1) || (b == 0);
3130 b_conv = ChannelMonitor_clone(&b_conv);
3132 return (uint64_t)ret;
3134 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3135 return ThirtyTwoBytes_clone(&tuple->a);
3137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3138 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3139 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data);
3144 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3145 return ChannelMonitor_clone(&tuple->b);
3147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3148 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3149 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
3150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 uint64_t ret_ref = (uint64_t)ret_var.inner;
3153 if (ret_var.is_owned) {
3159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3160 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3161 ret->datalen = (*env)->GetArrayLength(env, elems);
3162 if (ret->datalen == 0) {
3165 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3166 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3167 for (size_t i = 0; i < ret->datalen; i++) {
3168 int64_t arr_elem = java_elems[i];
3169 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3170 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
3171 ret->data[i] = arr_elem_conv;
3173 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3175 return (uint64_t)ret;
3177 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
3178 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
3179 for (size_t i = 0; i < ret.datalen; i++) {
3180 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
3184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3185 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3187 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3188 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3189 CHECK(val->result_ok);
3190 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3191 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3192 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3193 for (size_t j = 0; j < res_var.datalen; j++) {
3194 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3195 *res_conv_35_conv = res_var.data[j];
3196 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
3197 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
3199 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3202 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3203 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3204 CHECK(!val->result_ok);
3205 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3209 return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok;
3211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3212 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
3213 CHECK(val->result_ok);
3214 LDKPaymentId res_var = (*val->contents.result);
3215 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3216 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3217 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3221 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
3222 CHECK(!val->result_ok);
3223 LDKDecodeError err_var = (*val->contents.err);
3224 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3225 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3226 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3229 static jclass LDKCOption_u16Z_Some_class = NULL;
3230 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3231 static jclass LDKCOption_u16Z_None_class = NULL;
3232 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3234 LDKCOption_u16Z_Some_class =
3235 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3236 CHECK(LDKCOption_u16Z_Some_class != NULL);
3237 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3238 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3239 LDKCOption_u16Z_None_class =
3240 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3241 CHECK(LDKCOption_u16Z_None_class != NULL);
3242 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3243 CHECK(LDKCOption_u16Z_None_meth != NULL);
3245 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3246 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3248 case LDKCOption_u16Z_Some: {
3249 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3251 case LDKCOption_u16Z_None: {
3252 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3257 static jclass LDKAPIError_APIMisuseError_class = NULL;
3258 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3259 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3260 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3261 static jclass LDKAPIError_RouteError_class = NULL;
3262 static jmethodID LDKAPIError_RouteError_meth = NULL;
3263 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3264 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3265 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3266 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3267 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3268 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3270 LDKAPIError_APIMisuseError_class =
3271 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3272 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3273 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3274 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3275 LDKAPIError_FeeRateTooHigh_class =
3276 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3277 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3278 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3279 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3280 LDKAPIError_RouteError_class =
3281 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3282 CHECK(LDKAPIError_RouteError_class != NULL);
3283 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3284 CHECK(LDKAPIError_RouteError_meth != NULL);
3285 LDKAPIError_ChannelUnavailable_class =
3286 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3287 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3288 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3289 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3290 LDKAPIError_MonitorUpdateFailed_class =
3291 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3292 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3293 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3294 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3295 LDKAPIError_IncompatibleShutdownScript_class =
3296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3297 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3298 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3299 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3301 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3302 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3304 case LDKAPIError_APIMisuseError: {
3305 LDKStr err_str = obj->api_misuse_error.err;
3306 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3307 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3309 case LDKAPIError_FeeRateTooHigh: {
3310 LDKStr err_str = obj->fee_rate_too_high.err;
3311 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3312 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3314 case LDKAPIError_RouteError: {
3315 LDKStr err_str = obj->route_error.err;
3316 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3317 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3319 case LDKAPIError_ChannelUnavailable: {
3320 LDKStr err_str = obj->channel_unavailable.err;
3321 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3322 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3324 case LDKAPIError_MonitorUpdateFailed: {
3325 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3327 case LDKAPIError_IncompatibleShutdownScript: {
3328 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3329 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3330 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3331 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3332 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3338 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3341 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3342 CHECK(val->result_ok);
3343 return *val->contents.result;
3345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3346 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3347 CHECK(!val->result_ok);
3348 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3352 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3353 ret->datalen = (*env)->GetArrayLength(env, elems);
3354 if (ret->datalen == 0) {
3357 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3358 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3359 for (size_t i = 0; i < ret->datalen; i++) {
3360 int64_t arr_elem = java_elems[i];
3361 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3362 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3363 ret->data[i] = arr_elem_conv;
3365 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3367 return (uint64_t)ret;
3369 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3370 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3371 for (size_t i = 0; i < ret.datalen; i++) {
3372 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3377 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3378 ret->datalen = (*env)->GetArrayLength(env, elems);
3379 if (ret->datalen == 0) {
3382 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3383 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3384 for (size_t i = 0; i < ret->datalen; i++) {
3385 int64_t arr_elem = java_elems[i];
3386 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3387 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3388 ret->data[i] = arr_elem_conv;
3390 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3392 return (uint64_t)ret;
3394 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3395 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3396 for (size_t i = 0; i < ret.datalen; i++) {
3397 ret.data[i] = APIError_clone(&orig->data[i]);
3401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3402 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
3404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3405 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3406 CHECK(val->result_ok);
3407 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3408 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3412 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3413 CHECK(!val->result_ok);
3414 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3417 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3418 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3419 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3420 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3421 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3422 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3423 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3424 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3426 LDKPaymentSendFailure_ParameterError_class =
3427 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3428 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3429 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3430 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3431 LDKPaymentSendFailure_PathParameterError_class =
3432 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3433 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3434 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3435 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3436 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3437 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3438 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3439 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3440 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3441 LDKPaymentSendFailure_PartialFailure_class =
3442 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3443 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3444 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3445 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3447 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3448 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3450 case LDKPaymentSendFailure_ParameterError: {
3451 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3452 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3454 case LDKPaymentSendFailure_PathParameterError: {
3455 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3456 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3457 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3458 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3459 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3460 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3461 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3462 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3464 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3465 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3467 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3468 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3469 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3470 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3471 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3472 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3473 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3475 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3476 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3478 case LDKPaymentSendFailure_PartialFailure: {
3479 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3480 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3481 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3482 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3483 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3484 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3485 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3486 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3488 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3489 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3495 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
3497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3498 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3499 CHECK(val->result_ok);
3500 LDKPaymentId res_var = (*val->contents.result);
3501 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3502 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3503 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3507 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3508 CHECK(!val->result_ok);
3509 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3513 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3516 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3517 CHECK(val->result_ok);
3518 return *val->contents.result;
3520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3521 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3522 CHECK(!val->result_ok);
3523 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3527 LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3528 LDKThirtyTwoBytes a_ref;
3529 CHECK((*env)->GetArrayLength(env, a) == 32);
3530 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3532 LDKPaymentId b_conv;
3533 b_conv.inner = (void*)(b & (~1));
3534 b_conv.is_owned = (b & 1) || (b == 0);
3535 b_conv = PaymentId_clone(&b_conv);
3537 return (uint64_t)ret;
3539 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3540 return ThirtyTwoBytes_clone(&tuple->a);
3542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3543 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3544 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3545 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data);
3549 static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3550 return PaymentId_clone(&tuple->b);
3552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3553 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3554 LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv);
3555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3557 uint64_t ret_ref = (uint64_t)ret_var.inner;
3558 if (ret_var.is_owned) {
3564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3565 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
3567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3568 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3569 CHECK(val->result_ok);
3570 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3571 *res_conv = (*val->contents.result);
3572 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
3573 return ((uint64_t)res_conv);
3575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3576 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3577 CHECK(!val->result_ok);
3578 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3581 static jclass LDKNetAddress_IPv4_class = NULL;
3582 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3583 static jclass LDKNetAddress_IPv6_class = NULL;
3584 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3585 static jclass LDKNetAddress_OnionV2_class = NULL;
3586 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3587 static jclass LDKNetAddress_OnionV3_class = NULL;
3588 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3590 LDKNetAddress_IPv4_class =
3591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3592 CHECK(LDKNetAddress_IPv4_class != NULL);
3593 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3594 CHECK(LDKNetAddress_IPv4_meth != NULL);
3595 LDKNetAddress_IPv6_class =
3596 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3597 CHECK(LDKNetAddress_IPv6_class != NULL);
3598 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3599 CHECK(LDKNetAddress_IPv6_meth != NULL);
3600 LDKNetAddress_OnionV2_class =
3601 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3602 CHECK(LDKNetAddress_OnionV2_class != NULL);
3603 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3604 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3605 LDKNetAddress_OnionV3_class =
3606 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3607 CHECK(LDKNetAddress_OnionV3_class != NULL);
3608 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3609 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3612 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3614 case LDKNetAddress_IPv4: {
3615 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3616 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3617 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3619 case LDKNetAddress_IPv6: {
3620 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3621 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3622 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3624 case LDKNetAddress_OnionV2: {
3625 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3626 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3627 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3629 case LDKNetAddress_OnionV3: {
3630 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3631 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3632 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);
3637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3638 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3639 ret->datalen = (*env)->GetArrayLength(env, elems);
3640 if (ret->datalen == 0) {
3643 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3644 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3645 for (size_t i = 0; i < ret->datalen; i++) {
3646 int64_t arr_elem = java_elems[i];
3647 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3648 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3649 ret->data[i] = arr_elem_conv;
3651 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3653 return (uint64_t)ret;
3655 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3656 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3657 for (size_t i = 0; i < ret.datalen; i++) {
3658 ret.data[i] = NetAddress_clone(&orig->data[i]);
3662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3663 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3664 LDKThirtyTwoBytes a_ref;
3665 CHECK((*env)->GetArrayLength(env, a) == 32);
3666 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3668 LDKThirtyTwoBytes b_ref;
3669 CHECK((*env)->GetArrayLength(env, b) == 32);
3670 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3672 return (uint64_t)ret;
3674 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3675 return ThirtyTwoBytes_clone(&tuple->a);
3677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3678 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3679 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data);
3684 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3685 return ThirtyTwoBytes_clone(&tuple->b);
3687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3688 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3689 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data);
3694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3695 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3698 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3699 CHECK(val->result_ok);
3700 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3701 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3705 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3706 CHECK(!val->result_ok);
3707 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3711 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3712 ret->datalen = (*env)->GetArrayLength(env, elems);
3713 if (ret->datalen == 0) {
3716 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3717 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3718 for (size_t i = 0; i < ret->datalen; i++) {
3719 int64_t arr_elem = java_elems[i];
3720 LDKChannelMonitor arr_elem_conv;
3721 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3722 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3723 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3724 ret->data[i] = arr_elem_conv;
3726 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3728 return (uint64_t)ret;
3730 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3731 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3732 for (size_t i = 0; i < ret.datalen; i++) {
3733 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3737 typedef struct LDKWatch_JCalls {
3738 atomic_size_t refcnt;
3741 jmethodID watch_channel_meth;
3742 jmethodID update_channel_meth;
3743 jmethodID release_pending_monitor_events_meth;
3745 static void LDKWatch_JCalls_free(void* this_arg) {
3746 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3747 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3749 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3750 if (get_jenv_res == JNI_EDETACHED) {
3751 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3753 DO_ASSERT(get_jenv_res == JNI_OK);
3755 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3756 if (get_jenv_res == JNI_EDETACHED) {
3757 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3762 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3763 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3765 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3766 if (get_jenv_res == JNI_EDETACHED) {
3767 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3769 DO_ASSERT(get_jenv_res == JNI_OK);
3771 LDKOutPoint funding_txo_var = funding_txo;
3772 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3773 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3774 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3775 if (funding_txo_var.is_owned) {
3776 funding_txo_ref |= 1;
3778 LDKChannelMonitor monitor_var = monitor;
3779 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3780 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3781 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3782 if (monitor_var.is_owned) {
3785 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3787 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3788 if ((*env)->ExceptionCheck(env)) {
3789 (*env)->ExceptionDescribe(env);
3790 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3792 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3793 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3794 if (get_jenv_res == JNI_EDETACHED) {
3795 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3799 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3800 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3802 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3803 if (get_jenv_res == JNI_EDETACHED) {
3804 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3806 DO_ASSERT(get_jenv_res == JNI_OK);
3808 LDKOutPoint funding_txo_var = funding_txo;
3809 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3810 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3811 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3812 if (funding_txo_var.is_owned) {
3813 funding_txo_ref |= 1;
3815 LDKChannelMonitorUpdate update_var = update;
3816 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3817 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3818 uint64_t update_ref = (uint64_t)update_var.inner;
3819 if (update_var.is_owned) {
3822 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3824 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3825 if ((*env)->ExceptionCheck(env)) {
3826 (*env)->ExceptionDescribe(env);
3827 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3829 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3830 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3831 if (get_jenv_res == JNI_EDETACHED) {
3832 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3836 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3837 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3839 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3840 if (get_jenv_res == JNI_EDETACHED) {
3841 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3843 DO_ASSERT(get_jenv_res == JNI_OK);
3845 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3847 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3848 if ((*env)->ExceptionCheck(env)) {
3849 (*env)->ExceptionDescribe(env);
3850 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3852 LDKCVec_MonitorEventZ ret_constr;
3853 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3854 if (ret_constr.datalen > 0)
3855 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3857 ret_constr.data = NULL;
3858 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3859 for (size_t o = 0; o < ret_constr.datalen; o++) {
3860 int64_t ret_conv_14 = ret_vals[o];
3861 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3862 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3863 ret_constr.data[o] = ret_conv_14_conv;
3865 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3866 if (get_jenv_res == JNI_EDETACHED) {
3867 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3871 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3872 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3873 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3875 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3876 jclass c = (*env)->GetObjectClass(env, o);
3878 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3879 atomic_init(&calls->refcnt, 1);
3880 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3881 calls->o = (*env)->NewWeakGlobalRef(env, o);
3882 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3883 CHECK(calls->watch_channel_meth != NULL);
3884 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3885 CHECK(calls->update_channel_meth != NULL);
3886 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3887 CHECK(calls->release_pending_monitor_events_meth != NULL);
3890 .this_arg = (void*) calls,
3891 .watch_channel = watch_channel_LDKWatch_jcall,
3892 .update_channel = update_channel_LDKWatch_jcall,
3893 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3894 .free = LDKWatch_JCalls_free,
3898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3899 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3900 *res_ptr = LDKWatch_init(env, clz, o);
3901 return (uint64_t)res_ptr;
3903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
3904 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3905 LDKOutPoint funding_txo_conv;
3906 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3907 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3908 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3909 LDKChannelMonitor monitor_conv;
3910 monitor_conv.inner = (void*)(monitor & (~1));
3911 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3912 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3913 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3914 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3915 return (uint64_t)ret_conv;
3918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
3919 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3920 LDKOutPoint funding_txo_conv;
3921 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3922 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3923 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3924 LDKChannelMonitorUpdate update_conv;
3925 update_conv.inner = (void*)(update & (~1));
3926 update_conv.is_owned = (update & 1) || (update == 0);
3927 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3928 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3929 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3930 return (uint64_t)ret_conv;
3933 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3934 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3935 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3936 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3937 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3938 for (size_t o = 0; o < ret_var.datalen; o++) {
3939 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3940 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3941 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3942 ret_arr_ptr[o] = ret_conv_14_ref;
3944 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3949 typedef struct LDKBroadcasterInterface_JCalls {
3950 atomic_size_t refcnt;
3953 jmethodID broadcast_transaction_meth;
3954 } LDKBroadcasterInterface_JCalls;
3955 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3956 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3957 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3959 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3960 if (get_jenv_res == JNI_EDETACHED) {
3961 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3963 DO_ASSERT(get_jenv_res == JNI_OK);
3965 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3966 if (get_jenv_res == JNI_EDETACHED) {
3967 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3972 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3973 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3975 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3976 if (get_jenv_res == JNI_EDETACHED) {
3977 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3979 DO_ASSERT(get_jenv_res == JNI_OK);
3981 LDKTransaction tx_var = tx;
3982 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3983 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3984 Transaction_free(tx_var);
3985 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3987 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3988 if ((*env)->ExceptionCheck(env)) {
3989 (*env)->ExceptionDescribe(env);
3990 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3992 if (get_jenv_res == JNI_EDETACHED) {
3993 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3996 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3997 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3998 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4000 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
4001 jclass c = (*env)->GetObjectClass(env, o);
4003 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4004 atomic_init(&calls->refcnt, 1);
4005 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4006 calls->o = (*env)->NewWeakGlobalRef(env, o);
4007 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
4008 CHECK(calls->broadcast_transaction_meth != NULL);
4010 LDKBroadcasterInterface ret = {
4011 .this_arg = (void*) calls,
4012 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4013 .free = LDKBroadcasterInterface_JCalls_free,
4017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4018 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4019 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
4020 return (uint64_t)res_ptr;
4022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
4023 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
4024 LDKTransaction tx_ref;
4025 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
4026 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4027 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
4028 tx_ref.data_is_owned = true;
4029 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4032 typedef struct LDKKeysInterface_JCalls {
4033 atomic_size_t refcnt;
4036 jmethodID get_node_secret_meth;
4037 jmethodID get_destination_script_meth;
4038 jmethodID get_shutdown_scriptpubkey_meth;
4039 jmethodID get_channel_signer_meth;
4040 jmethodID get_secure_random_bytes_meth;
4041 jmethodID read_chan_signer_meth;
4042 jmethodID sign_invoice_meth;
4043 } LDKKeysInterface_JCalls;
4044 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4045 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4046 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4048 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4049 if (get_jenv_res == JNI_EDETACHED) {
4050 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4052 DO_ASSERT(get_jenv_res == JNI_OK);
4054 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4055 if (get_jenv_res == JNI_EDETACHED) {
4056 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4061 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
4062 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4064 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4065 if (get_jenv_res == JNI_EDETACHED) {
4066 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4068 DO_ASSERT(get_jenv_res == JNI_OK);
4070 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4072 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
4073 if ((*env)->ExceptionCheck(env)) {
4074 (*env)->ExceptionDescribe(env);
4075 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
4077 LDKSecretKey ret_ref;
4078 CHECK((*env)->GetArrayLength(env, ret) == 32);
4079 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
4080 if (get_jenv_res == JNI_EDETACHED) {
4081 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4085 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4086 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4088 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4089 if (get_jenv_res == JNI_EDETACHED) {
4090 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4092 DO_ASSERT(get_jenv_res == JNI_OK);
4094 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4096 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
4097 if ((*env)->ExceptionCheck(env)) {
4098 (*env)->ExceptionDescribe(env);
4099 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
4101 LDKCVec_u8Z ret_ref;
4102 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4103 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4104 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4105 if (get_jenv_res == JNI_EDETACHED) {
4106 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4110 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4111 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4113 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4114 if (get_jenv_res == JNI_EDETACHED) {
4115 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4117 DO_ASSERT(get_jenv_res == JNI_OK);
4119 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4121 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
4122 if ((*env)->ExceptionCheck(env)) {
4123 (*env)->ExceptionDescribe(env);
4124 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
4126 LDKShutdownScript ret_conv;
4127 ret_conv.inner = (void*)(ret & (~1));
4128 ret_conv.is_owned = (ret & 1) || (ret == 0);
4129 ret_conv = ShutdownScript_clone(&ret_conv);
4130 if (get_jenv_res == JNI_EDETACHED) {
4131 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4135 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4136 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4138 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4139 if (get_jenv_res == JNI_EDETACHED) {
4140 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4142 DO_ASSERT(get_jenv_res == JNI_OK);
4144 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4146 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4147 if ((*env)->ExceptionCheck(env)) {
4148 (*env)->ExceptionDescribe(env);
4149 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4151 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
4152 ret_conv = Sign_clone(&ret_conv);
4153 if (get_jenv_res == JNI_EDETACHED) {
4154 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4158 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4159 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4161 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4162 if (get_jenv_res == JNI_EDETACHED) {
4163 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4165 DO_ASSERT(get_jenv_res == JNI_OK);
4167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4169 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4170 if ((*env)->ExceptionCheck(env)) {
4171 (*env)->ExceptionDescribe(env);
4172 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4174 LDKThirtyTwoBytes ret_ref;
4175 CHECK((*env)->GetArrayLength(env, ret) == 32);
4176 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4177 if (get_jenv_res == JNI_EDETACHED) {
4178 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4182 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4183 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4185 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4186 if (get_jenv_res == JNI_EDETACHED) {
4187 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4189 DO_ASSERT(get_jenv_res == JNI_OK);
4191 LDKu8slice reader_var = reader;
4192 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4193 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4194 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4196 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4197 if ((*env)->ExceptionCheck(env)) {
4198 (*env)->ExceptionDescribe(env);
4199 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4201 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
4202 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4203 if (get_jenv_res == JNI_EDETACHED) {
4204 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4208 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4209 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4211 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4212 if (get_jenv_res == JNI_EDETACHED) {
4213 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4215 DO_ASSERT(get_jenv_res == JNI_OK);
4217 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4218 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4219 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4220 CVec_u8Z_free(invoice_preimage_var);
4221 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4223 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4224 if ((*env)->ExceptionCheck(env)) {
4225 (*env)->ExceptionDescribe(env);
4226 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4228 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
4229 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4230 if (get_jenv_res == JNI_EDETACHED) {
4231 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4235 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4236 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4237 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4239 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4240 jclass c = (*env)->GetObjectClass(env, o);
4242 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4243 atomic_init(&calls->refcnt, 1);
4244 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4245 calls->o = (*env)->NewWeakGlobalRef(env, o);
4246 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4247 CHECK(calls->get_node_secret_meth != NULL);
4248 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4249 CHECK(calls->get_destination_script_meth != NULL);
4250 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4251 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4252 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4253 CHECK(calls->get_channel_signer_meth != NULL);
4254 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4255 CHECK(calls->get_secure_random_bytes_meth != NULL);
4256 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4257 CHECK(calls->read_chan_signer_meth != NULL);
4258 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4259 CHECK(calls->sign_invoice_meth != NULL);
4261 LDKKeysInterface ret = {
4262 .this_arg = (void*) calls,
4263 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4264 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4265 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4266 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4267 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4268 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4269 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4270 .free = LDKKeysInterface_JCalls_free,
4274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4275 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4276 *res_ptr = LDKKeysInterface_init(env, clz, o);
4277 return (uint64_t)res_ptr;
4279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4280 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4281 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4287 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4288 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4289 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4290 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4291 CVec_u8Z_free(ret_var);
4295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4296 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4297 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4300 uint64_t ret_ref = (uint64_t)ret_var.inner;
4301 if (ret_var.is_owned) {
4307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
4308 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4309 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
4310 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4311 return (uint64_t)ret_ret;
4314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4315 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4316 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4317 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4322 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4323 LDKu8slice reader_ref;
4324 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4325 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4326 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4327 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4328 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4329 return (uint64_t)ret_conv;
4332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4333 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4334 LDKCVec_u8Z invoice_preimage_ref;
4335 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4336 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4337 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4338 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4339 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4340 return (uint64_t)ret_conv;
4343 typedef struct LDKFeeEstimator_JCalls {
4344 atomic_size_t refcnt;
4347 jmethodID get_est_sat_per_1000_weight_meth;
4348 } LDKFeeEstimator_JCalls;
4349 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4350 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4351 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4353 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4354 if (get_jenv_res == JNI_EDETACHED) {
4355 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4357 DO_ASSERT(get_jenv_res == JNI_OK);
4359 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4360 if (get_jenv_res == JNI_EDETACHED) {
4361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4366 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4367 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4369 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4370 if (get_jenv_res == JNI_EDETACHED) {
4371 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4373 DO_ASSERT(get_jenv_res == JNI_OK);
4375 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4378 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4379 if ((*env)->ExceptionCheck(env)) {
4380 (*env)->ExceptionDescribe(env);
4381 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4383 if (get_jenv_res == JNI_EDETACHED) {
4384 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4388 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4389 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4390 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4392 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4393 jclass c = (*env)->GetObjectClass(env, o);
4395 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4396 atomic_init(&calls->refcnt, 1);
4397 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4398 calls->o = (*env)->NewWeakGlobalRef(env, o);
4399 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4400 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4402 LDKFeeEstimator ret = {
4403 .this_arg = (void*) calls,
4404 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4405 .free = LDKFeeEstimator_JCalls_free,
4409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4410 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4411 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4412 return (uint64_t)res_ptr;
4414 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_arg, jclass confirmation_target) {
4415 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4416 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4417 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4421 typedef struct LDKLogger_JCalls {
4422 atomic_size_t refcnt;
4427 static void LDKLogger_JCalls_free(void* this_arg) {
4428 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4429 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4431 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4432 if (get_jenv_res == JNI_EDETACHED) {
4433 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4435 DO_ASSERT(get_jenv_res == JNI_OK);
4437 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4438 if (get_jenv_res == JNI_EDETACHED) {
4439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4444 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4445 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4447 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4448 if (get_jenv_res == JNI_EDETACHED) {
4449 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4451 DO_ASSERT(get_jenv_res == JNI_OK);
4453 const char* record_str = record;
4454 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4455 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4457 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4458 if ((*env)->ExceptionCheck(env)) {
4459 (*env)->ExceptionDescribe(env);
4460 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4462 if (get_jenv_res == JNI_EDETACHED) {
4463 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4466 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4467 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4468 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4470 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4471 jclass c = (*env)->GetObjectClass(env, o);
4473 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4474 atomic_init(&calls->refcnt, 1);
4475 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4476 calls->o = (*env)->NewWeakGlobalRef(env, o);
4477 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4478 CHECK(calls->log_meth != NULL);
4481 .this_arg = (void*) calls,
4482 .log = log_LDKLogger_jcall,
4483 .free = LDKLogger_JCalls_free,
4487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4488 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4489 *res_ptr = LDKLogger_init(env, clz, o);
4490 return (uint64_t)res_ptr;
4492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4493 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4494 LDKThirtyTwoBytes a_ref;
4495 CHECK((*env)->GetArrayLength(env, a) == 32);
4496 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4498 LDKChannelManager b_conv;
4499 b_conv.inner = (void*)(b & (~1));
4500 b_conv.is_owned = (b & 1) || (b == 0);
4501 // Warning: we need a move here but no clone is available for LDKChannelManager
4503 return (uint64_t)ret;
4505 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4506 return ThirtyTwoBytes_clone(&tuple->a);
4508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4509 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4510 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4511 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data);
4515 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4519 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4520 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
4521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4523 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
4527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4528 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4531 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4532 CHECK(val->result_ok);
4533 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4534 *res_conv = (*val->contents.result);
4535 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
4536 return ((uint64_t)res_conv) | 1;
4538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4539 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4540 CHECK(!val->result_ok);
4541 LDKDecodeError err_var = (*val->contents.err);
4542 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4543 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4544 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4548 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4551 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4552 CHECK(val->result_ok);
4553 LDKChannelConfig res_var = (*val->contents.result);
4554 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4555 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4556 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4560 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4561 CHECK(!val->result_ok);
4562 LDKDecodeError err_var = (*val->contents.err);
4563 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4564 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4565 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4569 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4572 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4573 CHECK(val->result_ok);
4574 LDKOutPoint res_var = (*val->contents.result);
4575 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4576 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4577 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4581 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4582 CHECK(!val->result_ok);
4583 LDKDecodeError err_var = (*val->contents.err);
4584 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4585 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4586 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4589 typedef struct LDKType_JCalls {
4590 atomic_size_t refcnt;
4593 jmethodID type_id_meth;
4594 jmethodID debug_str_meth;
4595 jmethodID write_meth;
4597 static void LDKType_JCalls_free(void* this_arg) {
4598 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4601 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4602 if (get_jenv_res == JNI_EDETACHED) {
4603 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4605 DO_ASSERT(get_jenv_res == JNI_OK);
4607 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4608 if (get_jenv_res == JNI_EDETACHED) {
4609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4614 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4615 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4617 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4618 if (get_jenv_res == JNI_EDETACHED) {
4619 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4621 DO_ASSERT(get_jenv_res == JNI_OK);
4623 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4625 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4626 if ((*env)->ExceptionCheck(env)) {
4627 (*env)->ExceptionDescribe(env);
4628 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4630 if (get_jenv_res == JNI_EDETACHED) {
4631 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4635 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4636 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4638 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4639 if (get_jenv_res == JNI_EDETACHED) {
4640 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4642 DO_ASSERT(get_jenv_res == JNI_OK);
4644 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4646 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4647 if ((*env)->ExceptionCheck(env)) {
4648 (*env)->ExceptionDescribe(env);
4649 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4651 LDKStr ret_conv = java_to_owned_str(env, ret);
4652 if (get_jenv_res == JNI_EDETACHED) {
4653 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4657 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4658 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4660 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4661 if (get_jenv_res == JNI_EDETACHED) {
4662 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4664 DO_ASSERT(get_jenv_res == JNI_OK);
4666 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4668 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4669 if ((*env)->ExceptionCheck(env)) {
4670 (*env)->ExceptionDescribe(env);
4671 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4673 LDKCVec_u8Z ret_ref;
4674 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4675 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4676 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4677 if (get_jenv_res == JNI_EDETACHED) {
4678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4682 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4683 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4684 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4686 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4687 jclass c = (*env)->GetObjectClass(env, o);
4689 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4690 atomic_init(&calls->refcnt, 1);
4691 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4692 calls->o = (*env)->NewWeakGlobalRef(env, o);
4693 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4694 CHECK(calls->type_id_meth != NULL);
4695 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4696 CHECK(calls->debug_str_meth != NULL);
4697 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4698 CHECK(calls->write_meth != NULL);
4701 .this_arg = (void*) calls,
4702 .type_id = type_id_LDKType_jcall,
4703 .debug_str = debug_str_LDKType_jcall,
4704 .write = write_LDKType_jcall,
4705 .cloned = LDKType_JCalls_cloned,
4706 .free = LDKType_JCalls_free,
4710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
4711 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4712 *res_ptr = LDKType_init(env, clz, o);
4713 return (uint64_t)res_ptr;
4715 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4716 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4717 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4721 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
4722 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4723 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4724 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
4729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4730 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4731 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4732 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4733 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4734 CVec_u8Z_free(ret_var);
4738 static jclass LDKCOption_TypeZ_Some_class = NULL;
4739 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
4740 static jclass LDKCOption_TypeZ_None_class = NULL;
4741 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
4742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
4743 LDKCOption_TypeZ_Some_class =
4744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
4745 CHECK(LDKCOption_TypeZ_Some_class != NULL);
4746 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
4747 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
4748 LDKCOption_TypeZ_None_class =
4749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
4750 CHECK(LDKCOption_TypeZ_None_class != NULL);
4751 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
4752 CHECK(LDKCOption_TypeZ_None_meth != NULL);
4754 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4755 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
4757 case LDKCOption_TypeZ_Some: {
4758 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
4759 *some_ret = Type_clone(&obj->some);
4760 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
4762 case LDKCOption_TypeZ_None: {
4763 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
4768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4769 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
4771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4772 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4773 CHECK(val->result_ok);
4774 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4778 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4779 CHECK(!val->result_ok);
4780 LDKDecodeError err_var = (*val->contents.err);
4781 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4782 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4783 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4787 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4789 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4790 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4791 CHECK(val->result_ok);
4792 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4796 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4797 CHECK(!val->result_ok);
4798 return *val->contents.err;
4800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4801 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4804 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4805 CHECK(val->result_ok);
4806 LDKInvoice res_var = (*val->contents.result);
4807 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4808 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4809 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4813 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4814 CHECK(!val->result_ok);
4815 return *val->contents.err;
4817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4818 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4821 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4822 CHECK(val->result_ok);
4823 LDKSignedRawInvoice res_var = (*val->contents.result);
4824 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4825 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4826 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4830 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4831 CHECK(!val->result_ok);
4832 return *val->contents.err;
4834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
4835 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4836 LDKRawInvoice a_conv;
4837 a_conv.inner = (void*)(a & (~1));
4838 a_conv.is_owned = (a & 1) || (a == 0);
4839 a_conv = RawInvoice_clone(&a_conv);
4841 LDKThirtyTwoBytes b_ref;
4842 CHECK((*env)->GetArrayLength(env, b) == 32);
4843 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4845 LDKInvoiceSignature c_conv;
4846 c_conv.inner = (void*)(c & (~1));
4847 c_conv.is_owned = (c & 1) || (c == 0);
4848 c_conv = InvoiceSignature_clone(&c_conv);
4850 return (uint64_t)ret;
4852 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4853 return RawInvoice_clone(&tuple->a);
4855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4856 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4857 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
4858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4860 uint64_t ret_ref = (uint64_t)ret_var.inner;
4861 if (ret_var.is_owned) {
4867 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4868 return ThirtyTwoBytes_clone(&tuple->b);
4870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4871 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4872 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data);
4877 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4878 return InvoiceSignature_clone(&tuple->c);
4880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
4881 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4882 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
4883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4885 uint64_t ret_ref = (uint64_t)ret_var.inner;
4886 if (ret_var.is_owned) {
4892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4893 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4896 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4897 CHECK(val->result_ok);
4898 LDKPayeePubKey res_var = (*val->contents.result);
4899 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4900 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4901 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4904 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4905 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4906 CHECK(!val->result_ok);
4907 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4911 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4912 ret->datalen = (*env)->GetArrayLength(env, elems);
4913 if (ret->datalen == 0) {
4916 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4917 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4918 for (size_t i = 0; i < ret->datalen; i++) {
4919 int64_t arr_elem = java_elems[i];
4920 LDKPrivateRoute arr_elem_conv;
4921 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4922 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4923 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4924 ret->data[i] = arr_elem_conv;
4926 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4928 return (uint64_t)ret;
4930 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4931 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4932 for (size_t i = 0; i < ret.datalen; i++) {
4933 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4938 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4941 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4942 CHECK(val->result_ok);
4943 LDKPositiveTimestamp res_var = (*val->contents.result);
4944 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4945 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4946 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4949 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4950 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4951 CHECK(!val->result_ok);
4952 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4956 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4959 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4960 CHECK(val->result_ok);
4961 return *val->contents.result;
4963 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4964 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4965 CHECK(!val->result_ok);
4966 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4970 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4973 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4974 CHECK(val->result_ok);
4975 LDKInvoice res_var = (*val->contents.result);
4976 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4977 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4978 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4981 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4982 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4983 CHECK(!val->result_ok);
4984 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4988 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4991 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4992 CHECK(val->result_ok);
4993 LDKDescription res_var = (*val->contents.result);
4994 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4995 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4996 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4999 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5000 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5001 CHECK(!val->result_ok);
5002 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5006 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
5008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5009 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5010 CHECK(val->result_ok);
5011 LDKExpiryTime res_var = (*val->contents.result);
5012 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5013 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5014 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5017 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5018 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5019 CHECK(!val->result_ok);
5020 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5024 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
5026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5027 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5028 CHECK(val->result_ok);
5029 LDKPrivateRoute res_var = (*val->contents.result);
5030 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5031 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5032 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5035 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5036 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5037 CHECK(!val->result_ok);
5038 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5042 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
5044 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5045 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5046 CHECK(val->result_ok);
5047 LDKStr res_str = (*val->contents.result);
5048 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
5051 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5052 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5053 CHECK(!val->result_ok);
5054 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5058 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
5060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5061 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5062 CHECK(val->result_ok);
5063 LDKChannelMonitorUpdate res_var = (*val->contents.result);
5064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5070 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5071 CHECK(!val->result_ok);
5072 LDKDecodeError err_var = (*val->contents.err);
5073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5079 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
5081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5082 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5083 CHECK(val->result_ok);
5084 LDKHTLCUpdate res_var = (*val->contents.result);
5085 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5086 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5087 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5091 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5092 CHECK(!val->result_ok);
5093 LDKDecodeError err_var = (*val->contents.err);
5094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5100 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
5102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5103 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5104 CHECK(val->result_ok);
5105 return *val->contents.result;
5107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5108 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5109 CHECK(!val->result_ok);
5110 LDKMonitorUpdateError err_var = (*val->contents.err);
5111 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5112 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5113 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5117 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5119 a_conv.inner = (void*)(a & (~1));
5120 a_conv.is_owned = (a & 1) || (a == 0);
5121 a_conv = OutPoint_clone(&a_conv);
5124 b_ref.datalen = (*env)->GetArrayLength(env, b);
5125 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5126 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5128 return (uint64_t)ret;
5130 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5131 return OutPoint_clone(&tuple->a);
5133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5134 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5135 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
5136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5138 uint64_t ret_ref = (uint64_t)ret_var.inner;
5139 if (ret_var.is_owned) {
5145 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5146 return CVec_u8Z_clone(&tuple->b);
5148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5149 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5150 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
5151 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5152 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5153 CVec_u8Z_free(ret_var);
5157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
5158 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5161 b_ref.datalen = (*env)->GetArrayLength(env, b);
5162 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5163 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5165 return (uint64_t)ret;
5167 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5170 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5171 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5172 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
5176 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5177 return CVec_u8Z_clone(&tuple->b);
5179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5180 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5181 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
5182 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5183 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5184 CVec_u8Z_free(ret_var);
5188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5189 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
5190 ret->datalen = (*env)->GetArrayLength(env, elems);
5191 if (ret->datalen == 0) {
5194 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5195 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5196 for (size_t i = 0; i < ret->datalen; i++) {
5197 int64_t arr_elem = java_elems[i];
5198 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
5199 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5200 ret->data[i] = arr_elem_conv;
5202 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5204 return (uint64_t)ret;
5206 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5207 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5208 for (size_t i = 0; i < ret.datalen; i++) {
5209 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5214 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
5215 LDKThirtyTwoBytes a_ref;
5216 CHECK((*env)->GetArrayLength(env, a) == 32);
5217 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5219 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
5220 b_constr.datalen = (*env)->GetArrayLength(env, b);
5221 if (b_constr.datalen > 0)
5222 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
5224 b_constr.data = NULL;
5225 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5226 for (size_t v = 0; v < b_constr.datalen; v++) {
5227 int64_t b_conv_21 = b_vals[v];
5228 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
5229 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
5230 b_constr.data[v] = b_conv_21_conv;
5232 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5234 return (uint64_t)ret;
5236 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5237 return ThirtyTwoBytes_clone(&tuple->a);
5239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5240 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5241 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data);
5246 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5247 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
5249 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5250 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5251 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
5252 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5253 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5254 for (size_t v = 0; v < ret_var.datalen; v++) {
5255 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5256 *ret_conv_21_conv = ret_var.data[v];
5257 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
5259 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5265 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5266 ret->datalen = (*env)->GetArrayLength(env, elems);
5267 if (ret->datalen == 0) {
5270 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5271 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5272 for (size_t i = 0; i < ret->datalen; i++) {
5273 int64_t arr_elem = java_elems[i];
5274 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
5275 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5276 ret->data[i] = arr_elem_conv;
5278 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5280 return (uint64_t)ret;
5282 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5283 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
5284 for (size_t i = 0; i < ret.datalen; i++) {
5285 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5289 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5290 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5291 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5292 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5294 LDKPaymentPurpose_InvoicePayment_class =
5295 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5296 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5297 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5298 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5299 LDKPaymentPurpose_SpontaneousPayment_class =
5300 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5301 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5302 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5303 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5306 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5308 case LDKPaymentPurpose_InvoicePayment: {
5309 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5310 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5311 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5312 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5313 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5315 case LDKPaymentPurpose_SpontaneousPayment: {
5316 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5317 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5318 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5323 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5324 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5325 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5326 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5327 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5328 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5329 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5330 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5331 static jclass LDKClosureReason_ProcessingError_class = NULL;
5332 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5333 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5334 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5335 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5336 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5338 LDKClosureReason_CounterpartyForceClosed_class =
5339 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5340 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5341 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5342 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5343 LDKClosureReason_HolderForceClosed_class =
5344 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5345 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5346 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5347 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5348 LDKClosureReason_CooperativeClosure_class =
5349 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5350 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5351 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5352 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5353 LDKClosureReason_CommitmentTxConfirmed_class =
5354 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5355 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5356 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5357 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5358 LDKClosureReason_ProcessingError_class =
5359 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5360 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5361 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5362 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5363 LDKClosureReason_DisconnectedPeer_class =
5364 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5365 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5366 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5367 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5368 LDKClosureReason_OutdatedChannelManager_class =
5369 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5370 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5371 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5372 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5374 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5375 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5377 case LDKClosureReason_CounterpartyForceClosed: {
5378 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5379 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5380 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5382 case LDKClosureReason_HolderForceClosed: {
5383 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5385 case LDKClosureReason_CooperativeClosure: {
5386 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5388 case LDKClosureReason_CommitmentTxConfirmed: {
5389 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5391 case LDKClosureReason_ProcessingError: {
5392 LDKStr err_str = obj->processing_error.err;
5393 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5394 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5396 case LDKClosureReason_DisconnectedPeer: {
5397 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5399 case LDKClosureReason_OutdatedChannelManager: {
5400 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5405 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5406 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5407 static jclass LDKEvent_PaymentReceived_class = NULL;
5408 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5409 static jclass LDKEvent_PaymentSent_class = NULL;
5410 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5411 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5412 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5413 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5414 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5415 static jclass LDKEvent_SpendableOutputs_class = NULL;
5416 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5417 static jclass LDKEvent_PaymentForwarded_class = NULL;
5418 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5419 static jclass LDKEvent_ChannelClosed_class = NULL;
5420 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5421 static jclass LDKEvent_DiscardFunding_class = NULL;
5422 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
5423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5424 LDKEvent_FundingGenerationReady_class =
5425 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5426 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5427 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5428 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5429 LDKEvent_PaymentReceived_class =
5430 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5431 CHECK(LDKEvent_PaymentReceived_class != NULL);
5432 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5433 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5434 LDKEvent_PaymentSent_class =
5435 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5436 CHECK(LDKEvent_PaymentSent_class != NULL);
5437 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B)V");
5438 CHECK(LDKEvent_PaymentSent_meth != NULL);
5439 LDKEvent_PaymentPathFailed_class =
5440 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5441 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5442 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[JJ)V");
5443 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5444 LDKEvent_PendingHTLCsForwardable_class =
5445 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5446 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5447 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5448 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5449 LDKEvent_SpendableOutputs_class =
5450 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5451 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5452 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5453 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5454 LDKEvent_PaymentForwarded_class =
5455 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5456 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5457 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5458 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5459 LDKEvent_ChannelClosed_class =
5460 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5461 CHECK(LDKEvent_ChannelClosed_class != NULL);
5462 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
5463 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5464 LDKEvent_DiscardFunding_class =
5465 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;"));
5466 CHECK(LDKEvent_DiscardFunding_class != NULL);
5467 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
5468 CHECK(LDKEvent_DiscardFunding_meth != NULL);
5470 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5471 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5473 case LDKEvent_FundingGenerationReady: {
5474 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5475 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5476 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5477 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5478 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5479 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);
5481 case LDKEvent_PaymentReceived: {
5482 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5483 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5484 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5485 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5487 case LDKEvent_PaymentSent: {
5488 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5489 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5490 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5491 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
5492 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr, payment_hash_arr);
5494 case LDKEvent_PaymentPathFailed: {
5495 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5496 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5497 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5498 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5499 int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
5500 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5501 for (size_t k = 0; k < path_var.datalen; k++) {
5502 LDKRouteHop path_conv_10_var = path_var.data[k];
5503 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5504 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5505 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5506 path_arr_ptr[k] = path_conv_10_ref;
5508 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5509 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
5510 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref);
5512 case LDKEvent_PendingHTLCsForwardable: {
5513 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5515 case LDKEvent_SpendableOutputs: {
5516 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5517 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5518 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5519 for (size_t b = 0; b < outputs_var.datalen; b++) {
5520 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5521 outputs_arr_ptr[b] = outputs_conv_27_ref;
5523 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5524 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5526 case LDKEvent_PaymentForwarded: {
5527 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5528 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5530 case LDKEvent_ChannelClosed: {
5531 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5532 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5533 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5534 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
5536 case LDKEvent_DiscardFunding: {
5537 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5538 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
5539 LDKTransaction transaction_var = obj->discard_funding.transaction;
5540 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
5541 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
5542 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
5547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5548 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5549 ret->datalen = (*env)->GetArrayLength(env, elems);
5550 if (ret->datalen == 0) {
5553 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5554 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5555 for (size_t i = 0; i < ret->datalen; i++) {
5556 int64_t arr_elem = java_elems[i];
5557 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
5558 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5559 ret->data[i] = arr_elem_conv;
5561 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5563 return (uint64_t)ret;
5565 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5566 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5567 for (size_t i = 0; i < ret.datalen; i++) {
5568 ret.data[i] = Event_clone(&orig->data[i]);
5572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5573 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5575 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5576 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
5578 return (uint64_t)ret;
5580 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5583 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5584 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5585 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
5589 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5590 return TxOut_clone(&tuple->b);
5592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5593 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5594 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5595 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
5596 return (uint64_t)ret_ref;
5599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5600 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5601 ret->datalen = (*env)->GetArrayLength(env, elems);
5602 if (ret->datalen == 0) {
5605 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5606 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5607 for (size_t i = 0; i < ret->datalen; i++) {
5608 int64_t arr_elem = java_elems[i];
5609 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
5610 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5611 ret->data[i] = arr_elem_conv;
5613 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5615 return (uint64_t)ret;
5617 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5618 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5619 for (size_t i = 0; i < ret.datalen; i++) {
5620 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5625 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5626 LDKThirtyTwoBytes a_ref;
5627 CHECK((*env)->GetArrayLength(env, a) == 32);
5628 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5630 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5631 b_constr.datalen = (*env)->GetArrayLength(env, b);
5632 if (b_constr.datalen > 0)
5633 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5635 b_constr.data = NULL;
5636 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5637 for (size_t u = 0; u < b_constr.datalen; u++) {
5638 int64_t b_conv_20 = b_vals[u];
5639 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
5640 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
5641 b_constr.data[u] = b_conv_20_conv;
5643 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5645 return (uint64_t)ret;
5647 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5648 return ThirtyTwoBytes_clone(&tuple->a);
5650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5651 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5652 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data);
5657 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5658 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
5660 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5661 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5662 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
5663 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5664 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5665 for (size_t u = 0; u < ret_var.datalen; u++) {
5666 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5667 *ret_conv_20_conv = ret_var.data[u];
5668 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
5670 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5676 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5677 ret->datalen = (*env)->GetArrayLength(env, elems);
5678 if (ret->datalen == 0) {
5681 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5682 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5683 for (size_t i = 0; i < ret->datalen; i++) {
5684 int64_t arr_elem = java_elems[i];
5685 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
5686 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5687 ret->data[i] = arr_elem_conv;
5689 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5691 return (uint64_t)ret;
5693 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5694 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
5695 for (size_t i = 0; i < ret.datalen; i++) {
5696 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5700 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5701 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5702 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5703 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5704 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5705 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5706 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5707 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5709 LDKBalance_ClaimableOnChannelClose_class =
5710 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
5711 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5712 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5713 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5714 LDKBalance_ClaimableAwaitingConfirmations_class =
5715 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
5716 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5717 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5718 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5719 LDKBalance_ContentiousClaimable_class =
5720 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
5721 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5722 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5723 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5724 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5725 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
5726 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5727 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5728 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5730 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5731 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5733 case LDKBalance_ClaimableOnChannelClose: {
5734 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5736 case LDKBalance_ClaimableAwaitingConfirmations: {
5737 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5739 case LDKBalance_ContentiousClaimable: {
5740 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5742 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5743 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
5748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5749 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
5750 ret->datalen = (*env)->GetArrayLength(env, elems);
5751 if (ret->datalen == 0) {
5754 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
5755 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5756 for (size_t i = 0; i < ret->datalen; i++) {
5757 int64_t arr_elem = java_elems[i];
5758 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
5759 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
5760 ret->data[i] = arr_elem_conv;
5762 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5764 return (uint64_t)ret;
5766 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5767 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5768 for (size_t i = 0; i < ret.datalen; i++) {
5769 ret.data[i] = Balance_clone(&orig->data[i]);
5773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5774 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5777 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5778 CHECK(val->result_ok);
5779 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5780 *res_conv = (*val->contents.result);
5781 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
5782 return ((uint64_t)res_conv);
5784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5785 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5786 CHECK(!val->result_ok);
5787 LDKDecodeError err_var = (*val->contents.err);
5788 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5789 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5790 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5794 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5797 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5798 CHECK(val->result_ok);
5799 return *val->contents.result;
5801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5802 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5803 CHECK(!val->result_ok);
5804 LDKLightningError err_var = (*val->contents.err);
5805 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5806 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5807 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5811 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
5813 CHECK((*env)->GetArrayLength(env, a) == 33);
5814 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
5816 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
5817 b_conv = Type_clone(&b_conv);
5819 return (uint64_t)ret;
5821 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5825 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5826 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5827 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form);
5831 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5832 return Type_clone(&tuple->b);
5834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5835 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5836 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
5837 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
5838 return (uint64_t)ret_ret;
5841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5842 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
5843 ret->datalen = (*env)->GetArrayLength(env, elems);
5844 if (ret->datalen == 0) {
5847 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
5848 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5849 for (size_t i = 0; i < ret->datalen; i++) {
5850 int64_t arr_elem = java_elems[i];
5851 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
5852 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
5853 ret->data[i] = arr_elem_conv;
5855 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5857 return (uint64_t)ret;
5859 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5860 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5861 for (size_t i = 0; i < ret.datalen; i++) {
5862 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5867 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5870 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5871 CHECK(val->result_ok);
5872 return *val->contents.result;
5874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5875 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5876 CHECK(!val->result_ok);
5877 LDKLightningError err_var = (*val->contents.err);
5878 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5879 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5880 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
5884 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5885 LDKChannelAnnouncement a_conv;
5886 a_conv.inner = (void*)(a & (~1));
5887 a_conv.is_owned = (a & 1) || (a == 0);
5888 a_conv = ChannelAnnouncement_clone(&a_conv);
5890 LDKChannelUpdate b_conv;
5891 b_conv.inner = (void*)(b & (~1));
5892 b_conv.is_owned = (b & 1) || (b == 0);
5893 b_conv = ChannelUpdate_clone(&b_conv);
5895 LDKChannelUpdate c_conv;
5896 c_conv.inner = (void*)(c & (~1));
5897 c_conv.is_owned = (c & 1) || (c == 0);
5898 c_conv = ChannelUpdate_clone(&c_conv);
5900 return (uint64_t)ret;
5902 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5903 return ChannelAnnouncement_clone(&tuple->a);
5905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5906 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5907 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
5908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5910 uint64_t ret_ref = (uint64_t)ret_var.inner;
5911 if (ret_var.is_owned) {
5917 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5918 return ChannelUpdate_clone(&tuple->b);
5920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5921 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5922 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
5923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5925 uint64_t ret_ref = (uint64_t)ret_var.inner;
5926 if (ret_var.is_owned) {
5932 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5933 return ChannelUpdate_clone(&tuple->c);
5935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
5936 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5937 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
5938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5940 uint64_t ret_ref = (uint64_t)ret_var.inner;
5941 if (ret_var.is_owned) {
5947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5948 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5949 ret->datalen = (*env)->GetArrayLength(env, elems);
5950 if (ret->datalen == 0) {
5953 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5954 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5955 for (size_t i = 0; i < ret->datalen; i++) {
5956 int64_t arr_elem = java_elems[i];
5957 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5958 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5959 ret->data[i] = arr_elem_conv;
5961 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5963 return (uint64_t)ret;
5965 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5966 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5967 for (size_t i = 0; i < ret.datalen; i++) {
5968 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5973 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5974 ret->datalen = (*env)->GetArrayLength(env, elems);
5975 if (ret->datalen == 0) {
5978 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5979 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5980 for (size_t i = 0; i < ret->datalen; i++) {
5981 int64_t arr_elem = java_elems[i];
5982 LDKNodeAnnouncement arr_elem_conv;
5983 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5984 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5985 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5986 ret->data[i] = arr_elem_conv;
5988 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5990 return (uint64_t)ret;
5992 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5993 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5994 for (size_t i = 0; i < ret.datalen; i++) {
5995 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6000 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
6002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6003 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6004 CHECK(val->result_ok);
6005 LDKCVec_u8Z res_var = (*val->contents.result);
6006 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
6007 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6011 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6012 CHECK(!val->result_ok);
6013 LDKPeerHandleError err_var = (*val->contents.err);
6014 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6015 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6016 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6020 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
6022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6023 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6024 CHECK(val->result_ok);
6025 return *val->contents.result;
6027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6028 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6029 CHECK(!val->result_ok);
6030 LDKPeerHandleError err_var = (*val->contents.err);
6031 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6032 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6033 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6037 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
6039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6040 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6041 CHECK(val->result_ok);
6042 return *val->contents.result;
6044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6045 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6046 CHECK(!val->result_ok);
6047 LDKPeerHandleError err_var = (*val->contents.err);
6048 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6049 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6050 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6054 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
6056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6057 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6058 CHECK(val->result_ok);
6059 LDKNodeId res_var = (*val->contents.result);
6060 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6061 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6062 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6066 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6067 CHECK(!val->result_ok);
6068 LDKDecodeError err_var = (*val->contents.err);
6069 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6070 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6071 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6074 typedef struct LDKAccess_JCalls {
6075 atomic_size_t refcnt;
6078 jmethodID get_utxo_meth;
6080 static void LDKAccess_JCalls_free(void* this_arg) {
6081 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6082 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6084 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6085 if (get_jenv_res == JNI_EDETACHED) {
6086 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6088 DO_ASSERT(get_jenv_res == JNI_OK);
6090 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6091 if (get_jenv_res == JNI_EDETACHED) {
6092 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6097 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6098 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6100 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6101 if (get_jenv_res == JNI_EDETACHED) {
6102 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6104 DO_ASSERT(get_jenv_res == JNI_OK);
6106 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6107 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6108 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6110 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6111 if ((*env)->ExceptionCheck(env)) {
6112 (*env)->ExceptionDescribe(env);
6113 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6115 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6116 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6117 if (get_jenv_res == JNI_EDETACHED) {
6118 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6122 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6123 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6124 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6126 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6127 jclass c = (*env)->GetObjectClass(env, o);
6129 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6130 atomic_init(&calls->refcnt, 1);
6131 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6132 calls->o = (*env)->NewWeakGlobalRef(env, o);
6133 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6134 CHECK(calls->get_utxo_meth != NULL);
6137 .this_arg = (void*) calls,
6138 .get_utxo = get_utxo_LDKAccess_jcall,
6139 .free = LDKAccess_JCalls_free,
6143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6144 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6145 *res_ptr = LDKAccess_init(env, clz, o);
6146 return (uint64_t)res_ptr;
6148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
6149 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6150 unsigned char genesis_hash_arr[32];
6151 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6152 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6153 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6154 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6155 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6156 return (uint64_t)ret_conv;
6159 static jclass LDKCOption_AccessZ_Some_class = NULL;
6160 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
6161 static jclass LDKCOption_AccessZ_None_class = NULL;
6162 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
6163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
6164 LDKCOption_AccessZ_Some_class =
6165 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
6166 CHECK(LDKCOption_AccessZ_Some_class != NULL);
6167 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
6168 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
6169 LDKCOption_AccessZ_None_class =
6170 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
6171 CHECK(LDKCOption_AccessZ_None_class != NULL);
6172 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
6173 CHECK(LDKCOption_AccessZ_None_meth != NULL);
6175 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6176 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6178 case LDKCOption_AccessZ_Some: {
6179 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
6180 *some_ret = obj->some;
6181 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
6182 if ((*some_ret).free == LDKAccess_JCalls_free) {
6183 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6184 LDKAccess_JCalls_cloned(&(*some_ret));
6186 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
6188 case LDKCOption_AccessZ_None: {
6189 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
6194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6195 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
6197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6198 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6199 CHECK(val->result_ok);
6200 LDKDirectionalChannelInfo res_var = (*val->contents.result);
6201 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6202 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6203 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6207 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6208 CHECK(!val->result_ok);
6209 LDKDecodeError err_var = (*val->contents.err);
6210 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6211 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6212 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6216 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
6218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6219 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6220 CHECK(val->result_ok);
6221 LDKChannelInfo res_var = (*val->contents.result);
6222 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6223 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6224 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6228 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6229 CHECK(!val->result_ok);
6230 LDKDecodeError err_var = (*val->contents.err);
6231 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6232 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6233 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6237 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
6239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6240 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6241 CHECK(val->result_ok);
6242 LDKRoutingFees res_var = (*val->contents.result);
6243 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6244 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6245 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6249 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6250 CHECK(!val->result_ok);
6251 LDKDecodeError err_var = (*val->contents.err);
6252 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6253 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6254 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6258 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
6260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6261 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6262 CHECK(val->result_ok);
6263 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
6264 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6265 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6266 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6270 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6271 CHECK(!val->result_ok);
6272 LDKDecodeError err_var = (*val->contents.err);
6273 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6274 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6275 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6279 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
6280 ret->datalen = (*env)->GetArrayLength(env, elems);
6281 if (ret->datalen == 0) {
6284 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
6285 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6286 for (size_t i = 0; i < ret->datalen; i++) {
6287 ret->data[i] = java_elems[i];
6289 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6291 return (uint64_t)ret;
6293 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6294 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6295 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6299 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6302 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6303 CHECK(val->result_ok);
6304 LDKNodeInfo res_var = (*val->contents.result);
6305 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6306 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6307 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6311 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6312 CHECK(!val->result_ok);
6313 LDKDecodeError err_var = (*val->contents.err);
6314 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6315 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6316 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6320 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6323 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6324 CHECK(val->result_ok);
6325 LDKNetworkGraph res_var = (*val->contents.result);
6326 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6327 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6328 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6332 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6333 CHECK(!val->result_ok);
6334 LDKDecodeError err_var = (*val->contents.err);
6335 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6336 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6337 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6340 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6341 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6342 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6343 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6345 LDKCOption_CVec_NetAddressZZ_Some_class =
6346 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;"));
6347 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6348 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6349 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6350 LDKCOption_CVec_NetAddressZZ_None_class =
6351 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;"));
6352 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6353 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6354 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6356 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6357 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6359 case LDKCOption_CVec_NetAddressZZ_Some: {
6360 LDKCVec_NetAddressZ some_var = obj->some;
6361 int64_tArray some_arr = (*env)->NewLongArray(env, some_var.datalen);
6362 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6363 for (size_t m = 0; m < some_var.datalen; m++) {
6364 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
6365 some_arr_ptr[m] = some_conv_12_ref;
6367 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6368 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6370 case LDKCOption_CVec_NetAddressZZ_None: {
6371 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6377 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
6379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6380 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6381 CHECK(val->result_ok);
6382 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6385 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6386 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6387 CHECK(!val->result_ok);
6388 return *val->contents.err;
6390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6391 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
6393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6394 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6395 CHECK(val->result_ok);
6396 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6397 *res_conv = (*val->contents.result);
6398 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
6399 return (uint64_t)res_conv;
6401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6402 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6403 CHECK(!val->result_ok);
6404 LDKDecodeError err_var = (*val->contents.err);
6405 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6406 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6407 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6411 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6414 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6415 CHECK(val->result_ok);
6416 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6420 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6421 CHECK(!val->result_ok);
6422 LDKDecodeError err_var = (*val->contents.err);
6423 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6424 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6425 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6429 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6430 ret->datalen = (*env)->GetArrayLength(env, elems);
6431 if (ret->datalen == 0) {
6434 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6435 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6436 for (size_t i = 0; i < ret->datalen; i++) {
6437 int64_t arr_elem = java_elems[i];
6438 LDKUpdateAddHTLC arr_elem_conv;
6439 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6440 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6441 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6442 ret->data[i] = arr_elem_conv;
6444 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6446 return (uint64_t)ret;
6448 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6449 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6450 for (size_t i = 0; i < ret.datalen; i++) {
6451 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6456 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6457 ret->datalen = (*env)->GetArrayLength(env, elems);
6458 if (ret->datalen == 0) {
6461 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6462 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6463 for (size_t i = 0; i < ret->datalen; i++) {
6464 int64_t arr_elem = java_elems[i];
6465 LDKUpdateFulfillHTLC arr_elem_conv;
6466 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6467 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6468 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6469 ret->data[i] = arr_elem_conv;
6471 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6473 return (uint64_t)ret;
6475 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6476 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6477 for (size_t i = 0; i < ret.datalen; i++) {
6478 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6483 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6484 ret->datalen = (*env)->GetArrayLength(env, elems);
6485 if (ret->datalen == 0) {
6488 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6489 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6490 for (size_t i = 0; i < ret->datalen; i++) {
6491 int64_t arr_elem = java_elems[i];
6492 LDKUpdateFailHTLC arr_elem_conv;
6493 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6494 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6495 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6496 ret->data[i] = arr_elem_conv;
6498 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6500 return (uint64_t)ret;
6502 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6503 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6504 for (size_t i = 0; i < ret.datalen; i++) {
6505 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6510 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6511 ret->datalen = (*env)->GetArrayLength(env, elems);
6512 if (ret->datalen == 0) {
6515 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6516 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6517 for (size_t i = 0; i < ret->datalen; i++) {
6518 int64_t arr_elem = java_elems[i];
6519 LDKUpdateFailMalformedHTLC arr_elem_conv;
6520 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6521 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6522 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6523 ret->data[i] = arr_elem_conv;
6525 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6527 return (uint64_t)ret;
6529 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6530 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6531 for (size_t i = 0; i < ret.datalen; i++) {
6532 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6537 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6540 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6541 CHECK(val->result_ok);
6542 LDKAcceptChannel res_var = (*val->contents.result);
6543 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6544 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6545 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6549 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6550 CHECK(!val->result_ok);
6551 LDKDecodeError err_var = (*val->contents.err);
6552 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6553 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6554 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6558 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6561 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6562 CHECK(val->result_ok);
6563 LDKAnnouncementSignatures res_var = (*val->contents.result);
6564 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6565 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6566 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6570 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6571 CHECK(!val->result_ok);
6572 LDKDecodeError err_var = (*val->contents.err);
6573 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6574 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6575 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6579 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6582 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6583 CHECK(val->result_ok);
6584 LDKChannelReestablish res_var = (*val->contents.result);
6585 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6586 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6587 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6591 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6592 CHECK(!val->result_ok);
6593 LDKDecodeError err_var = (*val->contents.err);
6594 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6595 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6596 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6600 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6603 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6604 CHECK(val->result_ok);
6605 LDKClosingSigned res_var = (*val->contents.result);
6606 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6607 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6608 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6612 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6613 CHECK(!val->result_ok);
6614 LDKDecodeError err_var = (*val->contents.err);
6615 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6616 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6617 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6621 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6624 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6625 CHECK(val->result_ok);
6626 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6627 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6628 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6629 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6633 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6634 CHECK(!val->result_ok);
6635 LDKDecodeError err_var = (*val->contents.err);
6636 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6637 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6638 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6642 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6645 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6646 CHECK(val->result_ok);
6647 LDKCommitmentSigned res_var = (*val->contents.result);
6648 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6649 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6650 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6654 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6655 CHECK(!val->result_ok);
6656 LDKDecodeError err_var = (*val->contents.err);
6657 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6658 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6659 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6663 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6666 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6667 CHECK(val->result_ok);
6668 LDKFundingCreated res_var = (*val->contents.result);
6669 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6670 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6671 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6675 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6676 CHECK(!val->result_ok);
6677 LDKDecodeError err_var = (*val->contents.err);
6678 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6679 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6680 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6684 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6687 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6688 CHECK(val->result_ok);
6689 LDKFundingSigned res_var = (*val->contents.result);
6690 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6691 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6692 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6696 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6697 CHECK(!val->result_ok);
6698 LDKDecodeError err_var = (*val->contents.err);
6699 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6700 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6701 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6705 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
6707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6708 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6709 CHECK(val->result_ok);
6710 LDKFundingLocked res_var = (*val->contents.result);
6711 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6712 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6713 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6717 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6718 CHECK(!val->result_ok);
6719 LDKDecodeError err_var = (*val->contents.err);
6720 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6721 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6722 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6726 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
6728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6729 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6730 CHECK(val->result_ok);
6731 LDKInit res_var = (*val->contents.result);
6732 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6733 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6734 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6738 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6739 CHECK(!val->result_ok);
6740 LDKDecodeError err_var = (*val->contents.err);
6741 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6742 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6743 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6747 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
6749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6750 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6751 CHECK(val->result_ok);
6752 LDKOpenChannel res_var = (*val->contents.result);
6753 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6754 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6755 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6759 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6760 CHECK(!val->result_ok);
6761 LDKDecodeError err_var = (*val->contents.err);
6762 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6763 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6764 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6768 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
6770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6771 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6772 CHECK(val->result_ok);
6773 LDKRevokeAndACK res_var = (*val->contents.result);
6774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6776 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6780 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6781 CHECK(!val->result_ok);
6782 LDKDecodeError err_var = (*val->contents.err);
6783 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6784 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6785 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6789 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
6791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6792 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6793 CHECK(val->result_ok);
6794 LDKShutdown res_var = (*val->contents.result);
6795 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6796 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6797 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6801 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6802 CHECK(!val->result_ok);
6803 LDKDecodeError err_var = (*val->contents.err);
6804 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6805 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6806 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6810 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
6812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6813 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6814 CHECK(val->result_ok);
6815 LDKUpdateFailHTLC res_var = (*val->contents.result);
6816 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6817 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6818 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6822 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6823 CHECK(!val->result_ok);
6824 LDKDecodeError err_var = (*val->contents.err);
6825 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6826 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6827 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6831 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
6833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6834 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6835 CHECK(val->result_ok);
6836 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6837 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6838 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6839 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6843 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6844 CHECK(!val->result_ok);
6845 LDKDecodeError err_var = (*val->contents.err);
6846 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6847 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6848 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6852 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
6854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6855 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6856 CHECK(val->result_ok);
6857 LDKUpdateFee res_var = (*val->contents.result);
6858 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6859 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6860 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6864 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6865 CHECK(!val->result_ok);
6866 LDKDecodeError err_var = (*val->contents.err);
6867 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6868 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6869 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6873 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
6875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6876 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6877 CHECK(val->result_ok);
6878 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6879 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6880 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6881 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6885 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6886 CHECK(!val->result_ok);
6887 LDKDecodeError err_var = (*val->contents.err);
6888 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6889 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6890 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6894 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
6896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6897 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6898 CHECK(val->result_ok);
6899 LDKUpdateAddHTLC res_var = (*val->contents.result);
6900 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6901 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6902 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6906 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6907 CHECK(!val->result_ok);
6908 LDKDecodeError err_var = (*val->contents.err);
6909 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6910 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6911 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6915 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
6917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6918 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6919 CHECK(val->result_ok);
6920 LDKPing res_var = (*val->contents.result);
6921 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6922 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6923 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6927 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6928 CHECK(!val->result_ok);
6929 LDKDecodeError err_var = (*val->contents.err);
6930 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6931 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6932 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6936 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
6938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6939 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6940 CHECK(val->result_ok);
6941 LDKPong res_var = (*val->contents.result);
6942 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6943 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6944 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6948 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6949 CHECK(!val->result_ok);
6950 LDKDecodeError err_var = (*val->contents.err);
6951 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6952 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6953 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6957 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6960 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6961 CHECK(val->result_ok);
6962 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
6963 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6964 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6965 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6969 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6970 CHECK(!val->result_ok);
6971 LDKDecodeError err_var = (*val->contents.err);
6972 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6973 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6974 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6978 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6981 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6982 CHECK(val->result_ok);
6983 LDKChannelAnnouncement res_var = (*val->contents.result);
6984 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6985 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6986 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6990 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6991 CHECK(!val->result_ok);
6992 LDKDecodeError err_var = (*val->contents.err);
6993 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6994 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6995 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6999 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
7001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7002 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7003 CHECK(val->result_ok);
7004 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
7005 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7006 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7007 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7011 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7012 CHECK(!val->result_ok);
7013 LDKDecodeError err_var = (*val->contents.err);
7014 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7015 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7016 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7020 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
7022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7023 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7024 CHECK(val->result_ok);
7025 LDKChannelUpdate res_var = (*val->contents.result);
7026 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7027 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7028 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7032 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7033 CHECK(!val->result_ok);
7034 LDKDecodeError err_var = (*val->contents.err);
7035 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7036 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7037 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7041 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
7043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7044 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7045 CHECK(val->result_ok);
7046 LDKErrorMessage res_var = (*val->contents.result);
7047 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7048 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7049 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7053 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7054 CHECK(!val->result_ok);
7055 LDKDecodeError err_var = (*val->contents.err);
7056 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7057 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7058 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7062 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
7064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7065 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7066 CHECK(val->result_ok);
7067 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
7068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7070 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7074 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7075 CHECK(!val->result_ok);
7076 LDKDecodeError err_var = (*val->contents.err);
7077 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7078 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7079 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7083 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
7085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7086 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7087 CHECK(val->result_ok);
7088 LDKNodeAnnouncement res_var = (*val->contents.result);
7089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7095 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7096 CHECK(!val->result_ok);
7097 LDKDecodeError err_var = (*val->contents.err);
7098 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7099 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7100 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7104 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
7106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7107 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7108 CHECK(val->result_ok);
7109 LDKQueryShortChannelIds res_var = (*val->contents.result);
7110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7116 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7117 CHECK(!val->result_ok);
7118 LDKDecodeError err_var = (*val->contents.err);
7119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7125 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
7127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7128 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7129 CHECK(val->result_ok);
7130 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
7131 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7132 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7133 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7137 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7138 CHECK(!val->result_ok);
7139 LDKDecodeError err_var = (*val->contents.err);
7140 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7141 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7142 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7146 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
7148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7149 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7150 CHECK(val->result_ok);
7151 LDKQueryChannelRange res_var = (*val->contents.result);
7152 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7153 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7154 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7158 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7159 CHECK(!val->result_ok);
7160 LDKDecodeError err_var = (*val->contents.err);
7161 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7162 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7163 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7167 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
7169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7170 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7171 CHECK(val->result_ok);
7172 LDKReplyChannelRange res_var = (*val->contents.result);
7173 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7174 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7175 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7179 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7180 CHECK(!val->result_ok);
7181 LDKDecodeError err_var = (*val->contents.err);
7182 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7183 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7184 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7188 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
7190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7191 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7192 CHECK(val->result_ok);
7193 LDKGossipTimestampFilter res_var = (*val->contents.result);
7194 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7195 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7196 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7200 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7201 CHECK(!val->result_ok);
7202 LDKDecodeError err_var = (*val->contents.err);
7203 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7204 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7205 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7208 static jclass LDKSignOrCreationError_SignError_class = NULL;
7209 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
7210 static jclass LDKSignOrCreationError_CreationError_class = NULL;
7211 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
7212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
7213 LDKSignOrCreationError_SignError_class =
7214 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
7215 CHECK(LDKSignOrCreationError_SignError_class != NULL);
7216 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
7217 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
7218 LDKSignOrCreationError_CreationError_class =
7219 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
7220 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
7221 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
7222 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
7224 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7225 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7227 case LDKSignOrCreationError_SignError: {
7228 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
7230 case LDKSignOrCreationError_CreationError: {
7231 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
7232 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
7237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7238 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
7240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7241 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7242 CHECK(val->result_ok);
7243 LDKInvoice res_var = (*val->contents.result);
7244 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7245 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7246 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7250 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7251 CHECK(!val->result_ok);
7252 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
7255 typedef struct LDKFilter_JCalls {
7256 atomic_size_t refcnt;
7259 jmethodID register_tx_meth;
7260 jmethodID register_output_meth;
7262 static void LDKFilter_JCalls_free(void* this_arg) {
7263 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7264 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7266 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7267 if (get_jenv_res == JNI_EDETACHED) {
7268 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7270 DO_ASSERT(get_jenv_res == JNI_OK);
7272 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7273 if (get_jenv_res == JNI_EDETACHED) {
7274 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7279 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7280 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7282 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7283 if (get_jenv_res == JNI_EDETACHED) {
7284 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7286 DO_ASSERT(get_jenv_res == JNI_OK);
7288 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7289 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7290 LDKu8slice script_pubkey_var = script_pubkey;
7291 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
7292 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
7293 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7295 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
7296 if ((*env)->ExceptionCheck(env)) {
7297 (*env)->ExceptionDescribe(env);
7298 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
7300 if (get_jenv_res == JNI_EDETACHED) {
7301 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7304 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7305 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7307 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7308 if (get_jenv_res == JNI_EDETACHED) {
7309 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7311 DO_ASSERT(get_jenv_res == JNI_OK);
7313 LDKWatchedOutput output_var = output;
7314 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7315 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7316 uint64_t output_ref = (uint64_t)output_var.inner;
7317 if (output_var.is_owned) {
7320 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7322 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7323 if ((*env)->ExceptionCheck(env)) {
7324 (*env)->ExceptionDescribe(env);
7325 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7327 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
7328 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7329 if (get_jenv_res == JNI_EDETACHED) {
7330 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7334 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7335 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7336 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7338 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7339 jclass c = (*env)->GetObjectClass(env, o);
7341 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7342 atomic_init(&calls->refcnt, 1);
7343 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7344 calls->o = (*env)->NewWeakGlobalRef(env, o);
7345 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7346 CHECK(calls->register_tx_meth != NULL);
7347 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7348 CHECK(calls->register_output_meth != NULL);
7351 .this_arg = (void*) calls,
7352 .register_tx = register_tx_LDKFilter_jcall,
7353 .register_output = register_output_LDKFilter_jcall,
7354 .free = LDKFilter_JCalls_free,
7358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7359 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7360 *res_ptr = LDKFilter_init(env, clz, o);
7361 return (uint64_t)res_ptr;
7363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7364 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7365 unsigned char txid_arr[32];
7366 CHECK((*env)->GetArrayLength(env, txid) == 32);
7367 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7368 unsigned char (*txid_ref)[32] = &txid_arr;
7369 LDKu8slice script_pubkey_ref;
7370 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7371 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7372 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7373 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7377 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7378 LDKWatchedOutput output_conv;
7379 output_conv.inner = (void*)(output & (~1));
7380 output_conv.is_owned = (output & 1) || (output == 0);
7381 output_conv = WatchedOutput_clone(&output_conv);
7382 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7383 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7384 uint64_t ret_ref = (uint64_t)ret_copy;
7388 static jclass LDKCOption_FilterZ_Some_class = NULL;
7389 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7390 static jclass LDKCOption_FilterZ_None_class = NULL;
7391 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7393 LDKCOption_FilterZ_Some_class =
7394 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7395 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7396 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7397 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7398 LDKCOption_FilterZ_None_class =
7399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7400 CHECK(LDKCOption_FilterZ_None_class != NULL);
7401 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7402 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7404 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7405 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7407 case LDKCOption_FilterZ_Some: {
7408 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
7409 *some_ret = obj->some;
7410 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7411 if ((*some_ret).free == LDKFilter_JCalls_free) {
7412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7413 LDKFilter_JCalls_cloned(&(*some_ret));
7415 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7417 case LDKCOption_FilterZ_None: {
7418 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7424 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
7426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7427 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7428 CHECK(val->result_ok);
7429 LDKLockedChannelMonitor res_var = (*val->contents.result);
7430 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7431 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7432 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7436 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7437 CHECK(!val->result_ok);
7438 return *val->contents.err;
7440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
7441 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
7442 ret->datalen = (*env)->GetArrayLength(env, elems);
7443 if (ret->datalen == 0) {
7446 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
7447 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
7448 for (size_t i = 0; i < ret->datalen; i++) {
7449 int64_t arr_elem = java_elems[i];
7450 LDKOutPoint arr_elem_conv;
7451 arr_elem_conv.inner = (void*)(arr_elem & (~1));
7452 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
7453 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
7454 ret->data[i] = arr_elem_conv;
7456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
7458 return (uint64_t)ret;
7460 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7461 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7462 for (size_t i = 0; i < ret.datalen; i++) {
7463 ret.data[i] = OutPoint_clone(&orig->data[i]);
7467 typedef struct LDKMessageSendEventsProvider_JCalls {
7468 atomic_size_t refcnt;
7471 jmethodID get_and_clear_pending_msg_events_meth;
7472 } LDKMessageSendEventsProvider_JCalls;
7473 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7474 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7475 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7477 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7478 if (get_jenv_res == JNI_EDETACHED) {
7479 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7481 DO_ASSERT(get_jenv_res == JNI_OK);
7483 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7484 if (get_jenv_res == JNI_EDETACHED) {
7485 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7490 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7491 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7493 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7494 if (get_jenv_res == JNI_EDETACHED) {
7495 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7497 DO_ASSERT(get_jenv_res == JNI_OK);
7499 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7501 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7502 if ((*env)->ExceptionCheck(env)) {
7503 (*env)->ExceptionDescribe(env);
7504 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7506 LDKCVec_MessageSendEventZ ret_constr;
7507 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7508 if (ret_constr.datalen > 0)
7509 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7511 ret_constr.data = NULL;
7512 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7513 for (size_t s = 0; s < ret_constr.datalen; s++) {
7514 int64_t ret_conv_18 = ret_vals[s];
7515 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
7516 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7517 ret_constr.data[s] = ret_conv_18_conv;
7519 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7520 if (get_jenv_res == JNI_EDETACHED) {
7521 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7525 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7526 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7527 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7529 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7530 jclass c = (*env)->GetObjectClass(env, o);
7532 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7533 atomic_init(&calls->refcnt, 1);
7534 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7535 calls->o = (*env)->NewWeakGlobalRef(env, o);
7536 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7537 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7539 LDKMessageSendEventsProvider ret = {
7540 .this_arg = (void*) calls,
7541 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7542 .free = LDKMessageSendEventsProvider_JCalls_free,
7546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7547 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7548 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7549 return (uint64_t)res_ptr;
7551 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7552 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
7553 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7554 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7555 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7556 for (size_t s = 0; s < ret_var.datalen; s++) {
7557 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7558 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
7559 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7560 ret_arr_ptr[s] = ret_conv_18_ref;
7562 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7567 typedef struct LDKEventHandler_JCalls {
7568 atomic_size_t refcnt;
7571 jmethodID handle_event_meth;
7572 } LDKEventHandler_JCalls;
7573 static void LDKEventHandler_JCalls_free(void* this_arg) {
7574 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7575 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7577 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7578 if (get_jenv_res == JNI_EDETACHED) {
7579 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7581 DO_ASSERT(get_jenv_res == JNI_OK);
7583 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7584 if (get_jenv_res == JNI_EDETACHED) {
7585 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7590 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7591 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7593 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7594 if (get_jenv_res == JNI_EDETACHED) {
7595 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7597 DO_ASSERT(get_jenv_res == JNI_OK);
7599 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7600 *ret_event = Event_clone(event);
7601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7603 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7604 if ((*env)->ExceptionCheck(env)) {
7605 (*env)->ExceptionDescribe(env);
7606 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7608 if (get_jenv_res == JNI_EDETACHED) {
7609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7612 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7613 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7614 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7616 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7617 jclass c = (*env)->GetObjectClass(env, o);
7619 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7620 atomic_init(&calls->refcnt, 1);
7621 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7622 calls->o = (*env)->NewWeakGlobalRef(env, o);
7623 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7624 CHECK(calls->handle_event_meth != NULL);
7626 LDKEventHandler ret = {
7627 .this_arg = (void*) calls,
7628 .handle_event = handle_event_LDKEventHandler_jcall,
7629 .free = LDKEventHandler_JCalls_free,
7633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7634 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7635 *res_ptr = LDKEventHandler_init(env, clz, o);
7636 return (uint64_t)res_ptr;
7638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7639 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
7640 LDKEvent* event_conv = (LDKEvent*)event;
7641 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7644 typedef struct LDKEventsProvider_JCalls {
7645 atomic_size_t refcnt;
7648 jmethodID process_pending_events_meth;
7649 } LDKEventsProvider_JCalls;
7650 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7651 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7652 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7654 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7655 if (get_jenv_res == JNI_EDETACHED) {
7656 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7658 DO_ASSERT(get_jenv_res == JNI_OK);
7660 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7661 if (get_jenv_res == JNI_EDETACHED) {
7662 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7667 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7668 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7670 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7671 if (get_jenv_res == JNI_EDETACHED) {
7672 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7674 DO_ASSERT(get_jenv_res == JNI_OK);
7676 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7677 *handler_ret = handler;
7678 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7680 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7681 if ((*env)->ExceptionCheck(env)) {
7682 (*env)->ExceptionDescribe(env);
7683 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7685 if (get_jenv_res == JNI_EDETACHED) {
7686 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7689 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7690 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7691 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7693 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7694 jclass c = (*env)->GetObjectClass(env, o);
7696 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7697 atomic_init(&calls->refcnt, 1);
7698 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7699 calls->o = (*env)->NewWeakGlobalRef(env, o);
7700 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7701 CHECK(calls->process_pending_events_meth != NULL);
7703 LDKEventsProvider ret = {
7704 .this_arg = (void*) calls,
7705 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7706 .free = LDKEventsProvider_JCalls_free,
7710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7711 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7712 *res_ptr = LDKEventsProvider_init(env, clz, o);
7713 return (uint64_t)res_ptr;
7715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7716 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
7717 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
7718 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7719 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7720 LDKEventHandler_JCalls_cloned(&handler_conv);
7722 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7725 typedef struct LDKListen_JCalls {
7726 atomic_size_t refcnt;
7729 jmethodID block_connected_meth;
7730 jmethodID block_disconnected_meth;
7732 static void LDKListen_JCalls_free(void* this_arg) {
7733 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7734 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7736 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7737 if (get_jenv_res == JNI_EDETACHED) {
7738 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7740 DO_ASSERT(get_jenv_res == JNI_OK);
7742 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7743 if (get_jenv_res == JNI_EDETACHED) {
7744 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7749 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7750 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7752 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7753 if (get_jenv_res == JNI_EDETACHED) {
7754 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7756 DO_ASSERT(get_jenv_res == JNI_OK);
7758 LDKu8slice block_var = block;
7759 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7760 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7761 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7763 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7764 if ((*env)->ExceptionCheck(env)) {
7765 (*env)->ExceptionDescribe(env);
7766 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
7768 if (get_jenv_res == JNI_EDETACHED) {
7769 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7772 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7773 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7775 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7776 if (get_jenv_res == JNI_EDETACHED) {
7777 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7779 DO_ASSERT(get_jenv_res == JNI_OK);
7781 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7782 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7783 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7785 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7786 if ((*env)->ExceptionCheck(env)) {
7787 (*env)->ExceptionDescribe(env);
7788 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7790 if (get_jenv_res == JNI_EDETACHED) {
7791 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7794 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7795 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7796 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7798 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7799 jclass c = (*env)->GetObjectClass(env, o);
7801 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7802 atomic_init(&calls->refcnt, 1);
7803 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7804 calls->o = (*env)->NewWeakGlobalRef(env, o);
7805 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7806 CHECK(calls->block_connected_meth != NULL);
7807 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7808 CHECK(calls->block_disconnected_meth != NULL);
7811 .this_arg = (void*) calls,
7812 .block_connected = block_connected_LDKListen_jcall,
7813 .block_disconnected = block_disconnected_LDKListen_jcall,
7814 .free = LDKListen_JCalls_free,
7818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7819 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7820 *res_ptr = LDKListen_init(env, clz, o);
7821 return (uint64_t)res_ptr;
7823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
7824 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7825 LDKu8slice block_ref;
7826 block_ref.datalen = (*env)->GetArrayLength(env, block);
7827 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7828 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7829 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
7833 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7834 unsigned char header_arr[80];
7835 CHECK((*env)->GetArrayLength(env, header) == 80);
7836 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7837 unsigned char (*header_ref)[80] = &header_arr;
7838 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7841 typedef struct LDKConfirm_JCalls {
7842 atomic_size_t refcnt;
7845 jmethodID transactions_confirmed_meth;
7846 jmethodID transaction_unconfirmed_meth;
7847 jmethodID best_block_updated_meth;
7848 jmethodID get_relevant_txids_meth;
7849 } LDKConfirm_JCalls;
7850 static void LDKConfirm_JCalls_free(void* this_arg) {
7851 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7852 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7854 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7855 if (get_jenv_res == JNI_EDETACHED) {
7856 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7858 DO_ASSERT(get_jenv_res == JNI_OK);
7860 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7861 if (get_jenv_res == JNI_EDETACHED) {
7862 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7867 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7868 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7870 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7871 if (get_jenv_res == JNI_EDETACHED) {
7872 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7874 DO_ASSERT(get_jenv_res == JNI_OK);
7876 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7877 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7878 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7879 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7880 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7881 for (size_t c = 0; c < txdata_var.datalen; c++) {
7882 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7883 *txdata_conv_28_conv = txdata_var.data[c];
7884 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7886 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7887 FREE(txdata_var.data);
7888 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7890 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7891 if ((*env)->ExceptionCheck(env)) {
7892 (*env)->ExceptionDescribe(env);
7893 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7895 if (get_jenv_res == JNI_EDETACHED) {
7896 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7899 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7900 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7903 if (get_jenv_res == JNI_EDETACHED) {
7904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7906 DO_ASSERT(get_jenv_res == JNI_OK);
7908 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7909 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7910 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7912 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7913 if ((*env)->ExceptionCheck(env)) {
7914 (*env)->ExceptionDescribe(env);
7915 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
7917 if (get_jenv_res == JNI_EDETACHED) {
7918 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7921 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7922 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7924 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7925 if (get_jenv_res == JNI_EDETACHED) {
7926 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7928 DO_ASSERT(get_jenv_res == JNI_OK);
7930 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7931 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7932 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7934 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
7935 if ((*env)->ExceptionCheck(env)) {
7936 (*env)->ExceptionDescribe(env);
7937 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
7939 if (get_jenv_res == JNI_EDETACHED) {
7940 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7943 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7944 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7946 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7947 if (get_jenv_res == JNI_EDETACHED) {
7948 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7950 DO_ASSERT(get_jenv_res == JNI_OK);
7952 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7954 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
7955 if ((*env)->ExceptionCheck(env)) {
7956 (*env)->ExceptionDescribe(env);
7957 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
7959 LDKCVec_TxidZ ret_constr;
7960 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7961 if (ret_constr.datalen > 0)
7962 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7964 ret_constr.data = NULL;
7965 for (size_t i = 0; i < ret_constr.datalen; i++) {
7966 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
7967 LDKThirtyTwoBytes ret_conv_8_ref;
7968 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
7969 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
7970 ret_constr.data[i] = ret_conv_8_ref;
7972 if (get_jenv_res == JNI_EDETACHED) {
7973 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7977 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7978 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7979 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7981 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
7982 jclass c = (*env)->GetObjectClass(env, o);
7984 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7985 atomic_init(&calls->refcnt, 1);
7986 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7987 calls->o = (*env)->NewWeakGlobalRef(env, o);
7988 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
7989 CHECK(calls->transactions_confirmed_meth != NULL);
7990 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
7991 CHECK(calls->transaction_unconfirmed_meth != NULL);
7992 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
7993 CHECK(calls->best_block_updated_meth != NULL);
7994 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
7995 CHECK(calls->get_relevant_txids_meth != NULL);
7998 .this_arg = (void*) calls,
7999 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8000 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8001 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8002 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8003 .free = LDKConfirm_JCalls_free,
8007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
8008 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8009 *res_ptr = LDKConfirm_init(env, clz, o);
8010 return (uint64_t)res_ptr;
8012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
8013 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
8014 unsigned char header_arr[80];
8015 CHECK((*env)->GetArrayLength(env, header) == 80);
8016 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8017 unsigned char (*header_ref)[80] = &header_arr;
8018 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8019 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8020 if (txdata_constr.datalen > 0)
8021 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8023 txdata_constr.data = NULL;
8024 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8025 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8026 int64_t txdata_conv_28 = txdata_vals[c];
8027 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
8028 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
8029 txdata_constr.data[c] = txdata_conv_28_conv;
8031 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8032 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
8036 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
8037 unsigned char txid_arr[32];
8038 CHECK((*env)->GetArrayLength(env, txid) == 32);
8039 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
8040 unsigned char (*txid_ref)[32] = &txid_arr;
8041 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
8045 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
8046 unsigned char header_arr[80];
8047 CHECK((*env)->GetArrayLength(env, header) == 80);
8048 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8049 unsigned char (*header_ref)[80] = &header_arr;
8050 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8053 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
8054 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
8055 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8056 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8058 for (size_t i = 0; i < ret_var.datalen; i++) {
8059 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
8060 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
8061 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
8067 typedef struct LDKPersist_JCalls {
8068 atomic_size_t refcnt;
8071 jmethodID persist_new_channel_meth;
8072 jmethodID update_persisted_channel_meth;
8073 } LDKPersist_JCalls;
8074 static void LDKPersist_JCalls_free(void* this_arg) {
8075 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8076 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8078 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8079 if (get_jenv_res == JNI_EDETACHED) {
8080 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8082 DO_ASSERT(get_jenv_res == JNI_OK);
8084 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8085 if (get_jenv_res == JNI_EDETACHED) {
8086 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8091 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
8092 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8094 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8095 if (get_jenv_res == JNI_EDETACHED) {
8096 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8098 DO_ASSERT(get_jenv_res == JNI_OK);
8100 LDKOutPoint id_var = id;
8101 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8102 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8103 uint64_t id_ref = (uint64_t)id_var.inner;
8104 if (id_var.is_owned) {
8107 LDKChannelMonitor data_var = *data;
8108 data_var = ChannelMonitor_clone(data);
8109 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8110 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8111 uint64_t data_ref = (uint64_t)data_var.inner;
8112 if (data_var.is_owned) {
8115 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8117 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
8118 if ((*env)->ExceptionCheck(env)) {
8119 (*env)->ExceptionDescribe(env);
8120 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
8122 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
8123 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8124 if (get_jenv_res == JNI_EDETACHED) {
8125 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8129 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
8130 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8132 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8133 if (get_jenv_res == JNI_EDETACHED) {
8134 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8136 DO_ASSERT(get_jenv_res == JNI_OK);
8138 LDKOutPoint id_var = id;
8139 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8140 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8141 uint64_t id_ref = (uint64_t)id_var.inner;
8142 if (id_var.is_owned) {
8145 LDKChannelMonitorUpdate update_var = *update;
8146 update_var = ChannelMonitorUpdate_clone(update);
8147 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8148 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8149 uint64_t update_ref = (uint64_t)update_var.inner;
8150 if (update_var.is_owned) {
8153 LDKChannelMonitor data_var = *data;
8154 data_var = ChannelMonitor_clone(data);
8155 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8156 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8157 uint64_t data_ref = (uint64_t)data_var.inner;
8158 if (data_var.is_owned) {
8161 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8163 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
8164 if ((*env)->ExceptionCheck(env)) {
8165 (*env)->ExceptionDescribe(env);
8166 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
8168 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
8169 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8170 if (get_jenv_res == JNI_EDETACHED) {
8171 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8175 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8176 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8177 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8179 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
8180 jclass c = (*env)->GetObjectClass(env, o);
8182 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8183 atomic_init(&calls->refcnt, 1);
8184 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8185 calls->o = (*env)->NewWeakGlobalRef(env, o);
8186 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
8187 CHECK(calls->persist_new_channel_meth != NULL);
8188 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
8189 CHECK(calls->update_persisted_channel_meth != NULL);
8192 .this_arg = (void*) calls,
8193 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8194 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8195 .free = LDKPersist_JCalls_free,
8199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
8200 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8201 *res_ptr = LDKPersist_init(env, clz, o);
8202 return (uint64_t)res_ptr;
8204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
8205 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
8206 LDKOutPoint id_conv;
8207 id_conv.inner = (void*)(id & (~1));
8208 id_conv.is_owned = (id & 1) || (id == 0);
8209 id_conv = OutPoint_clone(&id_conv);
8210 LDKChannelMonitor data_conv;
8211 data_conv.inner = (void*)(data & (~1));
8212 data_conv.is_owned = false;
8213 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8214 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
8215 return (uint64_t)ret_conv;
8218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
8219 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
8220 LDKOutPoint id_conv;
8221 id_conv.inner = (void*)(id & (~1));
8222 id_conv.is_owned = (id & 1) || (id == 0);
8223 id_conv = OutPoint_clone(&id_conv);
8224 LDKChannelMonitorUpdate update_conv;
8225 update_conv.inner = (void*)(update & (~1));
8226 update_conv.is_owned = false;
8227 LDKChannelMonitor data_conv;
8228 data_conv.inner = (void*)(data & (~1));
8229 data_conv.is_owned = false;
8230 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8231 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
8232 return (uint64_t)ret_conv;
8235 typedef struct LDKChannelMessageHandler_JCalls {
8236 atomic_size_t refcnt;
8239 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8240 jmethodID handle_open_channel_meth;
8241 jmethodID handle_accept_channel_meth;
8242 jmethodID handle_funding_created_meth;
8243 jmethodID handle_funding_signed_meth;
8244 jmethodID handle_funding_locked_meth;
8245 jmethodID handle_shutdown_meth;
8246 jmethodID handle_closing_signed_meth;
8247 jmethodID handle_update_add_htlc_meth;
8248 jmethodID handle_update_fulfill_htlc_meth;
8249 jmethodID handle_update_fail_htlc_meth;
8250 jmethodID handle_update_fail_malformed_htlc_meth;
8251 jmethodID handle_commitment_signed_meth;
8252 jmethodID handle_revoke_and_ack_meth;
8253 jmethodID handle_update_fee_meth;
8254 jmethodID handle_announcement_signatures_meth;
8255 jmethodID peer_disconnected_meth;
8256 jmethodID peer_connected_meth;
8257 jmethodID handle_channel_reestablish_meth;
8258 jmethodID handle_channel_update_meth;
8259 jmethodID handle_error_meth;
8260 } LDKChannelMessageHandler_JCalls;
8261 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8262 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8263 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8265 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8266 if (get_jenv_res == JNI_EDETACHED) {
8267 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8269 DO_ASSERT(get_jenv_res == JNI_OK);
8271 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8272 if (get_jenv_res == JNI_EDETACHED) {
8273 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8278 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8279 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8282 if (get_jenv_res == JNI_EDETACHED) {
8283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8285 DO_ASSERT(get_jenv_res == JNI_OK);
8287 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8288 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8289 LDKInitFeatures their_features_var = their_features;
8290 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8291 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8292 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8293 if (their_features_var.is_owned) {
8294 their_features_ref |= 1;
8296 LDKOpenChannel msg_var = *msg;
8297 msg_var = OpenChannel_clone(msg);
8298 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8299 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8300 uint64_t msg_ref = (uint64_t)msg_var.inner;
8301 if (msg_var.is_owned) {
8304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8306 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8307 if ((*env)->ExceptionCheck(env)) {
8308 (*env)->ExceptionDescribe(env);
8309 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
8311 if (get_jenv_res == JNI_EDETACHED) {
8312 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8315 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8316 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8318 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8319 if (get_jenv_res == JNI_EDETACHED) {
8320 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8322 DO_ASSERT(get_jenv_res == JNI_OK);
8324 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8325 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8326 LDKInitFeatures their_features_var = their_features;
8327 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8328 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8329 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8330 if (their_features_var.is_owned) {
8331 their_features_ref |= 1;
8333 LDKAcceptChannel msg_var = *msg;
8334 msg_var = AcceptChannel_clone(msg);
8335 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8336 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8337 uint64_t msg_ref = (uint64_t)msg_var.inner;
8338 if (msg_var.is_owned) {
8341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8343 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8344 if ((*env)->ExceptionCheck(env)) {
8345 (*env)->ExceptionDescribe(env);
8346 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
8348 if (get_jenv_res == JNI_EDETACHED) {
8349 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8352 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8353 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8355 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8356 if (get_jenv_res == JNI_EDETACHED) {
8357 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8359 DO_ASSERT(get_jenv_res == JNI_OK);
8361 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8362 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8363 LDKFundingCreated msg_var = *msg;
8364 msg_var = FundingCreated_clone(msg);
8365 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8366 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8367 uint64_t msg_ref = (uint64_t)msg_var.inner;
8368 if (msg_var.is_owned) {
8371 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8373 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8374 if ((*env)->ExceptionCheck(env)) {
8375 (*env)->ExceptionDescribe(env);
8376 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8378 if (get_jenv_res == JNI_EDETACHED) {
8379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8382 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8383 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8385 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8386 if (get_jenv_res == JNI_EDETACHED) {
8387 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8389 DO_ASSERT(get_jenv_res == JNI_OK);
8391 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8392 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8393 LDKFundingSigned msg_var = *msg;
8394 msg_var = FundingSigned_clone(msg);
8395 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8396 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8397 uint64_t msg_ref = (uint64_t)msg_var.inner;
8398 if (msg_var.is_owned) {
8401 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8403 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8404 if ((*env)->ExceptionCheck(env)) {
8405 (*env)->ExceptionDescribe(env);
8406 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8408 if (get_jenv_res == JNI_EDETACHED) {
8409 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8412 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8413 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8415 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8416 if (get_jenv_res == JNI_EDETACHED) {
8417 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8419 DO_ASSERT(get_jenv_res == JNI_OK);
8421 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8422 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8423 LDKFundingLocked msg_var = *msg;
8424 msg_var = FundingLocked_clone(msg);
8425 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8426 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8427 uint64_t msg_ref = (uint64_t)msg_var.inner;
8428 if (msg_var.is_owned) {
8431 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8433 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8434 if ((*env)->ExceptionCheck(env)) {
8435 (*env)->ExceptionDescribe(env);
8436 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8438 if (get_jenv_res == JNI_EDETACHED) {
8439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8442 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8443 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8445 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8446 if (get_jenv_res == JNI_EDETACHED) {
8447 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8449 DO_ASSERT(get_jenv_res == JNI_OK);
8451 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8452 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8453 LDKInitFeatures their_features_var = *their_features;
8454 their_features_var = InitFeatures_clone(their_features);
8455 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8456 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8457 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8458 if (their_features_var.is_owned) {
8459 their_features_ref |= 1;
8461 LDKShutdown msg_var = *msg;
8462 msg_var = Shutdown_clone(msg);
8463 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8464 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8465 uint64_t msg_ref = (uint64_t)msg_var.inner;
8466 if (msg_var.is_owned) {
8469 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8471 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8472 if ((*env)->ExceptionCheck(env)) {
8473 (*env)->ExceptionDescribe(env);
8474 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8476 if (get_jenv_res == JNI_EDETACHED) {
8477 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8480 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8481 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8484 if (get_jenv_res == JNI_EDETACHED) {
8485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8487 DO_ASSERT(get_jenv_res == JNI_OK);
8489 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8490 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8491 LDKClosingSigned msg_var = *msg;
8492 msg_var = ClosingSigned_clone(msg);
8493 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8494 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8495 uint64_t msg_ref = (uint64_t)msg_var.inner;
8496 if (msg_var.is_owned) {
8499 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8501 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8502 if ((*env)->ExceptionCheck(env)) {
8503 (*env)->ExceptionDescribe(env);
8504 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8506 if (get_jenv_res == JNI_EDETACHED) {
8507 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8510 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8511 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8513 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8514 if (get_jenv_res == JNI_EDETACHED) {
8515 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8517 DO_ASSERT(get_jenv_res == JNI_OK);
8519 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8520 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8521 LDKUpdateAddHTLC msg_var = *msg;
8522 msg_var = UpdateAddHTLC_clone(msg);
8523 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8524 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8525 uint64_t msg_ref = (uint64_t)msg_var.inner;
8526 if (msg_var.is_owned) {
8529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8531 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8532 if ((*env)->ExceptionCheck(env)) {
8533 (*env)->ExceptionDescribe(env);
8534 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8536 if (get_jenv_res == JNI_EDETACHED) {
8537 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8540 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8541 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8543 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8544 if (get_jenv_res == JNI_EDETACHED) {
8545 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8547 DO_ASSERT(get_jenv_res == JNI_OK);
8549 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8550 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8551 LDKUpdateFulfillHTLC msg_var = *msg;
8552 msg_var = UpdateFulfillHTLC_clone(msg);
8553 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8554 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8555 uint64_t msg_ref = (uint64_t)msg_var.inner;
8556 if (msg_var.is_owned) {
8559 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8561 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8562 if ((*env)->ExceptionCheck(env)) {
8563 (*env)->ExceptionDescribe(env);
8564 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8566 if (get_jenv_res == JNI_EDETACHED) {
8567 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8570 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8571 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8574 if (get_jenv_res == JNI_EDETACHED) {
8575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8577 DO_ASSERT(get_jenv_res == JNI_OK);
8579 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8580 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8581 LDKUpdateFailHTLC msg_var = *msg;
8582 msg_var = UpdateFailHTLC_clone(msg);
8583 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8584 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8585 uint64_t msg_ref = (uint64_t)msg_var.inner;
8586 if (msg_var.is_owned) {
8589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8591 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8592 if ((*env)->ExceptionCheck(env)) {
8593 (*env)->ExceptionDescribe(env);
8594 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8596 if (get_jenv_res == JNI_EDETACHED) {
8597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8600 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8601 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8603 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8604 if (get_jenv_res == JNI_EDETACHED) {
8605 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8607 DO_ASSERT(get_jenv_res == JNI_OK);
8609 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8610 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8611 LDKUpdateFailMalformedHTLC msg_var = *msg;
8612 msg_var = UpdateFailMalformedHTLC_clone(msg);
8613 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8614 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8615 uint64_t msg_ref = (uint64_t)msg_var.inner;
8616 if (msg_var.is_owned) {
8619 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8621 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8622 if ((*env)->ExceptionCheck(env)) {
8623 (*env)->ExceptionDescribe(env);
8624 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8626 if (get_jenv_res == JNI_EDETACHED) {
8627 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8630 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8631 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8633 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8634 if (get_jenv_res == JNI_EDETACHED) {
8635 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8637 DO_ASSERT(get_jenv_res == JNI_OK);
8639 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8640 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8641 LDKCommitmentSigned msg_var = *msg;
8642 msg_var = CommitmentSigned_clone(msg);
8643 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8644 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8645 uint64_t msg_ref = (uint64_t)msg_var.inner;
8646 if (msg_var.is_owned) {
8649 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8651 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8652 if ((*env)->ExceptionCheck(env)) {
8653 (*env)->ExceptionDescribe(env);
8654 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8656 if (get_jenv_res == JNI_EDETACHED) {
8657 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8660 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8661 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8663 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8664 if (get_jenv_res == JNI_EDETACHED) {
8665 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8667 DO_ASSERT(get_jenv_res == JNI_OK);
8669 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8670 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8671 LDKRevokeAndACK msg_var = *msg;
8672 msg_var = RevokeAndACK_clone(msg);
8673 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8674 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8675 uint64_t msg_ref = (uint64_t)msg_var.inner;
8676 if (msg_var.is_owned) {
8679 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8681 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8682 if ((*env)->ExceptionCheck(env)) {
8683 (*env)->ExceptionDescribe(env);
8684 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8686 if (get_jenv_res == JNI_EDETACHED) {
8687 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8690 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8691 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8693 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8694 if (get_jenv_res == JNI_EDETACHED) {
8695 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8697 DO_ASSERT(get_jenv_res == JNI_OK);
8699 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8700 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8701 LDKUpdateFee msg_var = *msg;
8702 msg_var = UpdateFee_clone(msg);
8703 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8704 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8705 uint64_t msg_ref = (uint64_t)msg_var.inner;
8706 if (msg_var.is_owned) {
8709 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8711 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8712 if ((*env)->ExceptionCheck(env)) {
8713 (*env)->ExceptionDescribe(env);
8714 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8716 if (get_jenv_res == JNI_EDETACHED) {
8717 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8720 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8721 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8723 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8724 if (get_jenv_res == JNI_EDETACHED) {
8725 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8727 DO_ASSERT(get_jenv_res == JNI_OK);
8729 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8730 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8731 LDKAnnouncementSignatures msg_var = *msg;
8732 msg_var = AnnouncementSignatures_clone(msg);
8733 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8734 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8735 uint64_t msg_ref = (uint64_t)msg_var.inner;
8736 if (msg_var.is_owned) {
8739 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8741 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8742 if ((*env)->ExceptionCheck(env)) {
8743 (*env)->ExceptionDescribe(env);
8744 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8746 if (get_jenv_res == JNI_EDETACHED) {
8747 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8750 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8751 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8753 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8754 if (get_jenv_res == JNI_EDETACHED) {
8755 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8757 DO_ASSERT(get_jenv_res == JNI_OK);
8759 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8760 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8761 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8763 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8764 if ((*env)->ExceptionCheck(env)) {
8765 (*env)->ExceptionDescribe(env);
8766 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8768 if (get_jenv_res == JNI_EDETACHED) {
8769 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8772 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8773 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8775 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8776 if (get_jenv_res == JNI_EDETACHED) {
8777 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8779 DO_ASSERT(get_jenv_res == JNI_OK);
8781 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8782 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8783 LDKInit msg_var = *msg;
8784 msg_var = Init_clone(msg);
8785 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8786 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8787 uint64_t msg_ref = (uint64_t)msg_var.inner;
8788 if (msg_var.is_owned) {
8791 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8793 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8794 if ((*env)->ExceptionCheck(env)) {
8795 (*env)->ExceptionDescribe(env);
8796 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8798 if (get_jenv_res == JNI_EDETACHED) {
8799 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8802 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8803 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8805 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8806 if (get_jenv_res == JNI_EDETACHED) {
8807 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8809 DO_ASSERT(get_jenv_res == JNI_OK);
8811 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8812 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8813 LDKChannelReestablish msg_var = *msg;
8814 msg_var = ChannelReestablish_clone(msg);
8815 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8816 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8817 uint64_t msg_ref = (uint64_t)msg_var.inner;
8818 if (msg_var.is_owned) {
8821 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8823 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
8824 if ((*env)->ExceptionCheck(env)) {
8825 (*env)->ExceptionDescribe(env);
8826 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
8828 if (get_jenv_res == JNI_EDETACHED) {
8829 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8832 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8833 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8835 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8836 if (get_jenv_res == JNI_EDETACHED) {
8837 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8839 DO_ASSERT(get_jenv_res == JNI_OK);
8841 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8842 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8843 LDKChannelUpdate msg_var = *msg;
8844 msg_var = ChannelUpdate_clone(msg);
8845 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8846 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8847 uint64_t msg_ref = (uint64_t)msg_var.inner;
8848 if (msg_var.is_owned) {
8851 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8853 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
8854 if ((*env)->ExceptionCheck(env)) {
8855 (*env)->ExceptionDescribe(env);
8856 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
8858 if (get_jenv_res == JNI_EDETACHED) {
8859 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8862 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8863 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8865 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8866 if (get_jenv_res == JNI_EDETACHED) {
8867 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8869 DO_ASSERT(get_jenv_res == JNI_OK);
8871 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8872 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8873 LDKErrorMessage msg_var = *msg;
8874 msg_var = ErrorMessage_clone(msg);
8875 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8876 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8877 uint64_t msg_ref = (uint64_t)msg_var.inner;
8878 if (msg_var.is_owned) {
8881 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8883 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
8884 if ((*env)->ExceptionCheck(env)) {
8885 (*env)->ExceptionDescribe(env);
8886 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
8888 if (get_jenv_res == JNI_EDETACHED) {
8889 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8892 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8893 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8894 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8895 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8897 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8898 jclass c = (*env)->GetObjectClass(env, o);
8900 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8901 atomic_init(&calls->refcnt, 1);
8902 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8903 calls->o = (*env)->NewWeakGlobalRef(env, o);
8904 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
8905 CHECK(calls->handle_open_channel_meth != NULL);
8906 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
8907 CHECK(calls->handle_accept_channel_meth != NULL);
8908 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
8909 CHECK(calls->handle_funding_created_meth != NULL);
8910 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
8911 CHECK(calls->handle_funding_signed_meth != NULL);
8912 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
8913 CHECK(calls->handle_funding_locked_meth != NULL);
8914 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
8915 CHECK(calls->handle_shutdown_meth != NULL);
8916 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
8917 CHECK(calls->handle_closing_signed_meth != NULL);
8918 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
8919 CHECK(calls->handle_update_add_htlc_meth != NULL);
8920 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
8921 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
8922 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
8923 CHECK(calls->handle_update_fail_htlc_meth != NULL);
8924 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
8925 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
8926 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
8927 CHECK(calls->handle_commitment_signed_meth != NULL);
8928 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
8929 CHECK(calls->handle_revoke_and_ack_meth != NULL);
8930 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
8931 CHECK(calls->handle_update_fee_meth != NULL);
8932 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
8933 CHECK(calls->handle_announcement_signatures_meth != NULL);
8934 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
8935 CHECK(calls->peer_disconnected_meth != NULL);
8936 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
8937 CHECK(calls->peer_connected_meth != NULL);
8938 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
8939 CHECK(calls->handle_channel_reestablish_meth != NULL);
8940 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
8941 CHECK(calls->handle_channel_update_meth != NULL);
8942 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
8943 CHECK(calls->handle_error_meth != NULL);
8945 LDKChannelMessageHandler ret = {
8946 .this_arg = (void*) calls,
8947 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8948 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8949 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8950 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8951 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8952 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8953 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8954 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8955 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8956 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8957 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8958 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8959 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8960 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8961 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8962 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8963 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8964 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8965 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8966 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8967 .free = LDKChannelMessageHandler_JCalls_free,
8968 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8970 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8974 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8975 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8976 return (uint64_t)res_ptr;
8978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8979 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
8980 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8981 DO_ASSERT((res_ptr & 1) == 0);
8982 return (int64_t)(res_ptr | 1);
8984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
8985 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8986 LDKPublicKey their_node_id_ref;
8987 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8988 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8989 LDKInitFeatures their_features_conv;
8990 their_features_conv.inner = (void*)(their_features & (~1));
8991 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8992 their_features_conv = InitFeatures_clone(&their_features_conv);
8993 LDKOpenChannel msg_conv;
8994 msg_conv.inner = (void*)(msg & (~1));
8995 msg_conv.is_owned = false;
8996 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
9000 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9001 LDKPublicKey their_node_id_ref;
9002 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9003 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9004 LDKInitFeatures their_features_conv;
9005 their_features_conv.inner = (void*)(their_features & (~1));
9006 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9007 their_features_conv = InitFeatures_clone(&their_features_conv);
9008 LDKAcceptChannel msg_conv;
9009 msg_conv.inner = (void*)(msg & (~1));
9010 msg_conv.is_owned = false;
9011 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9015 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9016 LDKPublicKey their_node_id_ref;
9017 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9018 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9019 LDKFundingCreated msg_conv;
9020 msg_conv.inner = (void*)(msg & (~1));
9021 msg_conv.is_owned = false;
9022 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9026 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9027 LDKPublicKey their_node_id_ref;
9028 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9029 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9030 LDKFundingSigned msg_conv;
9031 msg_conv.inner = (void*)(msg & (~1));
9032 msg_conv.is_owned = false;
9033 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9037 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9038 LDKPublicKey their_node_id_ref;
9039 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9040 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9041 LDKFundingLocked msg_conv;
9042 msg_conv.inner = (void*)(msg & (~1));
9043 msg_conv.is_owned = false;
9044 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
9048 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9049 LDKPublicKey their_node_id_ref;
9050 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9051 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9052 LDKInitFeatures their_features_conv;
9053 their_features_conv.inner = (void*)(their_features & (~1));
9054 their_features_conv.is_owned = false;
9055 LDKShutdown msg_conv;
9056 msg_conv.inner = (void*)(msg & (~1));
9057 msg_conv.is_owned = false;
9058 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9062 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9063 LDKPublicKey their_node_id_ref;
9064 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9065 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9066 LDKClosingSigned msg_conv;
9067 msg_conv.inner = (void*)(msg & (~1));
9068 msg_conv.is_owned = false;
9069 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9073 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9074 LDKPublicKey their_node_id_ref;
9075 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9076 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9077 LDKUpdateAddHTLC msg_conv;
9078 msg_conv.inner = (void*)(msg & (~1));
9079 msg_conv.is_owned = false;
9080 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9084 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9085 LDKPublicKey their_node_id_ref;
9086 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9087 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9088 LDKUpdateFulfillHTLC msg_conv;
9089 msg_conv.inner = (void*)(msg & (~1));
9090 msg_conv.is_owned = false;
9091 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9095 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9096 LDKPublicKey their_node_id_ref;
9097 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9098 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9099 LDKUpdateFailHTLC msg_conv;
9100 msg_conv.inner = (void*)(msg & (~1));
9101 msg_conv.is_owned = false;
9102 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9106 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9107 LDKPublicKey their_node_id_ref;
9108 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9109 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9110 LDKUpdateFailMalformedHTLC msg_conv;
9111 msg_conv.inner = (void*)(msg & (~1));
9112 msg_conv.is_owned = false;
9113 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9117 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9118 LDKPublicKey their_node_id_ref;
9119 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9120 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9121 LDKCommitmentSigned msg_conv;
9122 msg_conv.inner = (void*)(msg & (~1));
9123 msg_conv.is_owned = false;
9124 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9128 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9129 LDKPublicKey their_node_id_ref;
9130 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9131 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9132 LDKRevokeAndACK msg_conv;
9133 msg_conv.inner = (void*)(msg & (~1));
9134 msg_conv.is_owned = false;
9135 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9139 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9140 LDKPublicKey their_node_id_ref;
9141 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9142 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9143 LDKUpdateFee msg_conv;
9144 msg_conv.inner = (void*)(msg & (~1));
9145 msg_conv.is_owned = false;
9146 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9150 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9151 LDKPublicKey their_node_id_ref;
9152 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9153 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9154 LDKAnnouncementSignatures msg_conv;
9155 msg_conv.inner = (void*)(msg & (~1));
9156 msg_conv.is_owned = false;
9157 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
9161 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9162 LDKPublicKey their_node_id_ref;
9163 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9164 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9165 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9169 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9170 LDKPublicKey their_node_id_ref;
9171 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9172 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9174 msg_conv.inner = (void*)(msg & (~1));
9175 msg_conv.is_owned = false;
9176 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9180 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9181 LDKPublicKey their_node_id_ref;
9182 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9183 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9184 LDKChannelReestablish msg_conv;
9185 msg_conv.inner = (void*)(msg & (~1));
9186 msg_conv.is_owned = false;
9187 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9191 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9192 LDKPublicKey their_node_id_ref;
9193 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9194 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9195 LDKChannelUpdate msg_conv;
9196 msg_conv.inner = (void*)(msg & (~1));
9197 msg_conv.is_owned = false;
9198 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9202 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
9203 LDKPublicKey their_node_id_ref;
9204 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9205 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9206 LDKErrorMessage msg_conv;
9207 msg_conv.inner = (void*)(msg & (~1));
9208 msg_conv.is_owned = false;
9209 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9212 typedef struct LDKRoutingMessageHandler_JCalls {
9213 atomic_size_t refcnt;
9216 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9217 jmethodID handle_node_announcement_meth;
9218 jmethodID handle_channel_announcement_meth;
9219 jmethodID handle_channel_update_meth;
9220 jmethodID get_next_channel_announcements_meth;
9221 jmethodID get_next_node_announcements_meth;
9222 jmethodID sync_routing_table_meth;
9223 jmethodID handle_reply_channel_range_meth;
9224 jmethodID handle_reply_short_channel_ids_end_meth;
9225 jmethodID handle_query_channel_range_meth;
9226 jmethodID handle_query_short_channel_ids_meth;
9227 } LDKRoutingMessageHandler_JCalls;
9228 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9229 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9230 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9233 if (get_jenv_res == JNI_EDETACHED) {
9234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9236 DO_ASSERT(get_jenv_res == JNI_OK);
9238 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9239 if (get_jenv_res == JNI_EDETACHED) {
9240 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9245 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9246 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9248 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9249 if (get_jenv_res == JNI_EDETACHED) {
9250 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9252 DO_ASSERT(get_jenv_res == JNI_OK);
9254 LDKNodeAnnouncement msg_var = *msg;
9255 msg_var = NodeAnnouncement_clone(msg);
9256 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9257 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9258 uint64_t msg_ref = (uint64_t)msg_var.inner;
9259 if (msg_var.is_owned) {
9262 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9264 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
9265 if ((*env)->ExceptionCheck(env)) {
9266 (*env)->ExceptionDescribe(env);
9267 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9269 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9270 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9271 if (get_jenv_res == JNI_EDETACHED) {
9272 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9276 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9277 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9279 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9280 if (get_jenv_res == JNI_EDETACHED) {
9281 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9283 DO_ASSERT(get_jenv_res == JNI_OK);
9285 LDKChannelAnnouncement msg_var = *msg;
9286 msg_var = ChannelAnnouncement_clone(msg);
9287 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9288 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9289 uint64_t msg_ref = (uint64_t)msg_var.inner;
9290 if (msg_var.is_owned) {
9293 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9295 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
9296 if ((*env)->ExceptionCheck(env)) {
9297 (*env)->ExceptionDescribe(env);
9298 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9300 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9301 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9302 if (get_jenv_res == JNI_EDETACHED) {
9303 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9307 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9308 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9310 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9311 if (get_jenv_res == JNI_EDETACHED) {
9312 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9314 DO_ASSERT(get_jenv_res == JNI_OK);
9316 LDKChannelUpdate msg_var = *msg;
9317 msg_var = ChannelUpdate_clone(msg);
9318 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9319 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9320 uint64_t msg_ref = (uint64_t)msg_var.inner;
9321 if (msg_var.is_owned) {
9324 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9326 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
9327 if ((*env)->ExceptionCheck(env)) {
9328 (*env)->ExceptionDescribe(env);
9329 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
9331 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9332 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9333 if (get_jenv_res == JNI_EDETACHED) {
9334 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9338 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9339 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9341 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9342 if (get_jenv_res == JNI_EDETACHED) {
9343 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9345 DO_ASSERT(get_jenv_res == JNI_OK);
9347 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9349 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
9350 if ((*env)->ExceptionCheck(env)) {
9351 (*env)->ExceptionDescribe(env);
9352 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9354 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9355 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9356 if (ret_constr.datalen > 0)
9357 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9359 ret_constr.data = NULL;
9360 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9361 for (size_t h = 0; h < ret_constr.datalen; h++) {
9362 int64_t ret_conv_59 = ret_vals[h];
9363 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1);
9364 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
9365 ret_constr.data[h] = ret_conv_59_conv;
9367 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9368 if (get_jenv_res == JNI_EDETACHED) {
9369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9373 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9374 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9376 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9377 if (get_jenv_res == JNI_EDETACHED) {
9378 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9380 DO_ASSERT(get_jenv_res == JNI_OK);
9382 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9383 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9384 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9386 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9387 if ((*env)->ExceptionCheck(env)) {
9388 (*env)->ExceptionDescribe(env);
9389 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9391 LDKCVec_NodeAnnouncementZ ret_constr;
9392 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9393 if (ret_constr.datalen > 0)
9394 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9396 ret_constr.data = NULL;
9397 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9398 for (size_t s = 0; s < ret_constr.datalen; s++) {
9399 int64_t ret_conv_18 = ret_vals[s];
9400 LDKNodeAnnouncement ret_conv_18_conv;
9401 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9402 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9403 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9404 ret_constr.data[s] = ret_conv_18_conv;
9406 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9407 if (get_jenv_res == JNI_EDETACHED) {
9408 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9412 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9413 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9415 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9416 if (get_jenv_res == JNI_EDETACHED) {
9417 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9419 DO_ASSERT(get_jenv_res == JNI_OK);
9421 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9422 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9423 LDKInit init_var = *init;
9424 init_var = Init_clone(init);
9425 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9426 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9427 uint64_t init_ref = (uint64_t)init_var.inner;
9428 if (init_var.is_owned) {
9431 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9433 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9434 if ((*env)->ExceptionCheck(env)) {
9435 (*env)->ExceptionDescribe(env);
9436 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9438 if (get_jenv_res == JNI_EDETACHED) {
9439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9442 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9443 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9445 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9446 if (get_jenv_res == JNI_EDETACHED) {
9447 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9449 DO_ASSERT(get_jenv_res == JNI_OK);
9451 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9452 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9453 LDKReplyChannelRange msg_var = msg;
9454 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9455 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9456 uint64_t msg_ref = (uint64_t)msg_var.inner;
9457 if (msg_var.is_owned) {
9460 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9462 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9463 if ((*env)->ExceptionCheck(env)) {
9464 (*env)->ExceptionDescribe(env);
9465 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9467 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9468 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9469 if (get_jenv_res == JNI_EDETACHED) {
9470 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9474 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9475 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9477 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9478 if (get_jenv_res == JNI_EDETACHED) {
9479 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9481 DO_ASSERT(get_jenv_res == JNI_OK);
9483 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9484 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9485 LDKReplyShortChannelIdsEnd msg_var = msg;
9486 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9487 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9488 uint64_t msg_ref = (uint64_t)msg_var.inner;
9489 if (msg_var.is_owned) {
9492 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9494 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9495 if ((*env)->ExceptionCheck(env)) {
9496 (*env)->ExceptionDescribe(env);
9497 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9499 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9500 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9501 if (get_jenv_res == JNI_EDETACHED) {
9502 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9506 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9507 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9509 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9510 if (get_jenv_res == JNI_EDETACHED) {
9511 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9513 DO_ASSERT(get_jenv_res == JNI_OK);
9515 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9516 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9517 LDKQueryChannelRange msg_var = msg;
9518 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9519 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9520 uint64_t msg_ref = (uint64_t)msg_var.inner;
9521 if (msg_var.is_owned) {
9524 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9526 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9527 if ((*env)->ExceptionCheck(env)) {
9528 (*env)->ExceptionDescribe(env);
9529 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9531 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9532 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9533 if (get_jenv_res == JNI_EDETACHED) {
9534 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9538 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9539 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9541 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9542 if (get_jenv_res == JNI_EDETACHED) {
9543 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9545 DO_ASSERT(get_jenv_res == JNI_OK);
9547 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9548 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9549 LDKQueryShortChannelIds msg_var = msg;
9550 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9551 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9552 uint64_t msg_ref = (uint64_t)msg_var.inner;
9553 if (msg_var.is_owned) {
9556 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9558 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9559 if ((*env)->ExceptionCheck(env)) {
9560 (*env)->ExceptionDescribe(env);
9561 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9563 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9564 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9565 if (get_jenv_res == JNI_EDETACHED) {
9566 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9570 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9571 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9572 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9573 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9575 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9576 jclass c = (*env)->GetObjectClass(env, o);
9578 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9579 atomic_init(&calls->refcnt, 1);
9580 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9581 calls->o = (*env)->NewWeakGlobalRef(env, o);
9582 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9583 CHECK(calls->handle_node_announcement_meth != NULL);
9584 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9585 CHECK(calls->handle_channel_announcement_meth != NULL);
9586 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9587 CHECK(calls->handle_channel_update_meth != NULL);
9588 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9589 CHECK(calls->get_next_channel_announcements_meth != NULL);
9590 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9591 CHECK(calls->get_next_node_announcements_meth != NULL);
9592 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9593 CHECK(calls->sync_routing_table_meth != NULL);
9594 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9595 CHECK(calls->handle_reply_channel_range_meth != NULL);
9596 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9597 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9598 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9599 CHECK(calls->handle_query_channel_range_meth != NULL);
9600 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9601 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9603 LDKRoutingMessageHandler ret = {
9604 .this_arg = (void*) calls,
9605 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9606 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9607 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9608 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9609 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9610 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9611 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9612 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9613 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9614 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9615 .free = LDKRoutingMessageHandler_JCalls_free,
9616 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9618 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9622 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9623 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9624 return (uint64_t)res_ptr;
9626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9627 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9628 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9629 DO_ASSERT((res_ptr & 1) == 0);
9630 return (int64_t)(res_ptr | 1);
9632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9633 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9634 LDKNodeAnnouncement msg_conv;
9635 msg_conv.inner = (void*)(msg & (~1));
9636 msg_conv.is_owned = false;
9637 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9638 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9639 return (uint64_t)ret_conv;
9642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9643 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9644 LDKChannelAnnouncement msg_conv;
9645 msg_conv.inner = (void*)(msg & (~1));
9646 msg_conv.is_owned = false;
9647 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9648 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9649 return (uint64_t)ret_conv;
9652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9653 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9654 LDKChannelUpdate msg_conv;
9655 msg_conv.inner = (void*)(msg & (~1));
9656 msg_conv.is_owned = false;
9657 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9658 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9659 return (uint64_t)ret_conv;
9662 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
9663 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9664 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9665 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9666 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9667 for (size_t h = 0; h < ret_var.datalen; h++) {
9668 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9669 *ret_conv_59_conv = ret_var.data[h];
9670 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
9672 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9677 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
9678 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9679 LDKPublicKey starting_point_ref;
9680 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9681 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9682 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9683 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9684 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9685 for (size_t s = 0; s < ret_var.datalen; s++) {
9686 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9687 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9688 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9689 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9690 if (ret_conv_18_var.is_owned) {
9691 ret_conv_18_ref |= 1;
9693 ret_arr_ptr[s] = ret_conv_18_ref;
9695 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
9701 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9702 LDKPublicKey their_node_id_ref;
9703 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9704 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9706 init_conv.inner = (void*)(init & (~1));
9707 init_conv.is_owned = false;
9708 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9712 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9713 LDKPublicKey their_node_id_ref;
9714 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9715 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9716 LDKReplyChannelRange msg_conv;
9717 msg_conv.inner = (void*)(msg & (~1));
9718 msg_conv.is_owned = (msg & 1) || (msg == 0);
9719 msg_conv = ReplyChannelRange_clone(&msg_conv);
9720 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9721 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9722 return (uint64_t)ret_conv;
9725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9726 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9727 LDKPublicKey their_node_id_ref;
9728 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9729 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9730 LDKReplyShortChannelIdsEnd msg_conv;
9731 msg_conv.inner = (void*)(msg & (~1));
9732 msg_conv.is_owned = (msg & 1) || (msg == 0);
9733 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9734 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9735 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9736 return (uint64_t)ret_conv;
9739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9740 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9741 LDKPublicKey their_node_id_ref;
9742 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9743 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9744 LDKQueryChannelRange msg_conv;
9745 msg_conv.inner = (void*)(msg & (~1));
9746 msg_conv.is_owned = (msg & 1) || (msg == 0);
9747 msg_conv = QueryChannelRange_clone(&msg_conv);
9748 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9749 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9750 return (uint64_t)ret_conv;
9753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
9754 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9755 LDKPublicKey their_node_id_ref;
9756 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9757 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9758 LDKQueryShortChannelIds msg_conv;
9759 msg_conv.inner = (void*)(msg & (~1));
9760 msg_conv.is_owned = (msg & 1) || (msg == 0);
9761 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9762 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9763 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9764 return (uint64_t)ret_conv;
9767 typedef struct LDKCustomMessageReader_JCalls {
9768 atomic_size_t refcnt;
9771 jmethodID read_meth;
9772 } LDKCustomMessageReader_JCalls;
9773 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9774 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9775 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9777 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9778 if (get_jenv_res == JNI_EDETACHED) {
9779 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9781 DO_ASSERT(get_jenv_res == JNI_OK);
9783 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9784 if (get_jenv_res == JNI_EDETACHED) {
9785 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9790 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9791 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9793 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9794 if (get_jenv_res == JNI_EDETACHED) {
9795 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9797 DO_ASSERT(get_jenv_res == JNI_OK);
9799 LDKu8slice buffer_var = buffer;
9800 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
9801 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
9802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9804 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
9805 if ((*env)->ExceptionCheck(env)) {
9806 (*env)->ExceptionDescribe(env);
9807 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
9809 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
9810 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
9811 if (get_jenv_res == JNI_EDETACHED) {
9812 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9816 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9817 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9818 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9820 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
9821 jclass c = (*env)->GetObjectClass(env, o);
9823 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9824 atomic_init(&calls->refcnt, 1);
9825 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9826 calls->o = (*env)->NewWeakGlobalRef(env, o);
9827 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
9828 CHECK(calls->read_meth != NULL);
9830 LDKCustomMessageReader ret = {
9831 .this_arg = (void*) calls,
9832 .read = read_LDKCustomMessageReader_jcall,
9833 .free = LDKCustomMessageReader_JCalls_free,
9837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
9838 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9839 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
9840 return (uint64_t)res_ptr;
9842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
9843 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
9844 LDKu8slice buffer_ref;
9845 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
9846 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
9847 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9848 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9849 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
9850 return (uint64_t)ret_conv;
9853 typedef struct LDKCustomMessageHandler_JCalls {
9854 atomic_size_t refcnt;
9857 LDKCustomMessageReader_JCalls* CustomMessageReader;
9858 jmethodID handle_custom_message_meth;
9859 jmethodID get_and_clear_pending_msg_meth;
9860 } LDKCustomMessageHandler_JCalls;
9861 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9862 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9863 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9865 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9866 if (get_jenv_res == JNI_EDETACHED) {
9867 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9869 DO_ASSERT(get_jenv_res == JNI_OK);
9871 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9872 if (get_jenv_res == JNI_EDETACHED) {
9873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9878 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9879 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9881 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9882 if (get_jenv_res == JNI_EDETACHED) {
9883 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9885 DO_ASSERT(get_jenv_res == JNI_OK);
9887 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
9889 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
9890 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
9891 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9893 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
9894 if ((*env)->ExceptionCheck(env)) {
9895 (*env)->ExceptionDescribe(env);
9896 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
9898 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9899 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9900 if (get_jenv_res == JNI_EDETACHED) {
9901 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9905 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9906 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9909 if (get_jenv_res == JNI_EDETACHED) {
9910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9912 DO_ASSERT(get_jenv_res == JNI_OK);
9914 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9916 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
9917 if ((*env)->ExceptionCheck(env)) {
9918 (*env)->ExceptionDescribe(env);
9919 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
9921 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9922 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9923 if (ret_constr.datalen > 0)
9924 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9926 ret_constr.data = NULL;
9927 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9928 for (size_t z = 0; z < ret_constr.datalen; z++) {
9929 int64_t ret_conv_25 = ret_vals[z];
9930 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1);
9931 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
9932 ret_constr.data[z] = ret_conv_25_conv;
9934 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9935 if (get_jenv_res == JNI_EDETACHED) {
9936 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9940 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9941 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9942 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9943 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9945 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9946 jclass c = (*env)->GetObjectClass(env, o);
9948 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9949 atomic_init(&calls->refcnt, 1);
9950 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9951 calls->o = (*env)->NewWeakGlobalRef(env, o);
9952 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
9953 CHECK(calls->handle_custom_message_meth != NULL);
9954 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
9955 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
9957 LDKCustomMessageHandler ret = {
9958 .this_arg = (void*) calls,
9959 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9960 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9961 .free = LDKCustomMessageHandler_JCalls_free,
9962 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
9964 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9968 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9969 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
9970 return (uint64_t)res_ptr;
9972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
9973 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
9974 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
9975 DO_ASSERT((res_ptr & 1) == 0);
9976 return (int64_t)(res_ptr | 1);
9978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
9979 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9980 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
9981 if (msg_conv.free == LDKType_JCalls_free) {
9982 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9983 LDKType_JCalls_cloned(&msg_conv);
9985 LDKPublicKey sender_node_id_ref;
9986 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
9987 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
9988 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9989 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9990 return (uint64_t)ret_conv;
9993 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
9994 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9995 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9996 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9997 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9998 for (size_t z = 0; z < ret_var.datalen; z++) {
9999 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10000 *ret_conv_25_conv = ret_var.data[z];
10001 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
10003 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10004 FREE(ret_var.data);
10008 typedef struct LDKSocketDescriptor_JCalls {
10009 atomic_size_t refcnt;
10012 jmethodID send_data_meth;
10013 jmethodID disconnect_socket_meth;
10015 jmethodID hash_meth;
10016 } LDKSocketDescriptor_JCalls;
10017 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10018 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10019 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10021 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10022 if (get_jenv_res == JNI_EDETACHED) {
10023 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10025 DO_ASSERT(get_jenv_res == JNI_OK);
10027 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10028 if (get_jenv_res == JNI_EDETACHED) {
10029 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10034 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10035 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10037 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10038 if (get_jenv_res == JNI_EDETACHED) {
10039 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10041 DO_ASSERT(get_jenv_res == JNI_OK);
10043 LDKu8slice data_var = data;
10044 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
10045 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
10046 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10047 CHECK(obj != NULL);
10048 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
10049 if ((*env)->ExceptionCheck(env)) {
10050 (*env)->ExceptionDescribe(env);
10051 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
10053 if (get_jenv_res == JNI_EDETACHED) {
10054 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10058 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10059 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10061 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10062 if (get_jenv_res == JNI_EDETACHED) {
10063 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10065 DO_ASSERT(get_jenv_res == JNI_OK);
10067 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10068 CHECK(obj != NULL);
10069 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
10070 if ((*env)->ExceptionCheck(env)) {
10071 (*env)->ExceptionDescribe(env);
10072 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
10074 if (get_jenv_res == JNI_EDETACHED) {
10075 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10078 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10079 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10081 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10082 if (get_jenv_res == JNI_EDETACHED) {
10083 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10085 DO_ASSERT(get_jenv_res == JNI_OK);
10087 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10088 *other_arg_clone = SocketDescriptor_clone(other_arg);
10089 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10090 CHECK(obj != NULL);
10091 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
10092 if ((*env)->ExceptionCheck(env)) {
10093 (*env)->ExceptionDescribe(env);
10094 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
10096 if (get_jenv_res == JNI_EDETACHED) {
10097 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10101 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10102 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10104 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10105 if (get_jenv_res == JNI_EDETACHED) {
10106 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10108 DO_ASSERT(get_jenv_res == JNI_OK);
10110 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10111 CHECK(obj != NULL);
10112 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
10113 if ((*env)->ExceptionCheck(env)) {
10114 (*env)->ExceptionDescribe(env);
10115 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
10117 if (get_jenv_res == JNI_EDETACHED) {
10118 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10122 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10123 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10124 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10126 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
10127 jclass c = (*env)->GetObjectClass(env, o);
10129 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10130 atomic_init(&calls->refcnt, 1);
10131 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10132 calls->o = (*env)->NewWeakGlobalRef(env, o);
10133 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
10134 CHECK(calls->send_data_meth != NULL);
10135 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
10136 CHECK(calls->disconnect_socket_meth != NULL);
10137 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
10138 CHECK(calls->eq_meth != NULL);
10139 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
10140 CHECK(calls->hash_meth != NULL);
10142 LDKSocketDescriptor ret = {
10143 .this_arg = (void*) calls,
10144 .send_data = send_data_LDKSocketDescriptor_jcall,
10145 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10146 .eq = eq_LDKSocketDescriptor_jcall,
10147 .hash = hash_LDKSocketDescriptor_jcall,
10148 .cloned = LDKSocketDescriptor_JCalls_cloned,
10149 .free = LDKSocketDescriptor_JCalls_free,
10153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
10154 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10155 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
10156 return (uint64_t)res_ptr;
10158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
10159 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
10160 LDKu8slice data_ref;
10161 data_ref.datalen = (*env)->GetArrayLength(env, data);
10162 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
10163 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10164 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
10168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
10169 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
10170 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
10174 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
10175 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
10179 typedef struct LDKScore_JCalls {
10180 atomic_size_t refcnt;
10183 jmethodID channel_penalty_msat_meth;
10185 static void LDKScore_JCalls_free(void* this_arg) {
10186 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10187 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10189 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10190 if (get_jenv_res == JNI_EDETACHED) {
10191 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10193 DO_ASSERT(get_jenv_res == JNI_OK);
10195 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10196 if (get_jenv_res == JNI_EDETACHED) {
10197 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10202 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) {
10203 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10205 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10206 if (get_jenv_res == JNI_EDETACHED) {
10207 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10209 DO_ASSERT(get_jenv_res == JNI_OK);
10211 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10212 CHECK(obj != NULL);
10213 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id);
10214 if ((*env)->ExceptionCheck(env)) {
10215 (*env)->ExceptionDescribe(env);
10216 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10218 if (get_jenv_res == JNI_EDETACHED) {
10219 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10223 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10224 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10225 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10227 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10228 jclass c = (*env)->GetObjectClass(env, o);
10230 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10231 atomic_init(&calls->refcnt, 1);
10232 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10233 calls->o = (*env)->NewWeakGlobalRef(env, o);
10234 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(J)J");
10235 CHECK(calls->channel_penalty_msat_meth != NULL);
10238 .this_arg = (void*) calls,
10239 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10240 .free = LDKScore_JCalls_free,
10244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10245 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10246 *res_ptr = LDKScore_init(env, clz, o);
10247 return (uint64_t)res_ptr;
10249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
10250 LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1);
10251 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id);
10255 typedef struct LDKChannelManagerPersister_JCalls {
10256 atomic_size_t refcnt;
10259 jmethodID persist_manager_meth;
10260 } LDKChannelManagerPersister_JCalls;
10261 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
10262 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10263 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10265 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10266 if (get_jenv_res == JNI_EDETACHED) {
10267 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10269 DO_ASSERT(get_jenv_res == JNI_OK);
10271 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10272 if (get_jenv_res == JNI_EDETACHED) {
10273 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10278 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10279 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10282 if (get_jenv_res == JNI_EDETACHED) {
10283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10285 DO_ASSERT(get_jenv_res == JNI_OK);
10287 LDKChannelManager channel_manager_var = *channel_manager;
10288 // Warning: we may need a move here but no clone is available for LDKChannelManager
10289 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10290 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10291 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
10292 if (channel_manager_var.is_owned) {
10293 channel_manager_ref |= 1;
10295 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10296 CHECK(obj != NULL);
10297 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10298 if ((*env)->ExceptionCheck(env)) {
10299 (*env)->ExceptionDescribe(env);
10300 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
10302 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
10303 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
10304 if (get_jenv_res == JNI_EDETACHED) {
10305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10309 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
10310 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
10311 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10313 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
10314 jclass c = (*env)->GetObjectClass(env, o);
10316 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
10317 atomic_init(&calls->refcnt, 1);
10318 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10319 calls->o = (*env)->NewWeakGlobalRef(env, o);
10320 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10321 CHECK(calls->persist_manager_meth != NULL);
10323 LDKChannelManagerPersister ret = {
10324 .this_arg = (void*) calls,
10325 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
10326 .free = LDKChannelManagerPersister_JCalls_free,
10330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10331 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
10332 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
10333 return (uint64_t)res_ptr;
10335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10336 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
10337 LDKChannelManager channel_manager_conv;
10338 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10339 channel_manager_conv.is_owned = false;
10340 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10341 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10342 return (uint64_t)ret_conv;
10345 static jclass LDKFallback_SegWitProgram_class = NULL;
10346 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
10347 static jclass LDKFallback_PubKeyHash_class = NULL;
10348 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
10349 static jclass LDKFallback_ScriptHash_class = NULL;
10350 static jmethodID LDKFallback_ScriptHash_meth = NULL;
10351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
10352 LDKFallback_SegWitProgram_class =
10353 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
10354 CHECK(LDKFallback_SegWitProgram_class != NULL);
10355 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
10356 CHECK(LDKFallback_SegWitProgram_meth != NULL);
10357 LDKFallback_PubKeyHash_class =
10358 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
10359 CHECK(LDKFallback_PubKeyHash_class != NULL);
10360 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
10361 CHECK(LDKFallback_PubKeyHash_meth != NULL);
10362 LDKFallback_ScriptHash_class =
10363 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
10364 CHECK(LDKFallback_ScriptHash_class != NULL);
10365 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
10366 CHECK(LDKFallback_ScriptHash_meth != NULL);
10368 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10369 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10371 case LDKFallback_SegWitProgram: {
10372 uint8_t version_val = obj->seg_wit_program.version._0;
10373 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10374 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
10375 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
10376 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
10378 case LDKFallback_PubKeyHash: {
10379 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
10380 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
10381 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
10383 case LDKFallback_ScriptHash: {
10384 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
10385 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
10386 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
10391 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10392 LDKStr ret_str = _ldk_get_compiled_version();
10393 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10398 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10399 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10400 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10406 LDKTransaction _res_ref;
10407 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10408 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10409 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10410 _res_ref.data_is_owned = true;
10411 Transaction_free(_res_ref);
10414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
10415 LDKCVec_u8Z script_pubkey_ref;
10416 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10417 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10418 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
10419 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10420 *ret_ref = TxOut_new(script_pubkey_ref, value);
10421 return (uint64_t)ret_ref;
10424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
10425 if ((_res & 1) != 0) return;
10426 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
10428 TxOut_free(_res_conv);
10431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10432 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10433 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10434 *ret_ref = TxOut_clone(orig_conv);
10435 return (uint64_t)ret_ref;
10438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
10439 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10444 LDKSecretKey o_ref;
10445 CHECK((*env)->GetArrayLength(env, o) == 32);
10446 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
10447 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10448 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10449 return (uint64_t)ret_conv;
10452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10453 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10454 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10455 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10456 return (uint64_t)ret_conv;
10459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10460 if ((_res & 1) != 0) return;
10461 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
10463 CResult_SecretKeyErrorZ_free(_res_conv);
10466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10467 LDKPublicKey o_ref;
10468 CHECK((*env)->GetArrayLength(env, o) == 33);
10469 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
10470 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10471 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10472 return (uint64_t)ret_conv;
10475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10476 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10477 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10478 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10479 return (uint64_t)ret_conv;
10482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10483 if ((_res & 1) != 0) return;
10484 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
10486 CResult_PublicKeyErrorZ_free(_res_conv);
10489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10490 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10491 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10492 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10493 return (uint64_t)ret_conv;
10496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10497 LDKTxCreationKeys o_conv;
10498 o_conv.inner = (void*)(o & (~1));
10499 o_conv.is_owned = (o & 1) || (o == 0);
10500 o_conv = TxCreationKeys_clone(&o_conv);
10501 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10502 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10503 return (uint64_t)ret_conv;
10506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10507 LDKDecodeError e_conv;
10508 e_conv.inner = (void*)(e & (~1));
10509 e_conv.is_owned = (e & 1) || (e == 0);
10510 e_conv = DecodeError_clone(&e_conv);
10511 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10512 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10513 return (uint64_t)ret_conv;
10516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10517 if ((_res & 1) != 0) return;
10518 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10520 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10524 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10525 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10526 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10527 return (uint64_t)ret_conv;
10530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10531 LDKChannelPublicKeys o_conv;
10532 o_conv.inner = (void*)(o & (~1));
10533 o_conv.is_owned = (o & 1) || (o == 0);
10534 o_conv = ChannelPublicKeys_clone(&o_conv);
10535 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10536 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10537 return (uint64_t)ret_conv;
10540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10541 LDKDecodeError e_conv;
10542 e_conv.inner = (void*)(e & (~1));
10543 e_conv.is_owned = (e & 1) || (e == 0);
10544 e_conv = DecodeError_clone(&e_conv);
10545 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10546 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10547 return (uint64_t)ret_conv;
10550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10551 if ((_res & 1) != 0) return;
10552 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10554 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10558 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10559 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10560 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10561 return (uint64_t)ret_conv;
10564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10565 LDKTxCreationKeys o_conv;
10566 o_conv.inner = (void*)(o & (~1));
10567 o_conv.is_owned = (o & 1) || (o == 0);
10568 o_conv = TxCreationKeys_clone(&o_conv);
10569 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10570 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10571 return (uint64_t)ret_conv;
10574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10575 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10576 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10577 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10578 return (uint64_t)ret_conv;
10581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10582 if ((_res & 1) != 0) return;
10583 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
10585 CResult_TxCreationKeysErrorZ_free(_res_conv);
10588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10589 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10590 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10591 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10592 return (uint64_t)ret_conv;
10595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
10596 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10597 *ret_copy = COption_u32Z_some(o);
10598 uint64_t ret_ref = (uint64_t)ret_copy;
10602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
10603 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10604 *ret_copy = COption_u32Z_none();
10605 uint64_t ret_ref = (uint64_t)ret_copy;
10609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10610 if ((_res & 1) != 0) return;
10611 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
10613 COption_u32Z_free(_res_conv);
10616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10617 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10618 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10619 *ret_copy = COption_u32Z_clone(orig_conv);
10620 uint64_t ret_ref = (uint64_t)ret_copy;
10624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10625 LDKHTLCOutputInCommitment o_conv;
10626 o_conv.inner = (void*)(o & (~1));
10627 o_conv.is_owned = (o & 1) || (o == 0);
10628 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10629 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10630 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10631 return (uint64_t)ret_conv;
10634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10635 LDKDecodeError e_conv;
10636 e_conv.inner = (void*)(e & (~1));
10637 e_conv.is_owned = (e & 1) || (e == 0);
10638 e_conv = DecodeError_clone(&e_conv);
10639 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10640 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10641 return (uint64_t)ret_conv;
10644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10645 if ((_res & 1) != 0) return;
10646 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
10648 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10652 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10653 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10654 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10655 return (uint64_t)ret_conv;
10658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10659 LDKCounterpartyChannelTransactionParameters o_conv;
10660 o_conv.inner = (void*)(o & (~1));
10661 o_conv.is_owned = (o & 1) || (o == 0);
10662 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10663 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10664 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10665 return (uint64_t)ret_conv;
10668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10669 LDKDecodeError e_conv;
10670 e_conv.inner = (void*)(e & (~1));
10671 e_conv.is_owned = (e & 1) || (e == 0);
10672 e_conv = DecodeError_clone(&e_conv);
10673 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10674 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10675 return (uint64_t)ret_conv;
10678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10679 if ((_res & 1) != 0) return;
10680 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10682 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10686 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10687 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10688 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10689 return (uint64_t)ret_conv;
10692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10693 LDKChannelTransactionParameters o_conv;
10694 o_conv.inner = (void*)(o & (~1));
10695 o_conv.is_owned = (o & 1) || (o == 0);
10696 o_conv = ChannelTransactionParameters_clone(&o_conv);
10697 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10698 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10699 return (uint64_t)ret_conv;
10702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10703 LDKDecodeError e_conv;
10704 e_conv.inner = (void*)(e & (~1));
10705 e_conv.is_owned = (e & 1) || (e == 0);
10706 e_conv = DecodeError_clone(&e_conv);
10707 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10708 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10709 return (uint64_t)ret_conv;
10712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10713 if ((_res & 1) != 0) return;
10714 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10716 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10720 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10721 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10722 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10723 return (uint64_t)ret_conv;
10726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10727 LDKCVec_SignatureZ _res_constr;
10728 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10729 if (_res_constr.datalen > 0)
10730 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10732 _res_constr.data = NULL;
10733 for (size_t i = 0; i < _res_constr.datalen; i++) {
10734 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10735 LDKSignature _res_conv_8_ref;
10736 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
10737 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
10738 _res_constr.data[i] = _res_conv_8_ref;
10740 CVec_SignatureZ_free(_res_constr);
10743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10744 LDKHolderCommitmentTransaction o_conv;
10745 o_conv.inner = (void*)(o & (~1));
10746 o_conv.is_owned = (o & 1) || (o == 0);
10747 o_conv = HolderCommitmentTransaction_clone(&o_conv);
10748 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10749 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10750 return (uint64_t)ret_conv;
10753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10754 LDKDecodeError e_conv;
10755 e_conv.inner = (void*)(e & (~1));
10756 e_conv.is_owned = (e & 1) || (e == 0);
10757 e_conv = DecodeError_clone(&e_conv);
10758 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10759 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10760 return (uint64_t)ret_conv;
10763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10764 if ((_res & 1) != 0) return;
10765 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10767 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10771 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10772 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10773 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10774 return (uint64_t)ret_conv;
10777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10778 LDKBuiltCommitmentTransaction o_conv;
10779 o_conv.inner = (void*)(o & (~1));
10780 o_conv.is_owned = (o & 1) || (o == 0);
10781 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10782 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10783 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10784 return (uint64_t)ret_conv;
10787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10788 LDKDecodeError e_conv;
10789 e_conv.inner = (void*)(e & (~1));
10790 e_conv.is_owned = (e & 1) || (e == 0);
10791 e_conv = DecodeError_clone(&e_conv);
10792 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10793 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10794 return (uint64_t)ret_conv;
10797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10798 if ((_res & 1) != 0) return;
10799 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10801 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10805 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10806 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10807 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10808 return (uint64_t)ret_conv;
10811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10812 LDKTrustedClosingTransaction o_conv;
10813 o_conv.inner = (void*)(o & (~1));
10814 o_conv.is_owned = (o & 1) || (o == 0);
10815 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
10816 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10817 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10818 return (uint64_t)ret_conv;
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10822 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10823 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10824 return (uint64_t)ret_conv;
10827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10828 if ((_res & 1) != 0) return;
10829 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
10831 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10835 LDKCommitmentTransaction o_conv;
10836 o_conv.inner = (void*)(o & (~1));
10837 o_conv.is_owned = (o & 1) || (o == 0);
10838 o_conv = CommitmentTransaction_clone(&o_conv);
10839 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10840 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10841 return (uint64_t)ret_conv;
10844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10845 LDKDecodeError e_conv;
10846 e_conv.inner = (void*)(e & (~1));
10847 e_conv.is_owned = (e & 1) || (e == 0);
10848 e_conv = DecodeError_clone(&e_conv);
10849 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10850 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10851 return (uint64_t)ret_conv;
10854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10855 if ((_res & 1) != 0) return;
10856 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10858 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10862 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
10863 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10864 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10865 return (uint64_t)ret_conv;
10868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10869 LDKTrustedCommitmentTransaction o_conv;
10870 o_conv.inner = (void*)(o & (~1));
10871 o_conv.is_owned = (o & 1) || (o == 0);
10872 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10873 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10874 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10875 return (uint64_t)ret_conv;
10878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10879 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10880 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10881 return (uint64_t)ret_conv;
10884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10885 if ((_res & 1) != 0) return;
10886 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
10888 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10892 LDKCVec_SignatureZ o_constr;
10893 o_constr.datalen = (*env)->GetArrayLength(env, o);
10894 if (o_constr.datalen > 0)
10895 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10897 o_constr.data = NULL;
10898 for (size_t i = 0; i < o_constr.datalen; i++) {
10899 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10900 LDKSignature o_conv_8_ref;
10901 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
10902 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
10903 o_constr.data[i] = o_conv_8_ref;
10905 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10906 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10907 return (uint64_t)ret_conv;
10910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
10911 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10912 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
10913 return (uint64_t)ret_conv;
10916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10917 if ((_res & 1) != 0) return;
10918 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
10920 CResult_CVec_SignatureZNoneZ_free(_res_conv);
10923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10924 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
10925 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10926 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
10927 return (uint64_t)ret_conv;
10930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10931 LDKShutdownScript o_conv;
10932 o_conv.inner = (void*)(o & (~1));
10933 o_conv.is_owned = (o & 1) || (o == 0);
10934 o_conv = ShutdownScript_clone(&o_conv);
10935 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10936 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
10937 return (uint64_t)ret_conv;
10940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10941 LDKDecodeError e_conv;
10942 e_conv.inner = (void*)(e & (~1));
10943 e_conv.is_owned = (e & 1) || (e == 0);
10944 e_conv = DecodeError_clone(&e_conv);
10945 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10946 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
10947 return (uint64_t)ret_conv;
10950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10951 if ((_res & 1) != 0) return;
10952 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
10954 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
10957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10958 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
10959 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10960 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
10961 return (uint64_t)ret_conv;
10964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10965 LDKShutdownScript o_conv;
10966 o_conv.inner = (void*)(o & (~1));
10967 o_conv.is_owned = (o & 1) || (o == 0);
10968 o_conv = ShutdownScript_clone(&o_conv);
10969 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10970 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
10971 return (uint64_t)ret_conv;
10974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10975 LDKInvalidShutdownScript e_conv;
10976 e_conv.inner = (void*)(e & (~1));
10977 e_conv.is_owned = (e & 1) || (e == 0);
10978 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
10979 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10980 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
10981 return (uint64_t)ret_conv;
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10985 if ((_res & 1) != 0) return;
10986 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
10988 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
10991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
10992 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10993 *ret_conv = CResult_NoneErrorZ_ok();
10994 return (uint64_t)ret_conv;
10997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10998 LDKIOError e_conv = LDKIOError_from_java(env, e);
10999 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11000 *ret_conv = CResult_NoneErrorZ_err(e_conv);
11001 return (uint64_t)ret_conv;
11004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11005 if ((_res & 1) != 0) return;
11006 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
11008 CResult_NoneErrorZ_free(_res_conv);
11011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11012 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
11013 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11014 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
11015 return (uint64_t)ret_conv;
11018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11019 LDKRouteHop o_conv;
11020 o_conv.inner = (void*)(o & (~1));
11021 o_conv.is_owned = (o & 1) || (o == 0);
11022 o_conv = RouteHop_clone(&o_conv);
11023 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11024 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11025 return (uint64_t)ret_conv;
11028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11029 LDKDecodeError e_conv;
11030 e_conv.inner = (void*)(e & (~1));
11031 e_conv.is_owned = (e & 1) || (e == 0);
11032 e_conv = DecodeError_clone(&e_conv);
11033 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11034 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11035 return (uint64_t)ret_conv;
11038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11039 if ((_res & 1) != 0) return;
11040 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
11042 CResult_RouteHopDecodeErrorZ_free(_res_conv);
11045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11046 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
11047 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11048 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11049 return (uint64_t)ret_conv;
11052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11053 LDKCVec_RouteHopZ _res_constr;
11054 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11055 if (_res_constr.datalen > 0)
11056 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11058 _res_constr.data = NULL;
11059 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11060 for (size_t k = 0; k < _res_constr.datalen; k++) {
11061 int64_t _res_conv_10 = _res_vals[k];
11062 LDKRouteHop _res_conv_10_conv;
11063 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
11064 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
11065 _res_constr.data[k] = _res_conv_10_conv;
11067 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11068 CVec_RouteHopZ_free(_res_constr);
11071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11072 LDKCVec_CVec_RouteHopZZ _res_constr;
11073 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11074 if (_res_constr.datalen > 0)
11075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11077 _res_constr.data = NULL;
11078 for (size_t m = 0; m < _res_constr.datalen; m++) {
11079 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
11080 LDKCVec_RouteHopZ _res_conv_12_constr;
11081 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
11082 if (_res_conv_12_constr.datalen > 0)
11083 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11085 _res_conv_12_constr.data = NULL;
11086 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
11087 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11088 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11089 LDKRouteHop _res_conv_12_conv_10_conv;
11090 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
11091 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
11092 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11094 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
11095 _res_constr.data[m] = _res_conv_12_constr;
11097 CVec_CVec_RouteHopZZ_free(_res_constr);
11100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11102 o_conv.inner = (void*)(o & (~1));
11103 o_conv.is_owned = (o & 1) || (o == 0);
11104 o_conv = Route_clone(&o_conv);
11105 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11106 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11107 return (uint64_t)ret_conv;
11110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11111 LDKDecodeError e_conv;
11112 e_conv.inner = (void*)(e & (~1));
11113 e_conv.is_owned = (e & 1) || (e == 0);
11114 e_conv = DecodeError_clone(&e_conv);
11115 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11116 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11117 return (uint64_t)ret_conv;
11120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11121 if ((_res & 1) != 0) return;
11122 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
11124 CResult_RouteDecodeErrorZ_free(_res_conv);
11127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11128 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
11129 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11130 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11131 return (uint64_t)ret_conv;
11134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
11135 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11136 *ret_copy = COption_u64Z_some(o);
11137 uint64_t ret_ref = (uint64_t)ret_copy;
11141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
11142 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11143 *ret_copy = COption_u64Z_none();
11144 uint64_t ret_ref = (uint64_t)ret_copy;
11148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11149 if ((_res & 1) != 0) return;
11150 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
11152 COption_u64Z_free(_res_conv);
11155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11156 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11157 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11158 *ret_copy = COption_u64Z_clone(orig_conv);
11159 uint64_t ret_ref = (uint64_t)ret_copy;
11163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11164 LDKCVec_ChannelDetailsZ _res_constr;
11165 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11166 if (_res_constr.datalen > 0)
11167 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11169 _res_constr.data = NULL;
11170 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11171 for (size_t q = 0; q < _res_constr.datalen; q++) {
11172 int64_t _res_conv_16 = _res_vals[q];
11173 LDKChannelDetails _res_conv_16_conv;
11174 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11175 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11176 _res_constr.data[q] = _res_conv_16_conv;
11178 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11179 CVec_ChannelDetailsZ_free(_res_constr);
11182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11183 LDKCVec_RouteHintZ _res_constr;
11184 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11185 if (_res_constr.datalen > 0)
11186 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11188 _res_constr.data = NULL;
11189 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11190 for (size_t l = 0; l < _res_constr.datalen; l++) {
11191 int64_t _res_conv_11 = _res_vals[l];
11192 LDKRouteHint _res_conv_11_conv;
11193 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11194 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11195 _res_constr.data[l] = _res_conv_11_conv;
11197 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11198 CVec_RouteHintZ_free(_res_constr);
11201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11203 o_conv.inner = (void*)(o & (~1));
11204 o_conv.is_owned = (o & 1) || (o == 0);
11205 o_conv = Route_clone(&o_conv);
11206 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11207 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11208 return (uint64_t)ret_conv;
11211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11212 LDKLightningError e_conv;
11213 e_conv.inner = (void*)(e & (~1));
11214 e_conv.is_owned = (e & 1) || (e == 0);
11215 e_conv = LightningError_clone(&e_conv);
11216 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11217 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11218 return (uint64_t)ret_conv;
11221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11222 if ((_res & 1) != 0) return;
11223 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
11225 CResult_RouteLightningErrorZ_free(_res_conv);
11228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11229 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11230 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11231 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11232 return (uint64_t)ret_conv;
11235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11236 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
11237 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11238 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11239 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11240 return (uint64_t)ret_conv;
11243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11244 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
11245 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11246 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11247 return (uint64_t)ret_conv;
11250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11251 if ((_res & 1) != 0) return;
11252 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
11254 CResult_TxOutAccessErrorZ_free(_res_conv);
11257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11258 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11259 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11260 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11261 return (uint64_t)ret_conv;
11264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11265 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
11266 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11267 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
11268 return ((uint64_t)ret_conv);
11271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11272 LDKTransaction b_ref;
11273 b_ref.datalen = (*env)->GetArrayLength(env, b);
11274 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
11275 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11276 b_ref.data_is_owned = true;
11277 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11278 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
11279 return ((uint64_t)ret_conv);
11282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11283 if ((_res & 1) != 0) return;
11284 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
11286 C2Tuple_usizeTransactionZ_free(_res_conv);
11289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11290 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
11291 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11292 if (_res_constr.datalen > 0)
11293 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11295 _res_constr.data = NULL;
11296 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11297 for (size_t c = 0; c < _res_constr.datalen; c++) {
11298 int64_t _res_conv_28 = _res_vals[c];
11299 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_28) & ~1);
11300 FREE((void*)_res_conv_28);
11301 _res_constr.data[c] = _res_conv_28_conv;
11303 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11304 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
11307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11308 LDKCVec_TxidZ _res_constr;
11309 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11310 if (_res_constr.datalen > 0)
11311 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11313 _res_constr.data = NULL;
11314 for (size_t i = 0; i < _res_constr.datalen; i++) {
11315 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11316 LDKThirtyTwoBytes _res_conv_8_ref;
11317 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
11318 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
11319 _res_constr.data[i] = _res_conv_8_ref;
11321 CVec_TxidZ_free(_res_constr);
11324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
11325 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11326 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11327 return (uint64_t)ret_conv;
11330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
11331 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
11332 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11333 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11334 return (uint64_t)ret_conv;
11337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11338 if ((_res & 1) != 0) return;
11339 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
11341 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11345 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11346 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11347 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11348 return (uint64_t)ret_conv;
11351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11352 LDKCVec_MonitorEventZ _res_constr;
11353 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11354 if (_res_constr.datalen > 0)
11355 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
11357 _res_constr.data = NULL;
11358 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11359 for (size_t o = 0; o < _res_constr.datalen; o++) {
11360 int64_t _res_conv_14 = _res_vals[o];
11361 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
11362 FREE((void*)_res_conv_14);
11363 _res_constr.data[o] = _res_conv_14_conv;
11365 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11366 CVec_MonitorEventZ_free(_res_constr);
11369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11370 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
11371 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11372 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11373 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11374 uint64_t ret_ref = (uint64_t)ret_copy;
11378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
11379 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11380 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11381 uint64_t ret_ref = (uint64_t)ret_copy;
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11386 if ((_res & 1) != 0) return;
11387 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
11389 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11393 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11394 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11395 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11396 uint64_t ret_ref = (uint64_t)ret_copy;
11400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11401 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
11402 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
11403 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11404 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11405 uint64_t ret_ref = (uint64_t)ret_copy;
11409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
11410 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11411 *ret_copy = COption_NetworkUpdateZ_none();
11412 uint64_t ret_ref = (uint64_t)ret_copy;
11416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11417 if ((_res & 1) != 0) return;
11418 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
11420 COption_NetworkUpdateZ_free(_res_conv);
11423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11424 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
11425 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11426 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11427 uint64_t ret_ref = (uint64_t)ret_copy;
11431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11432 LDKCVec_SpendableOutputDescriptorZ _res_constr;
11433 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11434 if (_res_constr.datalen > 0)
11435 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11437 _res_constr.data = NULL;
11438 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11439 for (size_t b = 0; b < _res_constr.datalen; b++) {
11440 int64_t _res_conv_27 = _res_vals[b];
11441 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
11442 FREE((void*)_res_conv_27);
11443 _res_constr.data[b] = _res_conv_27_conv;
11445 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11446 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11450 LDKCVec_MessageSendEventZ _res_constr;
11451 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11452 if (_res_constr.datalen > 0)
11453 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11455 _res_constr.data = NULL;
11456 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11457 for (size_t s = 0; s < _res_constr.datalen; s++) {
11458 int64_t _res_conv_18 = _res_vals[s];
11459 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
11460 FREE((void*)_res_conv_18);
11461 _res_constr.data[s] = _res_conv_18_conv;
11463 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11464 CVec_MessageSendEventZ_free(_res_constr);
11467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11468 LDKInitFeatures o_conv;
11469 o_conv.inner = (void*)(o & (~1));
11470 o_conv.is_owned = (o & 1) || (o == 0);
11471 o_conv = InitFeatures_clone(&o_conv);
11472 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11473 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
11474 return (uint64_t)ret_conv;
11477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11478 LDKDecodeError e_conv;
11479 e_conv.inner = (void*)(e & (~1));
11480 e_conv.is_owned = (e & 1) || (e == 0);
11481 e_conv = DecodeError_clone(&e_conv);
11482 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11483 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
11484 return (uint64_t)ret_conv;
11487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11488 if ((_res & 1) != 0) return;
11489 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11491 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
11494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11495 LDKNodeFeatures o_conv;
11496 o_conv.inner = (void*)(o & (~1));
11497 o_conv.is_owned = (o & 1) || (o == 0);
11498 o_conv = NodeFeatures_clone(&o_conv);
11499 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11500 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
11501 return (uint64_t)ret_conv;
11504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11505 LDKDecodeError e_conv;
11506 e_conv.inner = (void*)(e & (~1));
11507 e_conv.is_owned = (e & 1) || (e == 0);
11508 e_conv = DecodeError_clone(&e_conv);
11509 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11510 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
11511 return (uint64_t)ret_conv;
11514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11515 if ((_res & 1) != 0) return;
11516 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11518 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
11521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11522 LDKChannelFeatures o_conv;
11523 o_conv.inner = (void*)(o & (~1));
11524 o_conv.is_owned = (o & 1) || (o == 0);
11525 o_conv = ChannelFeatures_clone(&o_conv);
11526 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11527 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
11528 return (uint64_t)ret_conv;
11531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11532 LDKDecodeError e_conv;
11533 e_conv.inner = (void*)(e & (~1));
11534 e_conv.is_owned = (e & 1) || (e == 0);
11535 e_conv = DecodeError_clone(&e_conv);
11536 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11537 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
11538 return (uint64_t)ret_conv;
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11542 if ((_res & 1) != 0) return;
11543 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11545 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11549 LDKInvoiceFeatures o_conv;
11550 o_conv.inner = (void*)(o & (~1));
11551 o_conv.is_owned = (o & 1) || (o == 0);
11552 o_conv = InvoiceFeatures_clone(&o_conv);
11553 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11554 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
11555 return (uint64_t)ret_conv;
11558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11559 LDKDecodeError e_conv;
11560 e_conv.inner = (void*)(e & (~1));
11561 e_conv.is_owned = (e & 1) || (e == 0);
11562 e_conv = DecodeError_clone(&e_conv);
11563 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11564 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
11565 return (uint64_t)ret_conv;
11568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11569 if ((_res & 1) != 0) return;
11570 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11572 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
11575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11576 LDKDelayedPaymentOutputDescriptor o_conv;
11577 o_conv.inner = (void*)(o & (~1));
11578 o_conv.is_owned = (o & 1) || (o == 0);
11579 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
11580 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11581 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11582 return (uint64_t)ret_conv;
11585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11586 LDKDecodeError e_conv;
11587 e_conv.inner = (void*)(e & (~1));
11588 e_conv.is_owned = (e & 1) || (e == 0);
11589 e_conv = DecodeError_clone(&e_conv);
11590 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11591 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11592 return (uint64_t)ret_conv;
11595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11596 if ((_res & 1) != 0) return;
11597 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11599 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11603 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11604 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11605 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11606 return (uint64_t)ret_conv;
11609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11610 LDKStaticPaymentOutputDescriptor o_conv;
11611 o_conv.inner = (void*)(o & (~1));
11612 o_conv.is_owned = (o & 1) || (o == 0);
11613 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
11614 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11615 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11616 return (uint64_t)ret_conv;
11619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11620 LDKDecodeError e_conv;
11621 e_conv.inner = (void*)(e & (~1));
11622 e_conv.is_owned = (e & 1) || (e == 0);
11623 e_conv = DecodeError_clone(&e_conv);
11624 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11625 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11626 return (uint64_t)ret_conv;
11629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11630 if ((_res & 1) != 0) return;
11631 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11633 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11637 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11638 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11639 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11640 return (uint64_t)ret_conv;
11643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11644 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
11645 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
11646 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11647 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
11648 return (uint64_t)ret_conv;
11651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11652 LDKDecodeError e_conv;
11653 e_conv.inner = (void*)(e & (~1));
11654 e_conv.is_owned = (e & 1) || (e == 0);
11655 e_conv = DecodeError_clone(&e_conv);
11656 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11657 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
11658 return (uint64_t)ret_conv;
11661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11662 if ((_res & 1) != 0) return;
11663 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11665 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
11668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11669 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
11670 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11671 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
11672 return (uint64_t)ret_conv;
11675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
11676 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11677 *ret_conv = CResult_NoneNoneZ_ok();
11678 return (uint64_t)ret_conv;
11681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
11682 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11683 *ret_conv = CResult_NoneNoneZ_err();
11684 return (uint64_t)ret_conv;
11687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11688 if ((_res & 1) != 0) return;
11689 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
11691 CResult_NoneNoneZ_free(_res_conv);
11694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11695 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11696 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11697 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11698 return (uint64_t)ret_conv;
11701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11702 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
11703 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11704 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
11705 return ((uint64_t)ret_conv);
11708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
11709 LDKSignature a_ref;
11710 CHECK((*env)->GetArrayLength(env, a) == 64);
11711 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
11712 LDKCVec_SignatureZ b_constr;
11713 b_constr.datalen = (*env)->GetArrayLength(env, b);
11714 if (b_constr.datalen > 0)
11715 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11717 b_constr.data = NULL;
11718 for (size_t i = 0; i < b_constr.datalen; i++) {
11719 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
11720 LDKSignature b_conv_8_ref;
11721 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
11722 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
11723 b_constr.data[i] = b_conv_8_ref;
11725 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11726 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
11727 return ((uint64_t)ret_conv);
11730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11731 if ((_res & 1) != 0) return;
11732 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
11734 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
11737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11738 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
11739 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
11740 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11741 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
11742 return (uint64_t)ret_conv;
11745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
11746 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11747 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
11748 return (uint64_t)ret_conv;
11751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11752 if ((_res & 1) != 0) return;
11753 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
11755 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
11758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11759 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
11760 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11761 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
11762 return (uint64_t)ret_conv;
11765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11766 LDKSignature o_ref;
11767 CHECK((*env)->GetArrayLength(env, o) == 64);
11768 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
11769 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11770 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
11771 return (uint64_t)ret_conv;
11774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11775 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11776 *ret_conv = CResult_SignatureNoneZ_err();
11777 return (uint64_t)ret_conv;
11780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11781 if ((_res & 1) != 0) return;
11782 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
11784 CResult_SignatureNoneZ_free(_res_conv);
11787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11788 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
11789 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11790 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
11791 return (uint64_t)ret_conv;
11794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11795 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
11796 if (o_conv.free == LDKSign_JCalls_free) {
11797 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11798 LDKSign_JCalls_cloned(&o_conv);
11800 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11801 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
11802 return (uint64_t)ret_conv;
11805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11806 LDKDecodeError e_conv;
11807 e_conv.inner = (void*)(e & (~1));
11808 e_conv.is_owned = (e & 1) || (e == 0);
11809 e_conv = DecodeError_clone(&e_conv);
11810 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11811 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
11812 return (uint64_t)ret_conv;
11815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11816 if ((_res & 1) != 0) return;
11817 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
11819 CResult_SignDecodeErrorZ_free(_res_conv);
11822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11823 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
11824 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11825 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
11826 return (uint64_t)ret_conv;
11829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11830 LDKCVec_u8Z _res_ref;
11831 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11832 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11833 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11834 CVec_u8Z_free(_res_ref);
11837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
11838 LDKRecoverableSignature arg_ref;
11839 CHECK((*env)->GetArrayLength(env, arg) == 68);
11840 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
11841 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11842 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
11843 return (uint64_t)ret_conv;
11846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11847 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11848 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
11849 return (uint64_t)ret_conv;
11852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11853 if ((_res & 1) != 0) return;
11854 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
11856 CResult_RecoverableSignatureNoneZ_free(_res_conv);
11859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11860 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
11861 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11862 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
11863 return (uint64_t)ret_conv;
11866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11867 LDKCVec_CVec_u8ZZ _res_constr;
11868 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11869 if (_res_constr.datalen > 0)
11870 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11872 _res_constr.data = NULL;
11873 for (size_t i = 0; i < _res_constr.datalen; i++) {
11874 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11875 LDKCVec_u8Z _res_conv_8_ref;
11876 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11877 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11878 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11879 _res_constr.data[i] = _res_conv_8_ref;
11881 CVec_CVec_u8ZZ_free(_res_constr);
11884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
11885 LDKCVec_CVec_u8ZZ o_constr;
11886 o_constr.datalen = (*env)->GetArrayLength(env, o);
11887 if (o_constr.datalen > 0)
11888 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11890 o_constr.data = NULL;
11891 for (size_t i = 0; i < o_constr.datalen; i++) {
11892 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
11893 LDKCVec_u8Z o_conv_8_ref;
11894 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
11895 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11896 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
11897 o_constr.data[i] = o_conv_8_ref;
11899 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11900 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
11901 return (uint64_t)ret_conv;
11904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
11905 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11906 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
11907 return (uint64_t)ret_conv;
11910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11911 if ((_res & 1) != 0) return;
11912 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
11914 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
11917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11918 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
11919 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11920 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
11921 return (uint64_t)ret_conv;
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11925 LDKInMemorySigner o_conv;
11926 o_conv.inner = (void*)(o & (~1));
11927 o_conv.is_owned = (o & 1) || (o == 0);
11928 o_conv = InMemorySigner_clone(&o_conv);
11929 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11930 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
11931 return (uint64_t)ret_conv;
11934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11935 LDKDecodeError e_conv;
11936 e_conv.inner = (void*)(e & (~1));
11937 e_conv.is_owned = (e & 1) || (e == 0);
11938 e_conv = DecodeError_clone(&e_conv);
11939 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11940 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
11941 return (uint64_t)ret_conv;
11944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11945 if ((_res & 1) != 0) return;
11946 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
11948 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
11951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11952 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
11953 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11954 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
11955 return (uint64_t)ret_conv;
11958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11959 LDKCVec_TxOutZ _res_constr;
11960 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11961 if (_res_constr.datalen > 0)
11962 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11964 _res_constr.data = NULL;
11965 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11966 for (size_t h = 0; h < _res_constr.datalen; h++) {
11967 int64_t _res_conv_7 = _res_vals[h];
11968 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
11969 FREE((void*)_res_conv_7);
11970 _res_constr.data[h] = _res_conv_7_conv;
11972 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11973 CVec_TxOutZ_free(_res_constr);
11976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11977 LDKTransaction o_ref;
11978 o_ref.datalen = (*env)->GetArrayLength(env, o);
11979 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
11980 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11981 o_ref.data_is_owned = true;
11982 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11983 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
11984 return (uint64_t)ret_conv;
11987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
11988 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11989 *ret_conv = CResult_TransactionNoneZ_err();
11990 return (uint64_t)ret_conv;
11993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11994 if ((_res & 1) != 0) return;
11995 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
11997 CResult_TransactionNoneZ_free(_res_conv);
12000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12001 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
12002 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
12003 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
12004 return (uint64_t)ret_conv;
12007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12008 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
12009 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12010 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
12011 return ((uint64_t)ret_conv);
12014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12015 LDKThirtyTwoBytes a_ref;
12016 CHECK((*env)->GetArrayLength(env, a) == 32);
12017 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12018 LDKChannelMonitor b_conv;
12019 b_conv.inner = (void*)(b & (~1));
12020 b_conv.is_owned = (b & 1) || (b == 0);
12021 b_conv = ChannelMonitor_clone(&b_conv);
12022 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12023 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
12024 return ((uint64_t)ret_conv);
12027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12028 if ((_res & 1) != 0) return;
12029 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
12031 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
12034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12035 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
12036 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12037 if (_res_constr.datalen > 0)
12038 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
12040 _res_constr.data = NULL;
12041 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12042 for (size_t j = 0; j < _res_constr.datalen; j++) {
12043 int64_t _res_conv_35 = _res_vals[j];
12044 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_35) & ~1);
12045 FREE((void*)_res_conv_35);
12046 _res_constr.data[j] = _res_conv_35_conv;
12048 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12049 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
12052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
12053 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
12054 o_constr.datalen = (*env)->GetArrayLength(env, o);
12055 if (o_constr.datalen > 0)
12056 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
12058 o_constr.data = NULL;
12059 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
12060 for (size_t j = 0; j < o_constr.datalen; j++) {
12061 int64_t o_conv_35 = o_vals[j];
12062 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1);
12063 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
12064 o_constr.data[j] = o_conv_35_conv;
12066 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
12067 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12068 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
12069 return (uint64_t)ret_conv;
12072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12073 LDKIOError e_conv = LDKIOError_from_java(env, e);
12074 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12075 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
12076 return (uint64_t)ret_conv;
12079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12080 if ((_res & 1) != 0) return;
12081 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
12083 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
12086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12087 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
12088 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12089 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
12090 return (uint64_t)ret_conv;
12093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12094 LDKPaymentId o_conv;
12095 o_conv.inner = (void*)(o & (~1));
12096 o_conv.is_owned = (o & 1) || (o == 0);
12097 o_conv = PaymentId_clone(&o_conv);
12098 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12099 *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv);
12100 return (uint64_t)ret_conv;
12103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12104 LDKDecodeError e_conv;
12105 e_conv.inner = (void*)(e & (~1));
12106 e_conv.is_owned = (e & 1) || (e == 0);
12107 e_conv = DecodeError_clone(&e_conv);
12108 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12109 *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv);
12110 return (uint64_t)ret_conv;
12113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12114 if ((_res & 1) != 0) return;
12115 LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1);
12117 CResult_PaymentIdDecodeErrorZ_free(_res_conv);
12120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12121 LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1);
12122 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12123 *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv);
12124 return (uint64_t)ret_conv;
12127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
12128 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12129 *ret_copy = COption_u16Z_some(o);
12130 uint64_t ret_ref = (uint64_t)ret_copy;
12134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
12135 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12136 *ret_copy = COption_u16Z_none();
12137 uint64_t ret_ref = (uint64_t)ret_copy;
12141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12142 if ((_res & 1) != 0) return;
12143 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
12145 COption_u16Z_free(_res_conv);
12148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12149 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
12150 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12151 *ret_copy = COption_u16Z_clone(orig_conv);
12152 uint64_t ret_ref = (uint64_t)ret_copy;
12156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
12157 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12158 *ret_conv = CResult_NoneAPIErrorZ_ok();
12159 return (uint64_t)ret_conv;
12162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12163 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
12164 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12165 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12166 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
12167 return (uint64_t)ret_conv;
12170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12171 if ((_res & 1) != 0) return;
12172 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
12174 CResult_NoneAPIErrorZ_free(_res_conv);
12177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12178 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
12179 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12180 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
12181 return (uint64_t)ret_conv;
12184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12185 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
12186 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12187 if (_res_constr.datalen > 0)
12188 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
12190 _res_constr.data = NULL;
12191 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12192 for (size_t w = 0; w < _res_constr.datalen; w++) {
12193 int64_t _res_conv_22 = _res_vals[w];
12194 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
12195 FREE((void*)_res_conv_22);
12196 _res_constr.data[w] = _res_conv_22_conv;
12198 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12199 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
12202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12203 LDKCVec_APIErrorZ _res_constr;
12204 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12205 if (_res_constr.datalen > 0)
12206 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
12208 _res_constr.data = NULL;
12209 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12210 for (size_t k = 0; k < _res_constr.datalen; k++) {
12211 int64_t _res_conv_10 = _res_vals[k];
12212 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
12213 FREE((void*)_res_conv_10);
12214 _res_constr.data[k] = _res_conv_10_conv;
12216 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12217 CVec_APIErrorZ_free(_res_constr);
12220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12221 LDKThirtyTwoBytes o_ref;
12222 CHECK((*env)->GetArrayLength(env, o) == 32);
12223 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
12224 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12225 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
12226 return (uint64_t)ret_conv;
12229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12230 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
12231 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12232 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12233 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
12234 return (uint64_t)ret_conv;
12237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12238 if ((_res & 1) != 0) return;
12239 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1);
12241 CResult__u832APIErrorZ_free(_res_conv);
12244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12245 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
12246 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12247 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
12248 return (uint64_t)ret_conv;
12251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12252 LDKPaymentId o_conv;
12253 o_conv.inner = (void*)(o & (~1));
12254 o_conv.is_owned = (o & 1) || (o == 0);
12255 o_conv = PaymentId_clone(&o_conv);
12256 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12257 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv);
12258 return (uint64_t)ret_conv;
12261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12262 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
12263 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12264 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12265 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
12266 return (uint64_t)ret_conv;
12269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12270 if ((_res & 1) != 0) return;
12271 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
12273 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
12276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12277 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
12278 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12279 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
12280 return (uint64_t)ret_conv;
12283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
12284 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12285 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
12286 return (uint64_t)ret_conv;
12289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12290 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
12291 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12292 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12293 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
12294 return (uint64_t)ret_conv;
12297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12298 if ((_res & 1) != 0) return;
12299 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
12301 CResult_NonePaymentSendFailureZ_free(_res_conv);
12304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12305 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
12306 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12307 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
12308 return (uint64_t)ret_conv;
12311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12312 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
12313 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
12314 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
12315 return ((uint64_t)ret_conv);
12318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12319 LDKThirtyTwoBytes a_ref;
12320 CHECK((*env)->GetArrayLength(env, a) == 32);
12321 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12322 LDKPaymentId b_conv;
12323 b_conv.inner = (void*)(b & (~1));
12324 b_conv.is_owned = (b & 1) || (b == 0);
12325 b_conv = PaymentId_clone(&b_conv);
12326 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
12327 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv);
12328 return ((uint64_t)ret_conv);
12331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12332 if ((_res & 1) != 0) return;
12333 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1);
12335 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
12338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12339 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1);
12340 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
12341 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12342 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
12343 return (uint64_t)ret_conv;
12346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12347 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
12348 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12349 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12350 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
12351 return (uint64_t)ret_conv;
12354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12355 if ((_res & 1) != 0) return;
12356 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
12358 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
12361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12362 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
12363 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12364 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
12365 return (uint64_t)ret_conv;
12368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12369 LDKCVec_NetAddressZ _res_constr;
12370 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12371 if (_res_constr.datalen > 0)
12372 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12374 _res_constr.data = NULL;
12375 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12376 for (size_t m = 0; m < _res_constr.datalen; m++) {
12377 int64_t _res_conv_12 = _res_vals[m];
12378 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
12379 FREE((void*)_res_conv_12);
12380 _res_constr.data[m] = _res_conv_12_conv;
12382 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12383 CVec_NetAddressZ_free(_res_constr);
12386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12387 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
12388 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
12389 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
12390 return ((uint64_t)ret_conv);
12393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
12394 LDKThirtyTwoBytes a_ref;
12395 CHECK((*env)->GetArrayLength(env, a) == 32);
12396 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12397 LDKThirtyTwoBytes b_ref;
12398 CHECK((*env)->GetArrayLength(env, b) == 32);
12399 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12400 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
12401 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
12402 return ((uint64_t)ret_conv);
12405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12406 if ((_res & 1) != 0) return;
12407 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
12409 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
12412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12413 LDKThirtyTwoBytes o_ref;
12414 CHECK((*env)->GetArrayLength(env, o) == 32);
12415 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
12416 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12417 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
12418 return (uint64_t)ret_conv;
12421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12422 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
12423 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12424 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12425 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
12426 return (uint64_t)ret_conv;
12429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12430 if ((_res & 1) != 0) return;
12431 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
12433 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
12436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12437 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
12438 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12439 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
12440 return (uint64_t)ret_conv;
12443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12444 LDKCVec_ChannelMonitorZ _res_constr;
12445 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12446 if (_res_constr.datalen > 0)
12447 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12449 _res_constr.data = NULL;
12450 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12451 for (size_t q = 0; q < _res_constr.datalen; q++) {
12452 int64_t _res_conv_16 = _res_vals[q];
12453 LDKChannelMonitor _res_conv_16_conv;
12454 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12455 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12456 _res_constr.data[q] = _res_conv_16_conv;
12458 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12459 CVec_ChannelMonitorZ_free(_res_constr);
12462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12463 LDKThirtyTwoBytes a_ref;
12464 CHECK((*env)->GetArrayLength(env, a) == 32);
12465 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12466 LDKChannelManager b_conv;
12467 b_conv.inner = (void*)(b & (~1));
12468 b_conv.is_owned = (b & 1) || (b == 0);
12469 // Warning: we need a move here but no clone is available for LDKChannelManager
12470 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
12471 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
12472 return ((uint64_t)ret_conv);
12475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12476 if ((_res & 1) != 0) return;
12477 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
12479 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
12482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12483 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
12484 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
12485 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12486 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
12487 return (uint64_t)ret_conv;
12490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12491 LDKDecodeError e_conv;
12492 e_conv.inner = (void*)(e & (~1));
12493 e_conv.is_owned = (e & 1) || (e == 0);
12494 e_conv = DecodeError_clone(&e_conv);
12495 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12496 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
12497 return (uint64_t)ret_conv;
12500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12501 if ((_res & 1) != 0) return;
12502 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12504 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
12507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12508 LDKChannelConfig o_conv;
12509 o_conv.inner = (void*)(o & (~1));
12510 o_conv.is_owned = (o & 1) || (o == 0);
12511 o_conv = ChannelConfig_clone(&o_conv);
12512 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12513 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
12514 return (uint64_t)ret_conv;
12517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12518 LDKDecodeError e_conv;
12519 e_conv.inner = (void*)(e & (~1));
12520 e_conv.is_owned = (e & 1) || (e == 0);
12521 e_conv = DecodeError_clone(&e_conv);
12522 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12523 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
12524 return (uint64_t)ret_conv;
12527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12528 if ((_res & 1) != 0) return;
12529 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
12531 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
12534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12535 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
12536 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12537 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
12538 return (uint64_t)ret_conv;
12541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12542 LDKOutPoint o_conv;
12543 o_conv.inner = (void*)(o & (~1));
12544 o_conv.is_owned = (o & 1) || (o == 0);
12545 o_conv = OutPoint_clone(&o_conv);
12546 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12547 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
12548 return (uint64_t)ret_conv;
12551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12552 LDKDecodeError e_conv;
12553 e_conv.inner = (void*)(e & (~1));
12554 e_conv.is_owned = (e & 1) || (e == 0);
12555 e_conv = DecodeError_clone(&e_conv);
12556 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12557 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
12558 return (uint64_t)ret_conv;
12561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12562 if ((_res & 1) != 0) return;
12563 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
12565 CResult_OutPointDecodeErrorZ_free(_res_conv);
12568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12569 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
12570 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12571 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
12572 return (uint64_t)ret_conv;
12575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
12576 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
12577 if (o_conv.free == LDKType_JCalls_free) {
12578 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12579 LDKType_JCalls_cloned(&o_conv);
12581 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12582 *ret_copy = COption_TypeZ_some(o_conv);
12583 uint64_t ret_ref = (uint64_t)ret_copy;
12587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
12588 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12589 *ret_copy = COption_TypeZ_none();
12590 uint64_t ret_ref = (uint64_t)ret_copy;
12594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12595 if ((_res & 1) != 0) return;
12596 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
12598 COption_TypeZ_free(_res_conv);
12601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12602 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12603 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12604 *ret_copy = COption_TypeZ_clone(orig_conv);
12605 uint64_t ret_ref = (uint64_t)ret_copy;
12609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12610 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
12611 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12612 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12613 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12614 return (uint64_t)ret_conv;
12617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12618 LDKDecodeError e_conv;
12619 e_conv.inner = (void*)(e & (~1));
12620 e_conv.is_owned = (e & 1) || (e == 0);
12621 e_conv = DecodeError_clone(&e_conv);
12622 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12623 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12624 return (uint64_t)ret_conv;
12627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12628 if ((_res & 1) != 0) return;
12629 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12631 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12635 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12636 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12637 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12638 return (uint64_t)ret_conv;
12641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
12642 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
12643 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12644 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12645 return (uint64_t)ret_conv;
12648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
12649 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12650 *ret_conv = CResult_SiPrefixNoneZ_err();
12651 return (uint64_t)ret_conv;
12654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12655 if ((_res & 1) != 0) return;
12656 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
12658 CResult_SiPrefixNoneZ_free(_res_conv);
12661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12662 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12663 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12664 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12665 return (uint64_t)ret_conv;
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12670 o_conv.inner = (void*)(o & (~1));
12671 o_conv.is_owned = (o & 1) || (o == 0);
12672 o_conv = Invoice_clone(&o_conv);
12673 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12674 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12675 return (uint64_t)ret_conv;
12678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12679 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12680 *ret_conv = CResult_InvoiceNoneZ_err();
12681 return (uint64_t)ret_conv;
12684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12685 if ((_res & 1) != 0) return;
12686 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
12688 CResult_InvoiceNoneZ_free(_res_conv);
12691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12692 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12693 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12694 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12695 return (uint64_t)ret_conv;
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12699 LDKSignedRawInvoice o_conv;
12700 o_conv.inner = (void*)(o & (~1));
12701 o_conv.is_owned = (o & 1) || (o == 0);
12702 o_conv = SignedRawInvoice_clone(&o_conv);
12703 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12704 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12705 return (uint64_t)ret_conv;
12708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12709 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12710 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12711 return (uint64_t)ret_conv;
12714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12715 if ((_res & 1) != 0) return;
12716 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
12718 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12722 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12723 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12724 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12725 return (uint64_t)ret_conv;
12728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12729 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12730 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12731 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12732 return ((uint64_t)ret_conv);
12735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
12736 LDKRawInvoice a_conv;
12737 a_conv.inner = (void*)(a & (~1));
12738 a_conv.is_owned = (a & 1) || (a == 0);
12739 a_conv = RawInvoice_clone(&a_conv);
12740 LDKThirtyTwoBytes b_ref;
12741 CHECK((*env)->GetArrayLength(env, b) == 32);
12742 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12743 LDKInvoiceSignature c_conv;
12744 c_conv.inner = (void*)(c & (~1));
12745 c_conv.is_owned = (c & 1) || (c == 0);
12746 c_conv = InvoiceSignature_clone(&c_conv);
12747 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12748 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12749 return ((uint64_t)ret_conv);
12752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12753 if ((_res & 1) != 0) return;
12754 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
12756 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
12759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12760 LDKPayeePubKey o_conv;
12761 o_conv.inner = (void*)(o & (~1));
12762 o_conv.is_owned = (o & 1) || (o == 0);
12763 o_conv = PayeePubKey_clone(&o_conv);
12764 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12765 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
12766 return (uint64_t)ret_conv;
12769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12770 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12771 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12772 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
12773 return (uint64_t)ret_conv;
12776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12777 if ((_res & 1) != 0) return;
12778 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
12780 CResult_PayeePubKeyErrorZ_free(_res_conv);
12783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12784 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
12785 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12786 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
12787 return (uint64_t)ret_conv;
12790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12791 LDKCVec_PrivateRouteZ _res_constr;
12792 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12793 if (_res_constr.datalen > 0)
12794 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
12796 _res_constr.data = NULL;
12797 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12798 for (size_t o = 0; o < _res_constr.datalen; o++) {
12799 int64_t _res_conv_14 = _res_vals[o];
12800 LDKPrivateRoute _res_conv_14_conv;
12801 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12802 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12803 _res_constr.data[o] = _res_conv_14_conv;
12805 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12806 CVec_PrivateRouteZ_free(_res_constr);
12809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12810 LDKPositiveTimestamp o_conv;
12811 o_conv.inner = (void*)(o & (~1));
12812 o_conv.is_owned = (o & 1) || (o == 0);
12813 o_conv = PositiveTimestamp_clone(&o_conv);
12814 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12815 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12816 return (uint64_t)ret_conv;
12819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12820 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12821 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12822 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12823 return (uint64_t)ret_conv;
12826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12827 if ((_res & 1) != 0) return;
12828 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
12830 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12834 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12835 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12836 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12837 return (uint64_t)ret_conv;
12840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
12841 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12842 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12843 return (uint64_t)ret_conv;
12846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12847 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12848 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12849 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12850 return (uint64_t)ret_conv;
12853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12854 if ((_res & 1) != 0) return;
12855 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
12857 CResult_NoneSemanticErrorZ_free(_res_conv);
12860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12861 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12862 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12863 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12864 return (uint64_t)ret_conv;
12867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12869 o_conv.inner = (void*)(o & (~1));
12870 o_conv.is_owned = (o & 1) || (o == 0);
12871 o_conv = Invoice_clone(&o_conv);
12872 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12873 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12874 return (uint64_t)ret_conv;
12877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12878 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12879 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12880 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12881 return (uint64_t)ret_conv;
12884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12885 if ((_res & 1) != 0) return;
12886 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
12888 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12892 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12893 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12894 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12895 return (uint64_t)ret_conv;
12898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12899 LDKDescription o_conv;
12900 o_conv.inner = (void*)(o & (~1));
12901 o_conv.is_owned = (o & 1) || (o == 0);
12902 o_conv = Description_clone(&o_conv);
12903 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12904 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12905 return (uint64_t)ret_conv;
12908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12909 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12910 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12911 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12912 return (uint64_t)ret_conv;
12915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12916 if ((_res & 1) != 0) return;
12917 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
12919 CResult_DescriptionCreationErrorZ_free(_res_conv);
12922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12923 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12924 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12925 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12926 return (uint64_t)ret_conv;
12929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12930 LDKExpiryTime o_conv;
12931 o_conv.inner = (void*)(o & (~1));
12932 o_conv.is_owned = (o & 1) || (o == 0);
12933 o_conv = ExpiryTime_clone(&o_conv);
12934 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12935 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12936 return (uint64_t)ret_conv;
12939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12940 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12941 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12942 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12943 return (uint64_t)ret_conv;
12946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12947 if ((_res & 1) != 0) return;
12948 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
12950 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12954 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12955 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12956 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12957 return (uint64_t)ret_conv;
12960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12961 LDKPrivateRoute o_conv;
12962 o_conv.inner = (void*)(o & (~1));
12963 o_conv.is_owned = (o & 1) || (o == 0);
12964 o_conv = PrivateRoute_clone(&o_conv);
12965 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12966 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12967 return (uint64_t)ret_conv;
12970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12971 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12972 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12973 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12974 return (uint64_t)ret_conv;
12977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12978 if ((_res & 1) != 0) return;
12979 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
12981 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12985 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12986 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12987 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12988 return (uint64_t)ret_conv;
12991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
12992 LDKStr o_conv = java_to_owned_str(env, o);
12993 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12994 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12995 return (uint64_t)ret_conv;
12998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12999 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13000 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13001 *ret_conv = CResult_StringErrorZ_err(e_conv);
13002 return (uint64_t)ret_conv;
13005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13006 if ((_res & 1) != 0) return;
13007 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
13009 CResult_StringErrorZ_free(_res_conv);
13012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13013 LDKChannelMonitorUpdate o_conv;
13014 o_conv.inner = (void*)(o & (~1));
13015 o_conv.is_owned = (o & 1) || (o == 0);
13016 o_conv = ChannelMonitorUpdate_clone(&o_conv);
13017 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13018 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
13019 return (uint64_t)ret_conv;
13022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13023 LDKDecodeError e_conv;
13024 e_conv.inner = (void*)(e & (~1));
13025 e_conv.is_owned = (e & 1) || (e == 0);
13026 e_conv = DecodeError_clone(&e_conv);
13027 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13028 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
13029 return (uint64_t)ret_conv;
13032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13033 if ((_res & 1) != 0) return;
13034 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13036 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
13039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13040 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
13041 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13042 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
13043 return (uint64_t)ret_conv;
13046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13047 LDKHTLCUpdate o_conv;
13048 o_conv.inner = (void*)(o & (~1));
13049 o_conv.is_owned = (o & 1) || (o == 0);
13050 o_conv = HTLCUpdate_clone(&o_conv);
13051 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13052 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
13053 return (uint64_t)ret_conv;
13056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13057 LDKDecodeError e_conv;
13058 e_conv.inner = (void*)(e & (~1));
13059 e_conv.is_owned = (e & 1) || (e == 0);
13060 e_conv = DecodeError_clone(&e_conv);
13061 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13062 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
13063 return (uint64_t)ret_conv;
13066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13067 if ((_res & 1) != 0) return;
13068 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13070 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
13073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13074 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
13075 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13076 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
13077 return (uint64_t)ret_conv;
13080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
13081 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13082 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
13083 return (uint64_t)ret_conv;
13086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13087 LDKMonitorUpdateError e_conv;
13088 e_conv.inner = (void*)(e & (~1));
13089 e_conv.is_owned = (e & 1) || (e == 0);
13090 e_conv = MonitorUpdateError_clone(&e_conv);
13091 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13092 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
13093 return (uint64_t)ret_conv;
13096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13097 if ((_res & 1) != 0) return;
13098 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
13100 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
13103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13104 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
13105 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13106 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
13107 return (uint64_t)ret_conv;
13110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13111 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
13112 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13113 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
13114 return ((uint64_t)ret_conv);
13117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
13118 LDKOutPoint a_conv;
13119 a_conv.inner = (void*)(a & (~1));
13120 a_conv.is_owned = (a & 1) || (a == 0);
13121 a_conv = OutPoint_clone(&a_conv);
13123 b_ref.datalen = (*env)->GetArrayLength(env, b);
13124 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13125 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
13126 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13127 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
13128 return ((uint64_t)ret_conv);
13131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13132 if ((_res & 1) != 0) return;
13133 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
13135 C2Tuple_OutPointScriptZ_free(_res_conv);
13138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13139 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
13140 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13141 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
13142 return ((uint64_t)ret_conv);
13145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
13147 b_ref.datalen = (*env)->GetArrayLength(env, b);
13148 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13149 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
13150 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13151 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
13152 return ((uint64_t)ret_conv);
13155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13156 if ((_res & 1) != 0) return;
13157 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
13159 C2Tuple_u32ScriptZ_free(_res_conv);
13162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13163 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
13164 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13165 if (_res_constr.datalen > 0)
13166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13168 _res_constr.data = NULL;
13169 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13170 for (size_t v = 0; v < _res_constr.datalen; v++) {
13171 int64_t _res_conv_21 = _res_vals[v];
13172 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_21) & ~1);
13173 FREE((void*)_res_conv_21);
13174 _res_constr.data[v] = _res_conv_21_conv;
13176 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13177 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
13180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13181 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
13182 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13183 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
13184 return ((uint64_t)ret_conv);
13187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
13188 LDKThirtyTwoBytes a_ref;
13189 CHECK((*env)->GetArrayLength(env, a) == 32);
13190 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13191 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
13192 b_constr.datalen = (*env)->GetArrayLength(env, b);
13193 if (b_constr.datalen > 0)
13194 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13196 b_constr.data = NULL;
13197 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
13198 for (size_t v = 0; v < b_constr.datalen; v++) {
13199 int64_t b_conv_21 = b_vals[v];
13200 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
13201 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
13202 b_constr.data[v] = b_conv_21_conv;
13204 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
13205 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13206 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
13207 return ((uint64_t)ret_conv);
13210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13211 if ((_res & 1) != 0) return;
13212 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
13214 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
13217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13218 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
13219 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13220 if (_res_constr.datalen > 0)
13221 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
13223 _res_constr.data = NULL;
13224 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13225 for (size_t o = 0; o < _res_constr.datalen; o++) {
13226 int64_t _res_conv_40 = _res_vals[o];
13227 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_40) & ~1);
13228 FREE((void*)_res_conv_40);
13229 _res_constr.data[o] = _res_conv_40_conv;
13231 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13232 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
13235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13236 LDKCVec_EventZ _res_constr;
13237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13238 if (_res_constr.datalen > 0)
13239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
13241 _res_constr.data = NULL;
13242 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13243 for (size_t h = 0; h < _res_constr.datalen; h++) {
13244 int64_t _res_conv_7 = _res_vals[h];
13245 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
13246 FREE((void*)_res_conv_7);
13247 _res_constr.data[h] = _res_conv_7_conv;
13249 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13250 CVec_EventZ_free(_res_constr);
13253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13254 LDKCVec_TransactionZ _res_constr;
13255 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13256 if (_res_constr.datalen > 0)
13257 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
13259 _res_constr.data = NULL;
13260 for (size_t i = 0; i < _res_constr.datalen; i++) {
13261 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13262 LDKTransaction _res_conv_8_ref;
13263 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
13264 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
13265 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
13266 _res_conv_8_ref.data_is_owned = true;
13267 _res_constr.data[i] = _res_conv_8_ref;
13269 CVec_TransactionZ_free(_res_constr);
13272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13273 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
13274 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13275 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
13276 return ((uint64_t)ret_conv);
13279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
13280 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
13281 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
13282 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13283 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
13284 return ((uint64_t)ret_conv);
13287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13288 if ((_res & 1) != 0) return;
13289 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
13291 C2Tuple_u32TxOutZ_free(_res_conv);
13294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13295 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
13296 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13297 if (_res_constr.datalen > 0)
13298 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13300 _res_constr.data = NULL;
13301 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13302 for (size_t u = 0; u < _res_constr.datalen; u++) {
13303 int64_t _res_conv_20 = _res_vals[u];
13304 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_20) & ~1);
13305 FREE((void*)_res_conv_20);
13306 _res_constr.data[u] = _res_conv_20_conv;
13308 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13309 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
13312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13313 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
13314 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13315 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
13316 return ((uint64_t)ret_conv);
13319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
13320 LDKThirtyTwoBytes a_ref;
13321 CHECK((*env)->GetArrayLength(env, a) == 32);
13322 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13323 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
13324 b_constr.datalen = (*env)->GetArrayLength(env, b);
13325 if (b_constr.datalen > 0)
13326 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13328 b_constr.data = NULL;
13329 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
13330 for (size_t u = 0; u < b_constr.datalen; u++) {
13331 int64_t b_conv_20 = b_vals[u];
13332 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
13333 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
13334 b_constr.data[u] = b_conv_20_conv;
13336 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
13337 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13338 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
13339 return ((uint64_t)ret_conv);
13342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13343 if ((_res & 1) != 0) return;
13344 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
13346 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
13349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13350 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
13351 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13352 if (_res_constr.datalen > 0)
13353 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
13355 _res_constr.data = NULL;
13356 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13357 for (size_t n = 0; n < _res_constr.datalen; n++) {
13358 int64_t _res_conv_39 = _res_vals[n];
13359 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_39) & ~1);
13360 FREE((void*)_res_conv_39);
13361 _res_constr.data[n] = _res_conv_39_conv;
13363 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13364 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
13367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13368 LDKCVec_BalanceZ _res_constr;
13369 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13370 if (_res_constr.datalen > 0)
13371 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
13373 _res_constr.data = NULL;
13374 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13375 for (size_t j = 0; j < _res_constr.datalen; j++) {
13376 int64_t _res_conv_9 = _res_vals[j];
13377 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
13378 FREE((void*)_res_conv_9);
13379 _res_constr.data[j] = _res_conv_9_conv;
13381 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13382 CVec_BalanceZ_free(_res_constr);
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13386 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
13387 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
13388 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13389 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
13390 return (uint64_t)ret_conv;
13393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13394 LDKDecodeError e_conv;
13395 e_conv.inner = (void*)(e & (~1));
13396 e_conv.is_owned = (e & 1) || (e == 0);
13397 e_conv = DecodeError_clone(&e_conv);
13398 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13399 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
13400 return (uint64_t)ret_conv;
13403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13404 if ((_res & 1) != 0) return;
13405 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
13407 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
13410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13411 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
13412 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13413 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
13414 return (uint64_t)ret_conv;
13417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
13418 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13419 *ret_conv = CResult_NoneLightningErrorZ_ok();
13420 return (uint64_t)ret_conv;
13423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13424 LDKLightningError e_conv;
13425 e_conv.inner = (void*)(e & (~1));
13426 e_conv.is_owned = (e & 1) || (e == 0);
13427 e_conv = LightningError_clone(&e_conv);
13428 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13429 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13430 return (uint64_t)ret_conv;
13433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13434 if ((_res & 1) != 0) return;
13435 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
13437 CResult_NoneLightningErrorZ_free(_res_conv);
13440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13441 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13442 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13443 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13444 return (uint64_t)ret_conv;
13447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13448 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13449 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13450 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13451 return ((uint64_t)ret_conv);
13454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
13455 LDKPublicKey a_ref;
13456 CHECK((*env)->GetArrayLength(env, a) == 33);
13457 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
13458 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
13459 if (b_conv.free == LDKType_JCalls_free) {
13460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13461 LDKType_JCalls_cloned(&b_conv);
13463 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13464 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13465 return ((uint64_t)ret_conv);
13468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13469 if ((_res & 1) != 0) return;
13470 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
13472 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13476 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13477 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13478 if (_res_constr.datalen > 0)
13479 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13481 _res_constr.data = NULL;
13482 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13483 for (size_t z = 0; z < _res_constr.datalen; z++) {
13484 int64_t _res_conv_25 = _res_vals[z];
13485 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_25) & ~1);
13486 FREE((void*)_res_conv_25);
13487 _res_constr.data[z] = _res_conv_25_conv;
13489 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13490 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13494 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13495 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13496 return (uint64_t)ret_conv;
13499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13500 LDKLightningError e_conv;
13501 e_conv.inner = (void*)(e & (~1));
13502 e_conv.is_owned = (e & 1) || (e == 0);
13503 e_conv = LightningError_clone(&e_conv);
13504 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13505 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13506 return (uint64_t)ret_conv;
13509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13510 if ((_res & 1) != 0) return;
13511 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
13513 CResult_boolLightningErrorZ_free(_res_conv);
13516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13517 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13518 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13519 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13520 return (uint64_t)ret_conv;
13523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13524 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13525 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13526 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13527 return ((uint64_t)ret_conv);
13530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
13531 LDKChannelAnnouncement a_conv;
13532 a_conv.inner = (void*)(a & (~1));
13533 a_conv.is_owned = (a & 1) || (a == 0);
13534 a_conv = ChannelAnnouncement_clone(&a_conv);
13535 LDKChannelUpdate b_conv;
13536 b_conv.inner = (void*)(b & (~1));
13537 b_conv.is_owned = (b & 1) || (b == 0);
13538 b_conv = ChannelUpdate_clone(&b_conv);
13539 LDKChannelUpdate c_conv;
13540 c_conv.inner = (void*)(c & (~1));
13541 c_conv.is_owned = (c & 1) || (c == 0);
13542 c_conv = ChannelUpdate_clone(&c_conv);
13543 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13544 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13545 return ((uint64_t)ret_conv);
13548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13549 if ((_res & 1) != 0) return;
13550 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
13552 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13556 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13557 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13558 if (_res_constr.datalen > 0)
13559 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13561 _res_constr.data = NULL;
13562 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13563 for (size_t h = 0; h < _res_constr.datalen; h++) {
13564 int64_t _res_conv_59 = _res_vals[h];
13565 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_59) & ~1);
13566 FREE((void*)_res_conv_59);
13567 _res_constr.data[h] = _res_conv_59_conv;
13569 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13570 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13574 LDKCVec_NodeAnnouncementZ _res_constr;
13575 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13576 if (_res_constr.datalen > 0)
13577 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13579 _res_constr.data = NULL;
13580 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13581 for (size_t s = 0; s < _res_constr.datalen; s++) {
13582 int64_t _res_conv_18 = _res_vals[s];
13583 LDKNodeAnnouncement _res_conv_18_conv;
13584 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13585 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13586 _res_constr.data[s] = _res_conv_18_conv;
13588 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13589 CVec_NodeAnnouncementZ_free(_res_constr);
13592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13593 LDKCVec_PublicKeyZ _res_constr;
13594 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13595 if (_res_constr.datalen > 0)
13596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13598 _res_constr.data = NULL;
13599 for (size_t i = 0; i < _res_constr.datalen; i++) {
13600 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13601 LDKPublicKey _res_conv_8_ref;
13602 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
13603 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
13604 _res_constr.data[i] = _res_conv_8_ref;
13606 CVec_PublicKeyZ_free(_res_constr);
13609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13611 o_ref.datalen = (*env)->GetArrayLength(env, o);
13612 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13613 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13614 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13615 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13616 return (uint64_t)ret_conv;
13619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13620 LDKPeerHandleError e_conv;
13621 e_conv.inner = (void*)(e & (~1));
13622 e_conv.is_owned = (e & 1) || (e == 0);
13623 e_conv = PeerHandleError_clone(&e_conv);
13624 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13625 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13626 return (uint64_t)ret_conv;
13629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13630 if ((_res & 1) != 0) return;
13631 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13633 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13637 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13638 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13639 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13640 return (uint64_t)ret_conv;
13643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
13644 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13645 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13646 return (uint64_t)ret_conv;
13649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13650 LDKPeerHandleError e_conv;
13651 e_conv.inner = (void*)(e & (~1));
13652 e_conv.is_owned = (e & 1) || (e == 0);
13653 e_conv = PeerHandleError_clone(&e_conv);
13654 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13655 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13656 return (uint64_t)ret_conv;
13659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13660 if ((_res & 1) != 0) return;
13661 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13663 CResult_NonePeerHandleErrorZ_free(_res_conv);
13666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13667 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13668 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13669 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13670 return (uint64_t)ret_conv;
13673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13674 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13675 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13676 return (uint64_t)ret_conv;
13679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13680 LDKPeerHandleError e_conv;
13681 e_conv.inner = (void*)(e & (~1));
13682 e_conv.is_owned = (e & 1) || (e == 0);
13683 e_conv = PeerHandleError_clone(&e_conv);
13684 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13685 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13686 return (uint64_t)ret_conv;
13689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13690 if ((_res & 1) != 0) return;
13691 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13693 CResult_boolPeerHandleErrorZ_free(_res_conv);
13696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13697 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13698 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13699 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13700 return (uint64_t)ret_conv;
13703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13705 o_conv.inner = (void*)(o & (~1));
13706 o_conv.is_owned = (o & 1) || (o == 0);
13707 o_conv = NodeId_clone(&o_conv);
13708 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13709 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
13710 return (uint64_t)ret_conv;
13713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13714 LDKDecodeError e_conv;
13715 e_conv.inner = (void*)(e & (~1));
13716 e_conv.is_owned = (e & 1) || (e == 0);
13717 e_conv = DecodeError_clone(&e_conv);
13718 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13719 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
13720 return (uint64_t)ret_conv;
13723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13724 if ((_res & 1) != 0) return;
13725 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1);
13727 CResult_NodeIdDecodeErrorZ_free(_res_conv);
13730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13731 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
13732 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
13733 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
13734 return (uint64_t)ret_conv;
13737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13738 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
13739 if (o_conv.free == LDKAccess_JCalls_free) {
13740 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13741 LDKAccess_JCalls_cloned(&o_conv);
13743 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13744 *ret_copy = COption_AccessZ_some(o_conv);
13745 uint64_t ret_ref = (uint64_t)ret_copy;
13749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
13750 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13751 *ret_copy = COption_AccessZ_none();
13752 uint64_t ret_ref = (uint64_t)ret_copy;
13756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13757 if ((_res & 1) != 0) return;
13758 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
13760 COption_AccessZ_free(_res_conv);
13763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13764 LDKDirectionalChannelInfo o_conv;
13765 o_conv.inner = (void*)(o & (~1));
13766 o_conv.is_owned = (o & 1) || (o == 0);
13767 o_conv = DirectionalChannelInfo_clone(&o_conv);
13768 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13769 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13770 return (uint64_t)ret_conv;
13773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13774 LDKDecodeError e_conv;
13775 e_conv.inner = (void*)(e & (~1));
13776 e_conv.is_owned = (e & 1) || (e == 0);
13777 e_conv = DecodeError_clone(&e_conv);
13778 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13779 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13780 return (uint64_t)ret_conv;
13783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13784 if ((_res & 1) != 0) return;
13785 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13787 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13791 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13792 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13793 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13794 return (uint64_t)ret_conv;
13797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13798 LDKChannelInfo o_conv;
13799 o_conv.inner = (void*)(o & (~1));
13800 o_conv.is_owned = (o & 1) || (o == 0);
13801 o_conv = ChannelInfo_clone(&o_conv);
13802 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13803 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13804 return (uint64_t)ret_conv;
13807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13808 LDKDecodeError e_conv;
13809 e_conv.inner = (void*)(e & (~1));
13810 e_conv.is_owned = (e & 1) || (e == 0);
13811 e_conv = DecodeError_clone(&e_conv);
13812 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13813 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13814 return (uint64_t)ret_conv;
13817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13818 if ((_res & 1) != 0) return;
13819 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13821 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13825 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13826 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13827 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13828 return (uint64_t)ret_conv;
13831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13832 LDKRoutingFees o_conv;
13833 o_conv.inner = (void*)(o & (~1));
13834 o_conv.is_owned = (o & 1) || (o == 0);
13835 o_conv = RoutingFees_clone(&o_conv);
13836 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13837 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13838 return (uint64_t)ret_conv;
13841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13842 LDKDecodeError e_conv;
13843 e_conv.inner = (void*)(e & (~1));
13844 e_conv.is_owned = (e & 1) || (e == 0);
13845 e_conv = DecodeError_clone(&e_conv);
13846 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13847 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13848 return (uint64_t)ret_conv;
13851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13852 if ((_res & 1) != 0) return;
13853 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13855 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13859 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13860 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13861 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13862 return (uint64_t)ret_conv;
13865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13866 LDKNodeAnnouncementInfo o_conv;
13867 o_conv.inner = (void*)(o & (~1));
13868 o_conv.is_owned = (o & 1) || (o == 0);
13869 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13870 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13871 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13872 return (uint64_t)ret_conv;
13875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13876 LDKDecodeError e_conv;
13877 e_conv.inner = (void*)(e & (~1));
13878 e_conv.is_owned = (e & 1) || (e == 0);
13879 e_conv = DecodeError_clone(&e_conv);
13880 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13881 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13882 return (uint64_t)ret_conv;
13885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13886 if ((_res & 1) != 0) return;
13887 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13889 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13893 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13894 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13895 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13896 return (uint64_t)ret_conv;
13899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13900 LDKCVec_u64Z _res_constr;
13901 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13902 if (_res_constr.datalen > 0)
13903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13905 _res_constr.data = NULL;
13906 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13907 for (size_t g = 0; g < _res_constr.datalen; g++) {
13908 int64_t _res_conv_6 = _res_vals[g];
13909 _res_constr.data[g] = _res_conv_6;
13911 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13912 CVec_u64Z_free(_res_constr);
13915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13916 LDKNodeInfo o_conv;
13917 o_conv.inner = (void*)(o & (~1));
13918 o_conv.is_owned = (o & 1) || (o == 0);
13919 o_conv = NodeInfo_clone(&o_conv);
13920 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13921 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13922 return (uint64_t)ret_conv;
13925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13926 LDKDecodeError e_conv;
13927 e_conv.inner = (void*)(e & (~1));
13928 e_conv.is_owned = (e & 1) || (e == 0);
13929 e_conv = DecodeError_clone(&e_conv);
13930 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13931 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13932 return (uint64_t)ret_conv;
13935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13936 if ((_res & 1) != 0) return;
13937 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13939 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13943 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13944 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13945 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13946 return (uint64_t)ret_conv;
13949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13950 LDKNetworkGraph o_conv;
13951 o_conv.inner = (void*)(o & (~1));
13952 o_conv.is_owned = (o & 1) || (o == 0);
13953 o_conv = NetworkGraph_clone(&o_conv);
13954 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13955 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13956 return (uint64_t)ret_conv;
13959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13960 LDKDecodeError e_conv;
13961 e_conv.inner = (void*)(e & (~1));
13962 e_conv.is_owned = (e & 1) || (e == 0);
13963 e_conv = DecodeError_clone(&e_conv);
13964 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13965 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13966 return (uint64_t)ret_conv;
13969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13970 if ((_res & 1) != 0) return;
13971 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
13973 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13977 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
13978 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13979 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
13980 return (uint64_t)ret_conv;
13983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
13984 LDKCVec_NetAddressZ o_constr;
13985 o_constr.datalen = (*env)->GetArrayLength(env, o);
13986 if (o_constr.datalen > 0)
13987 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13989 o_constr.data = NULL;
13990 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
13991 for (size_t m = 0; m < o_constr.datalen; m++) {
13992 int64_t o_conv_12 = o_vals[m];
13993 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1);
13994 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
13995 o_constr.data[m] = o_conv_12_conv;
13997 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
13998 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
13999 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14000 uint64_t ret_ref = (uint64_t)ret_copy;
14004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
14005 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14006 *ret_copy = COption_CVec_NetAddressZZ_none();
14007 uint64_t ret_ref = (uint64_t)ret_copy;
14011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14012 if ((_res & 1) != 0) return;
14013 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1);
14015 COption_CVec_NetAddressZZ_free(_res_conv);
14018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14019 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14020 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14021 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14022 uint64_t ret_ref = (uint64_t)ret_copy;
14026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
14027 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
14028 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
14029 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14030 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
14031 return (uint64_t)ret_conv;
14034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
14035 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14036 *ret_conv = CResult_NetAddressu8Z_err(e);
14037 return (uint64_t)ret_conv;
14040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14041 if ((_res & 1) != 0) return;
14042 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
14044 CResult_NetAddressu8Z_free(_res_conv);
14047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14048 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
14049 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14050 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
14051 return (uint64_t)ret_conv;
14054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14055 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
14056 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
14057 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14058 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
14059 return (uint64_t)ret_conv;
14062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14063 LDKDecodeError e_conv;
14064 e_conv.inner = (void*)(e & (~1));
14065 e_conv.is_owned = (e & 1) || (e == 0);
14066 e_conv = DecodeError_clone(&e_conv);
14067 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14068 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
14069 return (uint64_t)ret_conv;
14072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14073 if ((_res & 1) != 0) return;
14074 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
14076 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
14079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14080 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
14081 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14082 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
14083 return (uint64_t)ret_conv;
14086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14087 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
14088 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
14089 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14090 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
14091 return (uint64_t)ret_conv;
14094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14095 LDKDecodeError e_conv;
14096 e_conv.inner = (void*)(e & (~1));
14097 e_conv.is_owned = (e & 1) || (e == 0);
14098 e_conv = DecodeError_clone(&e_conv);
14099 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14100 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
14101 return (uint64_t)ret_conv;
14104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14105 if ((_res & 1) != 0) return;
14106 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
14108 CResult_NetAddressDecodeErrorZ_free(_res_conv);
14111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14112 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
14113 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14114 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
14115 return (uint64_t)ret_conv;
14118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14119 LDKCVec_UpdateAddHTLCZ _res_constr;
14120 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14121 if (_res_constr.datalen > 0)
14122 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14124 _res_constr.data = NULL;
14125 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14126 for (size_t p = 0; p < _res_constr.datalen; p++) {
14127 int64_t _res_conv_15 = _res_vals[p];
14128 LDKUpdateAddHTLC _res_conv_15_conv;
14129 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
14130 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
14131 _res_constr.data[p] = _res_conv_15_conv;
14133 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14134 CVec_UpdateAddHTLCZ_free(_res_constr);
14137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14138 LDKCVec_UpdateFulfillHTLCZ _res_constr;
14139 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14140 if (_res_constr.datalen > 0)
14141 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14143 _res_constr.data = NULL;
14144 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14145 for (size_t t = 0; t < _res_constr.datalen; t++) {
14146 int64_t _res_conv_19 = _res_vals[t];
14147 LDKUpdateFulfillHTLC _res_conv_19_conv;
14148 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
14149 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
14150 _res_constr.data[t] = _res_conv_19_conv;
14152 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14153 CVec_UpdateFulfillHTLCZ_free(_res_constr);
14156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14157 LDKCVec_UpdateFailHTLCZ _res_constr;
14158 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14159 if (_res_constr.datalen > 0)
14160 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14162 _res_constr.data = NULL;
14163 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14164 for (size_t q = 0; q < _res_constr.datalen; q++) {
14165 int64_t _res_conv_16 = _res_vals[q];
14166 LDKUpdateFailHTLC _res_conv_16_conv;
14167 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14168 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14169 _res_constr.data[q] = _res_conv_16_conv;
14171 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14172 CVec_UpdateFailHTLCZ_free(_res_constr);
14175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14176 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
14177 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14178 if (_res_constr.datalen > 0)
14179 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14181 _res_constr.data = NULL;
14182 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14183 for (size_t z = 0; z < _res_constr.datalen; z++) {
14184 int64_t _res_conv_25 = _res_vals[z];
14185 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
14186 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
14187 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
14188 _res_constr.data[z] = _res_conv_25_conv;
14190 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14191 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
14194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14195 LDKAcceptChannel o_conv;
14196 o_conv.inner = (void*)(o & (~1));
14197 o_conv.is_owned = (o & 1) || (o == 0);
14198 o_conv = AcceptChannel_clone(&o_conv);
14199 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14200 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
14201 return (uint64_t)ret_conv;
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14205 LDKDecodeError e_conv;
14206 e_conv.inner = (void*)(e & (~1));
14207 e_conv.is_owned = (e & 1) || (e == 0);
14208 e_conv = DecodeError_clone(&e_conv);
14209 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14210 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
14211 return (uint64_t)ret_conv;
14214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14215 if ((_res & 1) != 0) return;
14216 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
14218 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
14221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14222 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
14223 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14224 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
14225 return (uint64_t)ret_conv;
14228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14229 LDKAnnouncementSignatures o_conv;
14230 o_conv.inner = (void*)(o & (~1));
14231 o_conv.is_owned = (o & 1) || (o == 0);
14232 o_conv = AnnouncementSignatures_clone(&o_conv);
14233 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14234 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
14235 return (uint64_t)ret_conv;
14238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14239 LDKDecodeError e_conv;
14240 e_conv.inner = (void*)(e & (~1));
14241 e_conv.is_owned = (e & 1) || (e == 0);
14242 e_conv = DecodeError_clone(&e_conv);
14243 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14244 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
14245 return (uint64_t)ret_conv;
14248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14249 if ((_res & 1) != 0) return;
14250 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
14252 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
14255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14256 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
14257 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14258 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
14259 return (uint64_t)ret_conv;
14262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14263 LDKChannelReestablish o_conv;
14264 o_conv.inner = (void*)(o & (~1));
14265 o_conv.is_owned = (o & 1) || (o == 0);
14266 o_conv = ChannelReestablish_clone(&o_conv);
14267 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14268 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
14269 return (uint64_t)ret_conv;
14272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14273 LDKDecodeError e_conv;
14274 e_conv.inner = (void*)(e & (~1));
14275 e_conv.is_owned = (e & 1) || (e == 0);
14276 e_conv = DecodeError_clone(&e_conv);
14277 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14278 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
14279 return (uint64_t)ret_conv;
14282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14283 if ((_res & 1) != 0) return;
14284 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
14286 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
14289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14290 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
14291 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14292 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
14293 return (uint64_t)ret_conv;
14296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14297 LDKClosingSigned o_conv;
14298 o_conv.inner = (void*)(o & (~1));
14299 o_conv.is_owned = (o & 1) || (o == 0);
14300 o_conv = ClosingSigned_clone(&o_conv);
14301 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14302 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
14303 return (uint64_t)ret_conv;
14306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14307 LDKDecodeError e_conv;
14308 e_conv.inner = (void*)(e & (~1));
14309 e_conv.is_owned = (e & 1) || (e == 0);
14310 e_conv = DecodeError_clone(&e_conv);
14311 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14312 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
14313 return (uint64_t)ret_conv;
14316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14317 if ((_res & 1) != 0) return;
14318 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14320 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
14323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14324 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
14325 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14326 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
14327 return (uint64_t)ret_conv;
14330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14331 LDKClosingSignedFeeRange o_conv;
14332 o_conv.inner = (void*)(o & (~1));
14333 o_conv.is_owned = (o & 1) || (o == 0);
14334 o_conv = ClosingSignedFeeRange_clone(&o_conv);
14335 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14336 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
14337 return (uint64_t)ret_conv;
14340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14341 LDKDecodeError e_conv;
14342 e_conv.inner = (void*)(e & (~1));
14343 e_conv.is_owned = (e & 1) || (e == 0);
14344 e_conv = DecodeError_clone(&e_conv);
14345 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14346 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
14347 return (uint64_t)ret_conv;
14350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14351 if ((_res & 1) != 0) return;
14352 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14354 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
14357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14358 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
14359 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14360 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
14361 return (uint64_t)ret_conv;
14364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14365 LDKCommitmentSigned o_conv;
14366 o_conv.inner = (void*)(o & (~1));
14367 o_conv.is_owned = (o & 1) || (o == 0);
14368 o_conv = CommitmentSigned_clone(&o_conv);
14369 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14370 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
14371 return (uint64_t)ret_conv;
14374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14375 LDKDecodeError e_conv;
14376 e_conv.inner = (void*)(e & (~1));
14377 e_conv.is_owned = (e & 1) || (e == 0);
14378 e_conv = DecodeError_clone(&e_conv);
14379 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14380 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
14381 return (uint64_t)ret_conv;
14384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14385 if ((_res & 1) != 0) return;
14386 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14388 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
14391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14392 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
14393 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14394 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
14395 return (uint64_t)ret_conv;
14398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14399 LDKFundingCreated o_conv;
14400 o_conv.inner = (void*)(o & (~1));
14401 o_conv.is_owned = (o & 1) || (o == 0);
14402 o_conv = FundingCreated_clone(&o_conv);
14403 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14404 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
14405 return (uint64_t)ret_conv;
14408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14409 LDKDecodeError e_conv;
14410 e_conv.inner = (void*)(e & (~1));
14411 e_conv.is_owned = (e & 1) || (e == 0);
14412 e_conv = DecodeError_clone(&e_conv);
14413 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14414 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
14415 return (uint64_t)ret_conv;
14418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14419 if ((_res & 1) != 0) return;
14420 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14422 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
14425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14426 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
14427 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14428 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
14429 return (uint64_t)ret_conv;
14432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14433 LDKFundingSigned o_conv;
14434 o_conv.inner = (void*)(o & (~1));
14435 o_conv.is_owned = (o & 1) || (o == 0);
14436 o_conv = FundingSigned_clone(&o_conv);
14437 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14438 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
14439 return (uint64_t)ret_conv;
14442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14443 LDKDecodeError e_conv;
14444 e_conv.inner = (void*)(e & (~1));
14445 e_conv.is_owned = (e & 1) || (e == 0);
14446 e_conv = DecodeError_clone(&e_conv);
14447 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14448 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
14449 return (uint64_t)ret_conv;
14452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14453 if ((_res & 1) != 0) return;
14454 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14456 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
14459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14460 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
14461 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14462 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
14463 return (uint64_t)ret_conv;
14466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14467 LDKFundingLocked o_conv;
14468 o_conv.inner = (void*)(o & (~1));
14469 o_conv.is_owned = (o & 1) || (o == 0);
14470 o_conv = FundingLocked_clone(&o_conv);
14471 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14472 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
14473 return (uint64_t)ret_conv;
14476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14477 LDKDecodeError e_conv;
14478 e_conv.inner = (void*)(e & (~1));
14479 e_conv.is_owned = (e & 1) || (e == 0);
14480 e_conv = DecodeError_clone(&e_conv);
14481 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14482 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
14483 return (uint64_t)ret_conv;
14486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14487 if ((_res & 1) != 0) return;
14488 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14490 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
14493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14494 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
14495 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14496 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
14497 return (uint64_t)ret_conv;
14500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14502 o_conv.inner = (void*)(o & (~1));
14503 o_conv.is_owned = (o & 1) || (o == 0);
14504 o_conv = Init_clone(&o_conv);
14505 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14506 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
14507 return (uint64_t)ret_conv;
14510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14511 LDKDecodeError e_conv;
14512 e_conv.inner = (void*)(e & (~1));
14513 e_conv.is_owned = (e & 1) || (e == 0);
14514 e_conv = DecodeError_clone(&e_conv);
14515 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14516 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
14517 return (uint64_t)ret_conv;
14520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14521 if ((_res & 1) != 0) return;
14522 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
14524 CResult_InitDecodeErrorZ_free(_res_conv);
14527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14528 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
14529 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14530 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
14531 return (uint64_t)ret_conv;
14534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14535 LDKOpenChannel o_conv;
14536 o_conv.inner = (void*)(o & (~1));
14537 o_conv.is_owned = (o & 1) || (o == 0);
14538 o_conv = OpenChannel_clone(&o_conv);
14539 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14540 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
14541 return (uint64_t)ret_conv;
14544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14545 LDKDecodeError e_conv;
14546 e_conv.inner = (void*)(e & (~1));
14547 e_conv.is_owned = (e & 1) || (e == 0);
14548 e_conv = DecodeError_clone(&e_conv);
14549 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14550 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
14551 return (uint64_t)ret_conv;
14554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14555 if ((_res & 1) != 0) return;
14556 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
14558 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
14561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14562 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
14563 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14564 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
14565 return (uint64_t)ret_conv;
14568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14569 LDKRevokeAndACK o_conv;
14570 o_conv.inner = (void*)(o & (~1));
14571 o_conv.is_owned = (o & 1) || (o == 0);
14572 o_conv = RevokeAndACK_clone(&o_conv);
14573 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14574 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
14575 return (uint64_t)ret_conv;
14578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14579 LDKDecodeError e_conv;
14580 e_conv.inner = (void*)(e & (~1));
14581 e_conv.is_owned = (e & 1) || (e == 0);
14582 e_conv = DecodeError_clone(&e_conv);
14583 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14584 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
14585 return (uint64_t)ret_conv;
14588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14589 if ((_res & 1) != 0) return;
14590 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
14592 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
14595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14596 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
14597 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14598 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
14599 return (uint64_t)ret_conv;
14602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14603 LDKShutdown o_conv;
14604 o_conv.inner = (void*)(o & (~1));
14605 o_conv.is_owned = (o & 1) || (o == 0);
14606 o_conv = Shutdown_clone(&o_conv);
14607 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14608 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
14609 return (uint64_t)ret_conv;
14612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14613 LDKDecodeError e_conv;
14614 e_conv.inner = (void*)(e & (~1));
14615 e_conv.is_owned = (e & 1) || (e == 0);
14616 e_conv = DecodeError_clone(&e_conv);
14617 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14618 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
14619 return (uint64_t)ret_conv;
14622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14623 if ((_res & 1) != 0) return;
14624 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
14626 CResult_ShutdownDecodeErrorZ_free(_res_conv);
14629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14630 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
14631 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14632 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
14633 return (uint64_t)ret_conv;
14636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14637 LDKUpdateFailHTLC o_conv;
14638 o_conv.inner = (void*)(o & (~1));
14639 o_conv.is_owned = (o & 1) || (o == 0);
14640 o_conv = UpdateFailHTLC_clone(&o_conv);
14641 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14642 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
14643 return (uint64_t)ret_conv;
14646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14647 LDKDecodeError e_conv;
14648 e_conv.inner = (void*)(e & (~1));
14649 e_conv.is_owned = (e & 1) || (e == 0);
14650 e_conv = DecodeError_clone(&e_conv);
14651 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14652 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
14653 return (uint64_t)ret_conv;
14656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14657 if ((_res & 1) != 0) return;
14658 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14660 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
14663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14664 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
14665 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14666 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
14667 return (uint64_t)ret_conv;
14670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14671 LDKUpdateFailMalformedHTLC o_conv;
14672 o_conv.inner = (void*)(o & (~1));
14673 o_conv.is_owned = (o & 1) || (o == 0);
14674 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
14675 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14676 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14677 return (uint64_t)ret_conv;
14680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14681 LDKDecodeError e_conv;
14682 e_conv.inner = (void*)(e & (~1));
14683 e_conv.is_owned = (e & 1) || (e == 0);
14684 e_conv = DecodeError_clone(&e_conv);
14685 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14686 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14687 return (uint64_t)ret_conv;
14690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14691 if ((_res & 1) != 0) return;
14692 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14694 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14698 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14699 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14700 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14701 return (uint64_t)ret_conv;
14704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14705 LDKUpdateFee o_conv;
14706 o_conv.inner = (void*)(o & (~1));
14707 o_conv.is_owned = (o & 1) || (o == 0);
14708 o_conv = UpdateFee_clone(&o_conv);
14709 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14710 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14711 return (uint64_t)ret_conv;
14714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14715 LDKDecodeError e_conv;
14716 e_conv.inner = (void*)(e & (~1));
14717 e_conv.is_owned = (e & 1) || (e == 0);
14718 e_conv = DecodeError_clone(&e_conv);
14719 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14720 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14721 return (uint64_t)ret_conv;
14724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14725 if ((_res & 1) != 0) return;
14726 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14728 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14732 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14733 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14734 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14735 return (uint64_t)ret_conv;
14738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14739 LDKUpdateFulfillHTLC o_conv;
14740 o_conv.inner = (void*)(o & (~1));
14741 o_conv.is_owned = (o & 1) || (o == 0);
14742 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14743 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14744 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14745 return (uint64_t)ret_conv;
14748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14749 LDKDecodeError e_conv;
14750 e_conv.inner = (void*)(e & (~1));
14751 e_conv.is_owned = (e & 1) || (e == 0);
14752 e_conv = DecodeError_clone(&e_conv);
14753 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14754 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14755 return (uint64_t)ret_conv;
14758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14759 if ((_res & 1) != 0) return;
14760 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14762 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14766 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14767 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14768 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14769 return (uint64_t)ret_conv;
14772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14773 LDKUpdateAddHTLC o_conv;
14774 o_conv.inner = (void*)(o & (~1));
14775 o_conv.is_owned = (o & 1) || (o == 0);
14776 o_conv = UpdateAddHTLC_clone(&o_conv);
14777 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14778 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14779 return (uint64_t)ret_conv;
14782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14783 LDKDecodeError e_conv;
14784 e_conv.inner = (void*)(e & (~1));
14785 e_conv.is_owned = (e & 1) || (e == 0);
14786 e_conv = DecodeError_clone(&e_conv);
14787 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14788 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14789 return (uint64_t)ret_conv;
14792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14793 if ((_res & 1) != 0) return;
14794 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14796 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14800 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14801 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14802 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14803 return (uint64_t)ret_conv;
14806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14808 o_conv.inner = (void*)(o & (~1));
14809 o_conv.is_owned = (o & 1) || (o == 0);
14810 o_conv = Ping_clone(&o_conv);
14811 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14812 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14813 return (uint64_t)ret_conv;
14816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14817 LDKDecodeError e_conv;
14818 e_conv.inner = (void*)(e & (~1));
14819 e_conv.is_owned = (e & 1) || (e == 0);
14820 e_conv = DecodeError_clone(&e_conv);
14821 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14822 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14823 return (uint64_t)ret_conv;
14826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14827 if ((_res & 1) != 0) return;
14828 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
14830 CResult_PingDecodeErrorZ_free(_res_conv);
14833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14834 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14835 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14836 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14837 return (uint64_t)ret_conv;
14840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14842 o_conv.inner = (void*)(o & (~1));
14843 o_conv.is_owned = (o & 1) || (o == 0);
14844 o_conv = Pong_clone(&o_conv);
14845 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14846 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14847 return (uint64_t)ret_conv;
14850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14851 LDKDecodeError e_conv;
14852 e_conv.inner = (void*)(e & (~1));
14853 e_conv.is_owned = (e & 1) || (e == 0);
14854 e_conv = DecodeError_clone(&e_conv);
14855 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14856 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14857 return (uint64_t)ret_conv;
14860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14861 if ((_res & 1) != 0) return;
14862 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
14864 CResult_PongDecodeErrorZ_free(_res_conv);
14867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14868 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14869 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14870 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14871 return (uint64_t)ret_conv;
14874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14875 LDKUnsignedChannelAnnouncement o_conv;
14876 o_conv.inner = (void*)(o & (~1));
14877 o_conv.is_owned = (o & 1) || (o == 0);
14878 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14879 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14880 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14881 return (uint64_t)ret_conv;
14884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14885 LDKDecodeError e_conv;
14886 e_conv.inner = (void*)(e & (~1));
14887 e_conv.is_owned = (e & 1) || (e == 0);
14888 e_conv = DecodeError_clone(&e_conv);
14889 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14890 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14891 return (uint64_t)ret_conv;
14894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14895 if ((_res & 1) != 0) return;
14896 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14898 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14902 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14903 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14904 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14905 return (uint64_t)ret_conv;
14908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14909 LDKChannelAnnouncement o_conv;
14910 o_conv.inner = (void*)(o & (~1));
14911 o_conv.is_owned = (o & 1) || (o == 0);
14912 o_conv = ChannelAnnouncement_clone(&o_conv);
14913 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14914 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14915 return (uint64_t)ret_conv;
14918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14919 LDKDecodeError e_conv;
14920 e_conv.inner = (void*)(e & (~1));
14921 e_conv.is_owned = (e & 1) || (e == 0);
14922 e_conv = DecodeError_clone(&e_conv);
14923 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14924 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14925 return (uint64_t)ret_conv;
14928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14929 if ((_res & 1) != 0) return;
14930 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14932 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14936 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14937 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14938 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14939 return (uint64_t)ret_conv;
14942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14943 LDKUnsignedChannelUpdate o_conv;
14944 o_conv.inner = (void*)(o & (~1));
14945 o_conv.is_owned = (o & 1) || (o == 0);
14946 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14947 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14948 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14949 return (uint64_t)ret_conv;
14952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14953 LDKDecodeError e_conv;
14954 e_conv.inner = (void*)(e & (~1));
14955 e_conv.is_owned = (e & 1) || (e == 0);
14956 e_conv = DecodeError_clone(&e_conv);
14957 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14958 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14959 return (uint64_t)ret_conv;
14962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14963 if ((_res & 1) != 0) return;
14964 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14966 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14970 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14971 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14972 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14973 return (uint64_t)ret_conv;
14976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14977 LDKChannelUpdate o_conv;
14978 o_conv.inner = (void*)(o & (~1));
14979 o_conv.is_owned = (o & 1) || (o == 0);
14980 o_conv = ChannelUpdate_clone(&o_conv);
14981 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14982 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14983 return (uint64_t)ret_conv;
14986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14987 LDKDecodeError e_conv;
14988 e_conv.inner = (void*)(e & (~1));
14989 e_conv.is_owned = (e & 1) || (e == 0);
14990 e_conv = DecodeError_clone(&e_conv);
14991 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14992 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14993 return (uint64_t)ret_conv;
14996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14997 if ((_res & 1) != 0) return;
14998 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
15000 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
15003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15004 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
15005 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15006 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
15007 return (uint64_t)ret_conv;
15010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15011 LDKErrorMessage o_conv;
15012 o_conv.inner = (void*)(o & (~1));
15013 o_conv.is_owned = (o & 1) || (o == 0);
15014 o_conv = ErrorMessage_clone(&o_conv);
15015 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15016 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
15017 return (uint64_t)ret_conv;
15020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15021 LDKDecodeError e_conv;
15022 e_conv.inner = (void*)(e & (~1));
15023 e_conv.is_owned = (e & 1) || (e == 0);
15024 e_conv = DecodeError_clone(&e_conv);
15025 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15026 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
15027 return (uint64_t)ret_conv;
15030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15031 if ((_res & 1) != 0) return;
15032 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
15034 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
15037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15038 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
15039 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15040 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
15041 return (uint64_t)ret_conv;
15044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15045 LDKUnsignedNodeAnnouncement o_conv;
15046 o_conv.inner = (void*)(o & (~1));
15047 o_conv.is_owned = (o & 1) || (o == 0);
15048 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
15049 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15050 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
15051 return (uint64_t)ret_conv;
15054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15055 LDKDecodeError e_conv;
15056 e_conv.inner = (void*)(e & (~1));
15057 e_conv.is_owned = (e & 1) || (e == 0);
15058 e_conv = DecodeError_clone(&e_conv);
15059 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15060 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
15061 return (uint64_t)ret_conv;
15064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15065 if ((_res & 1) != 0) return;
15066 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
15068 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
15071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15072 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
15073 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15074 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
15075 return (uint64_t)ret_conv;
15078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15079 LDKNodeAnnouncement o_conv;
15080 o_conv.inner = (void*)(o & (~1));
15081 o_conv.is_owned = (o & 1) || (o == 0);
15082 o_conv = NodeAnnouncement_clone(&o_conv);
15083 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15084 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
15085 return (uint64_t)ret_conv;
15088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15089 LDKDecodeError e_conv;
15090 e_conv.inner = (void*)(e & (~1));
15091 e_conv.is_owned = (e & 1) || (e == 0);
15092 e_conv = DecodeError_clone(&e_conv);
15093 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15094 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
15095 return (uint64_t)ret_conv;
15098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15099 if ((_res & 1) != 0) return;
15100 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
15102 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
15105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15106 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
15107 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15108 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
15109 return (uint64_t)ret_conv;
15112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15113 LDKQueryShortChannelIds o_conv;
15114 o_conv.inner = (void*)(o & (~1));
15115 o_conv.is_owned = (o & 1) || (o == 0);
15116 o_conv = QueryShortChannelIds_clone(&o_conv);
15117 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15118 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
15119 return (uint64_t)ret_conv;
15122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15123 LDKDecodeError e_conv;
15124 e_conv.inner = (void*)(e & (~1));
15125 e_conv.is_owned = (e & 1) || (e == 0);
15126 e_conv = DecodeError_clone(&e_conv);
15127 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15128 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
15129 return (uint64_t)ret_conv;
15132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15133 if ((_res & 1) != 0) return;
15134 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
15136 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
15139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15140 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
15141 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15142 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
15143 return (uint64_t)ret_conv;
15146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15147 LDKReplyShortChannelIdsEnd o_conv;
15148 o_conv.inner = (void*)(o & (~1));
15149 o_conv.is_owned = (o & 1) || (o == 0);
15150 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
15151 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15152 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
15153 return (uint64_t)ret_conv;
15156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15157 LDKDecodeError e_conv;
15158 e_conv.inner = (void*)(e & (~1));
15159 e_conv.is_owned = (e & 1) || (e == 0);
15160 e_conv = DecodeError_clone(&e_conv);
15161 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15162 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
15163 return (uint64_t)ret_conv;
15166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15167 if ((_res & 1) != 0) return;
15168 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
15170 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
15173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15174 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
15175 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15176 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
15177 return (uint64_t)ret_conv;
15180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15181 LDKQueryChannelRange o_conv;
15182 o_conv.inner = (void*)(o & (~1));
15183 o_conv.is_owned = (o & 1) || (o == 0);
15184 o_conv = QueryChannelRange_clone(&o_conv);
15185 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15186 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
15187 return (uint64_t)ret_conv;
15190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15191 LDKDecodeError e_conv;
15192 e_conv.inner = (void*)(e & (~1));
15193 e_conv.is_owned = (e & 1) || (e == 0);
15194 e_conv = DecodeError_clone(&e_conv);
15195 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15196 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
15197 return (uint64_t)ret_conv;
15200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15201 if ((_res & 1) != 0) return;
15202 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
15204 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
15207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15208 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
15209 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15210 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
15211 return (uint64_t)ret_conv;
15214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15215 LDKReplyChannelRange o_conv;
15216 o_conv.inner = (void*)(o & (~1));
15217 o_conv.is_owned = (o & 1) || (o == 0);
15218 o_conv = ReplyChannelRange_clone(&o_conv);
15219 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15220 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
15221 return (uint64_t)ret_conv;
15224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15225 LDKDecodeError e_conv;
15226 e_conv.inner = (void*)(e & (~1));
15227 e_conv.is_owned = (e & 1) || (e == 0);
15228 e_conv = DecodeError_clone(&e_conv);
15229 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15230 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
15231 return (uint64_t)ret_conv;
15234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15235 if ((_res & 1) != 0) return;
15236 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
15238 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
15241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15242 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
15243 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15244 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
15245 return (uint64_t)ret_conv;
15248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15249 LDKGossipTimestampFilter o_conv;
15250 o_conv.inner = (void*)(o & (~1));
15251 o_conv.is_owned = (o & 1) || (o == 0);
15252 o_conv = GossipTimestampFilter_clone(&o_conv);
15253 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15254 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
15255 return (uint64_t)ret_conv;
15258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15259 LDKDecodeError e_conv;
15260 e_conv.inner = (void*)(e & (~1));
15261 e_conv.is_owned = (e & 1) || (e == 0);
15262 e_conv = DecodeError_clone(&e_conv);
15263 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15264 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
15265 return (uint64_t)ret_conv;
15268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15269 if ((_res & 1) != 0) return;
15270 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
15272 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
15275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15276 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
15277 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15278 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
15279 return (uint64_t)ret_conv;
15282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15284 o_conv.inner = (void*)(o & (~1));
15285 o_conv.is_owned = (o & 1) || (o == 0);
15286 o_conv = Invoice_clone(&o_conv);
15287 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15288 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
15289 return (uint64_t)ret_conv;
15292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15293 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
15294 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
15295 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15296 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
15297 return (uint64_t)ret_conv;
15300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15301 if ((_res & 1) != 0) return;
15302 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
15304 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15308 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
15309 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15310 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
15311 return (uint64_t)ret_conv;
15314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15315 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
15316 if (o_conv.free == LDKFilter_JCalls_free) {
15317 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15318 LDKFilter_JCalls_cloned(&o_conv);
15320 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15321 *ret_copy = COption_FilterZ_some(o_conv);
15322 uint64_t ret_ref = (uint64_t)ret_copy;
15326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
15327 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15328 *ret_copy = COption_FilterZ_none();
15329 uint64_t ret_ref = (uint64_t)ret_copy;
15333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15334 if ((_res & 1) != 0) return;
15335 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
15337 COption_FilterZ_free(_res_conv);
15340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15341 LDKLockedChannelMonitor o_conv;
15342 o_conv.inner = (void*)(o & (~1));
15343 o_conv.is_owned = (o & 1) || (o == 0);
15344 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15345 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15346 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15347 return (uint64_t)ret_conv;
15350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
15351 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15352 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15353 return (uint64_t)ret_conv;
15356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15357 if ((_res & 1) != 0) return;
15358 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1);
15360 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15364 LDKCVec_OutPointZ _res_constr;
15365 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15366 if (_res_constr.datalen > 0)
15367 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15369 _res_constr.data = NULL;
15370 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15371 for (size_t k = 0; k < _res_constr.datalen; k++) {
15372 int64_t _res_conv_10 = _res_vals[k];
15373 LDKOutPoint _res_conv_10_conv;
15374 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15375 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15376 _res_constr.data[k] = _res_conv_10_conv;
15378 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15379 CVec_OutPointZ_free(_res_constr);
15382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15383 if ((this_ptr & 1) != 0) return;
15384 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
15385 FREE((void*)this_ptr);
15386 PaymentPurpose_free(this_ptr_conv);
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15390 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
15391 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15392 *ret_copy = PaymentPurpose_clone(orig_conv);
15393 uint64_t ret_ref = (uint64_t)ret_copy;
15397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
15398 LDKThirtyTwoBytes payment_preimage_ref;
15399 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15400 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15401 LDKThirtyTwoBytes payment_secret_ref;
15402 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15403 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15404 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15405 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
15406 uint64_t ret_ref = (uint64_t)ret_copy;
15410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
15411 LDKThirtyTwoBytes a_ref;
15412 CHECK((*env)->GetArrayLength(env, a) == 32);
15413 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
15414 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15415 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
15416 uint64_t ret_ref = (uint64_t)ret_copy;
15420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15421 if ((this_ptr & 1) != 0) return;
15422 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
15423 FREE((void*)this_ptr);
15424 ClosureReason_free(this_ptr_conv);
15427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15428 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
15429 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15430 *ret_copy = ClosureReason_clone(orig_conv);
15431 uint64_t ret_ref = (uint64_t)ret_copy;
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
15436 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
15437 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15438 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
15439 uint64_t ret_ref = (uint64_t)ret_copy;
15443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
15444 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15445 *ret_copy = ClosureReason_holder_force_closed();
15446 uint64_t ret_ref = (uint64_t)ret_copy;
15450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
15451 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15452 *ret_copy = ClosureReason_cooperative_closure();
15453 uint64_t ret_ref = (uint64_t)ret_copy;
15457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
15458 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15459 *ret_copy = ClosureReason_commitment_tx_confirmed();
15460 uint64_t ret_ref = (uint64_t)ret_copy;
15464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
15465 LDKStr err_conv = java_to_owned_str(env, err);
15466 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15467 *ret_copy = ClosureReason_processing_error(err_conv);
15468 uint64_t ret_ref = (uint64_t)ret_copy;
15472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
15473 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15474 *ret_copy = ClosureReason_disconnected_peer();
15475 uint64_t ret_ref = (uint64_t)ret_copy;
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
15480 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15481 *ret_copy = ClosureReason_outdated_channel_manager();
15482 uint64_t ret_ref = (uint64_t)ret_copy;
15486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
15487 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
15488 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
15489 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15490 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15491 CVec_u8Z_free(ret_var);
15495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15496 if ((this_ptr & 1) != 0) return;
15497 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
15498 FREE((void*)this_ptr);
15499 Event_free(this_ptr_conv);
15502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15503 LDKEvent* orig_conv = (LDKEvent*)orig;
15504 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15505 *ret_copy = Event_clone(orig_conv);
15506 uint64_t ret_ref = (uint64_t)ret_copy;
15510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
15511 LDKThirtyTwoBytes temporary_channel_id_ref;
15512 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15513 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
15514 LDKCVec_u8Z output_script_ref;
15515 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
15516 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
15517 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
15518 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15519 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
15520 uint64_t ret_ref = (uint64_t)ret_copy;
15524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
15525 LDKThirtyTwoBytes payment_hash_ref;
15526 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15527 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15528 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
15529 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
15530 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15531 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
15532 uint64_t ret_ref = (uint64_t)ret_copy;
15536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_hash) {
15537 LDKThirtyTwoBytes payment_preimage_ref;
15538 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15539 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15540 LDKThirtyTwoBytes payment_hash_ref;
15541 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15542 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15543 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15544 *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref);
15545 uint64_t ret_ref = (uint64_t)ret_copy;
15549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id) {
15550 LDKThirtyTwoBytes payment_hash_ref;
15551 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15552 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15553 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
15554 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
15555 LDKCVec_RouteHopZ path_constr;
15556 path_constr.datalen = (*env)->GetArrayLength(env, path);
15557 if (path_constr.datalen > 0)
15558 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15560 path_constr.data = NULL;
15561 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
15562 for (size_t k = 0; k < path_constr.datalen; k++) {
15563 int64_t path_conv_10 = path_vals[k];
15564 LDKRouteHop path_conv_10_conv;
15565 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
15566 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
15567 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
15568 path_constr.data[k] = path_conv_10_conv;
15570 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
15571 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1);
15572 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
15573 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15574 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv);
15575 uint64_t ret_ref = (uint64_t)ret_copy;
15579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
15580 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15581 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
15582 uint64_t ret_ref = (uint64_t)ret_copy;
15586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
15587 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
15588 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15589 if (outputs_constr.datalen > 0)
15590 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15592 outputs_constr.data = NULL;
15593 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15594 for (size_t b = 0; b < outputs_constr.datalen; b++) {
15595 int64_t outputs_conv_27 = outputs_vals[b];
15596 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
15597 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
15598 outputs_constr.data[b] = outputs_conv_27_conv;
15600 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15601 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15602 *ret_copy = Event_spendable_outputs(outputs_constr);
15603 uint64_t ret_ref = (uint64_t)ret_copy;
15607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
15608 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
15609 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
15610 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15611 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
15612 uint64_t ret_ref = (uint64_t)ret_copy;
15616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) {
15617 LDKThirtyTwoBytes channel_id_ref;
15618 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15619 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
15620 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
15621 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
15622 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15623 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
15624 uint64_t ret_ref = (uint64_t)ret_copy;
15628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
15629 LDKThirtyTwoBytes channel_id_ref;
15630 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15631 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
15632 LDKTransaction transaction_ref;
15633 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
15634 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
15635 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
15636 transaction_ref.data_is_owned = true;
15637 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15638 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
15639 uint64_t ret_ref = (uint64_t)ret_copy;
15643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
15644 LDKEvent* obj_conv = (LDKEvent*)obj;
15645 LDKCVec_u8Z ret_var = Event_write(obj_conv);
15646 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15647 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15648 CVec_u8Z_free(ret_var);
15652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15653 if ((this_ptr & 1) != 0) return;
15654 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
15655 FREE((void*)this_ptr);
15656 MessageSendEvent_free(this_ptr_conv);
15659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15660 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
15661 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15662 *ret_copy = MessageSendEvent_clone(orig_conv);
15663 uint64_t ret_ref = (uint64_t)ret_copy;
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15668 LDKPublicKey node_id_ref;
15669 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15670 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15671 LDKAcceptChannel msg_conv;
15672 msg_conv.inner = (void*)(msg & (~1));
15673 msg_conv.is_owned = (msg & 1) || (msg == 0);
15674 msg_conv = AcceptChannel_clone(&msg_conv);
15675 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15676 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
15677 uint64_t ret_ref = (uint64_t)ret_copy;
15681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15682 LDKPublicKey node_id_ref;
15683 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15684 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15685 LDKOpenChannel msg_conv;
15686 msg_conv.inner = (void*)(msg & (~1));
15687 msg_conv.is_owned = (msg & 1) || (msg == 0);
15688 msg_conv = OpenChannel_clone(&msg_conv);
15689 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15690 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
15691 uint64_t ret_ref = (uint64_t)ret_copy;
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15696 LDKPublicKey node_id_ref;
15697 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15698 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15699 LDKFundingCreated msg_conv;
15700 msg_conv.inner = (void*)(msg & (~1));
15701 msg_conv.is_owned = (msg & 1) || (msg == 0);
15702 msg_conv = FundingCreated_clone(&msg_conv);
15703 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15704 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
15705 uint64_t ret_ref = (uint64_t)ret_copy;
15709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15710 LDKPublicKey node_id_ref;
15711 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15712 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15713 LDKFundingSigned msg_conv;
15714 msg_conv.inner = (void*)(msg & (~1));
15715 msg_conv.is_owned = (msg & 1) || (msg == 0);
15716 msg_conv = FundingSigned_clone(&msg_conv);
15717 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15718 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
15719 uint64_t ret_ref = (uint64_t)ret_copy;
15723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15724 LDKPublicKey node_id_ref;
15725 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15726 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15727 LDKFundingLocked msg_conv;
15728 msg_conv.inner = (void*)(msg & (~1));
15729 msg_conv.is_owned = (msg & 1) || (msg == 0);
15730 msg_conv = FundingLocked_clone(&msg_conv);
15731 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15732 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
15733 uint64_t ret_ref = (uint64_t)ret_copy;
15737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15738 LDKPublicKey node_id_ref;
15739 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15740 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15741 LDKAnnouncementSignatures msg_conv;
15742 msg_conv.inner = (void*)(msg & (~1));
15743 msg_conv.is_owned = (msg & 1) || (msg == 0);
15744 msg_conv = AnnouncementSignatures_clone(&msg_conv);
15745 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15746 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
15747 uint64_t ret_ref = (uint64_t)ret_copy;
15751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
15752 LDKPublicKey node_id_ref;
15753 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15754 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15755 LDKCommitmentUpdate updates_conv;
15756 updates_conv.inner = (void*)(updates & (~1));
15757 updates_conv.is_owned = (updates & 1) || (updates == 0);
15758 updates_conv = CommitmentUpdate_clone(&updates_conv);
15759 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15760 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
15761 uint64_t ret_ref = (uint64_t)ret_copy;
15765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15766 LDKPublicKey node_id_ref;
15767 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15768 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15769 LDKRevokeAndACK msg_conv;
15770 msg_conv.inner = (void*)(msg & (~1));
15771 msg_conv.is_owned = (msg & 1) || (msg == 0);
15772 msg_conv = RevokeAndACK_clone(&msg_conv);
15773 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15774 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
15775 uint64_t ret_ref = (uint64_t)ret_copy;
15779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15780 LDKPublicKey node_id_ref;
15781 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15782 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15783 LDKClosingSigned msg_conv;
15784 msg_conv.inner = (void*)(msg & (~1));
15785 msg_conv.is_owned = (msg & 1) || (msg == 0);
15786 msg_conv = ClosingSigned_clone(&msg_conv);
15787 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15788 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
15789 uint64_t ret_ref = (uint64_t)ret_copy;
15793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15794 LDKPublicKey node_id_ref;
15795 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15796 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15797 LDKShutdown msg_conv;
15798 msg_conv.inner = (void*)(msg & (~1));
15799 msg_conv.is_owned = (msg & 1) || (msg == 0);
15800 msg_conv = Shutdown_clone(&msg_conv);
15801 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15802 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
15803 uint64_t ret_ref = (uint64_t)ret_copy;
15807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15808 LDKPublicKey node_id_ref;
15809 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15810 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15811 LDKChannelReestablish msg_conv;
15812 msg_conv.inner = (void*)(msg & (~1));
15813 msg_conv.is_owned = (msg & 1) || (msg == 0);
15814 msg_conv = ChannelReestablish_clone(&msg_conv);
15815 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15816 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
15817 uint64_t ret_ref = (uint64_t)ret_copy;
15821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
15822 LDKChannelAnnouncement msg_conv;
15823 msg_conv.inner = (void*)(msg & (~1));
15824 msg_conv.is_owned = (msg & 1) || (msg == 0);
15825 msg_conv = ChannelAnnouncement_clone(&msg_conv);
15826 LDKChannelUpdate update_msg_conv;
15827 update_msg_conv.inner = (void*)(update_msg & (~1));
15828 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
15829 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
15830 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15831 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
15832 uint64_t ret_ref = (uint64_t)ret_copy;
15836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
15837 LDKNodeAnnouncement msg_conv;
15838 msg_conv.inner = (void*)(msg & (~1));
15839 msg_conv.is_owned = (msg & 1) || (msg == 0);
15840 msg_conv = NodeAnnouncement_clone(&msg_conv);
15841 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15842 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
15843 uint64_t ret_ref = (uint64_t)ret_copy;
15847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
15848 LDKChannelUpdate msg_conv;
15849 msg_conv.inner = (void*)(msg & (~1));
15850 msg_conv.is_owned = (msg & 1) || (msg == 0);
15851 msg_conv = ChannelUpdate_clone(&msg_conv);
15852 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15853 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
15854 uint64_t ret_ref = (uint64_t)ret_copy;
15858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15859 LDKPublicKey node_id_ref;
15860 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15861 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15862 LDKChannelUpdate msg_conv;
15863 msg_conv.inner = (void*)(msg & (~1));
15864 msg_conv.is_owned = (msg & 1) || (msg == 0);
15865 msg_conv = ChannelUpdate_clone(&msg_conv);
15866 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15867 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
15868 uint64_t ret_ref = (uint64_t)ret_copy;
15872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
15873 LDKPublicKey node_id_ref;
15874 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15875 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15876 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
15877 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
15878 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15879 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
15880 uint64_t ret_ref = (uint64_t)ret_copy;
15884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15885 LDKPublicKey node_id_ref;
15886 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15887 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15888 LDKQueryChannelRange msg_conv;
15889 msg_conv.inner = (void*)(msg & (~1));
15890 msg_conv.is_owned = (msg & 1) || (msg == 0);
15891 msg_conv = QueryChannelRange_clone(&msg_conv);
15892 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15893 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
15894 uint64_t ret_ref = (uint64_t)ret_copy;
15898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15899 LDKPublicKey node_id_ref;
15900 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15901 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15902 LDKQueryShortChannelIds msg_conv;
15903 msg_conv.inner = (void*)(msg & (~1));
15904 msg_conv.is_owned = (msg & 1) || (msg == 0);
15905 msg_conv = QueryShortChannelIds_clone(&msg_conv);
15906 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15907 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
15908 uint64_t ret_ref = (uint64_t)ret_copy;
15912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15913 LDKPublicKey node_id_ref;
15914 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15915 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15916 LDKReplyChannelRange msg_conv;
15917 msg_conv.inner = (void*)(msg & (~1));
15918 msg_conv.is_owned = (msg & 1) || (msg == 0);
15919 msg_conv = ReplyChannelRange_clone(&msg_conv);
15920 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15921 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
15922 uint64_t ret_ref = (uint64_t)ret_copy;
15926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15927 if ((this_ptr & 1) != 0) return;
15928 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
15929 FREE((void*)this_ptr);
15930 MessageSendEventsProvider_free(this_ptr_conv);
15933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15934 if ((this_ptr & 1) != 0) return;
15935 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
15936 FREE((void*)this_ptr);
15937 EventsProvider_free(this_ptr_conv);
15940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15941 if ((this_ptr & 1) != 0) return;
15942 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
15943 FREE((void*)this_ptr);
15944 EventHandler_free(this_ptr_conv);
15947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15948 if ((this_ptr & 1) != 0) return;
15949 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
15950 FREE((void*)this_ptr);
15951 APIError_free(this_ptr_conv);
15954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15955 LDKAPIError* orig_conv = (LDKAPIError*)orig;
15956 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15957 *ret_copy = APIError_clone(orig_conv);
15958 uint64_t ret_ref = (uint64_t)ret_copy;
15962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
15963 LDKStr err_conv = java_to_owned_str(env, err);
15964 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15965 *ret_copy = APIError_apimisuse_error(err_conv);
15966 uint64_t ret_ref = (uint64_t)ret_copy;
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
15971 LDKStr err_conv = java_to_owned_str(env, err);
15972 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15973 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
15974 uint64_t ret_ref = (uint64_t)ret_copy;
15978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
15979 LDKStr err_conv = java_to_owned_str(env, err);
15980 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15981 *ret_copy = APIError_route_error(err_conv);
15982 uint64_t ret_ref = (uint64_t)ret_copy;
15986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
15987 LDKStr err_conv = java_to_owned_str(env, err);
15988 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15989 *ret_copy = APIError_channel_unavailable(err_conv);
15990 uint64_t ret_ref = (uint64_t)ret_copy;
15994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
15995 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15996 *ret_copy = APIError_monitor_update_failed();
15997 uint64_t ret_ref = (uint64_t)ret_copy;
16001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
16002 LDKShutdownScript script_conv;
16003 script_conv.inner = (void*)(script & (~1));
16004 script_conv.is_owned = (script & 1) || (script == 0);
16005 script_conv = ShutdownScript_clone(&script_conv);
16006 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16007 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16008 uint64_t ret_ref = (uint64_t)ret_copy;
16012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
16013 LDKu8slice msg_ref;
16014 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16015 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16016 unsigned char sk_arr[32];
16017 CHECK((*env)->GetArrayLength(env, sk) == 32);
16018 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
16019 unsigned char (*sk_ref)[32] = &sk_arr;
16020 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16021 *ret_conv = sign(msg_ref, sk_ref);
16022 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16023 return (uint64_t)ret_conv;
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
16027 LDKu8slice msg_ref;
16028 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16029 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16030 LDKStr sig_conv = java_to_owned_str(env, sig);
16031 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16032 *ret_conv = recover_pk(msg_ref, sig_conv);
16033 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16034 return (uint64_t)ret_conv;
16037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
16038 LDKu8slice msg_ref;
16039 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16040 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16041 LDKStr sig_conv = java_to_owned_str(env, sig);
16042 LDKPublicKey pk_ref;
16043 CHECK((*env)->GetArrayLength(env, pk) == 33);
16044 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
16045 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16046 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16051 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16052 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
16056 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
16057 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
16061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
16062 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
16066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
16067 jclass ret_conv = LDKLevel_to_java(env, Level_info());
16071 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
16072 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
16076 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
16077 jclass ret_conv = LDKLevel_to_java(env, Level_error());
16081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16082 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16083 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16084 jboolean ret_val = Level_eq(a_conv, b_conv);
16088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
16089 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16090 int64_t ret_val = Level_hash(o_conv);
16094 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
16095 jclass ret_conv = LDKLevel_to_java(env, Level_max());
16099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16100 if ((this_ptr & 1) != 0) return;
16101 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
16102 FREE((void*)this_ptr);
16103 Logger_free(this_ptr_conv);
16106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16107 LDKChannelHandshakeConfig this_obj_conv;
16108 this_obj_conv.inner = (void*)(this_obj & (~1));
16109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16110 ChannelHandshakeConfig_free(this_obj_conv);
16113 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16114 LDKChannelHandshakeConfig this_ptr_conv;
16115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16116 this_ptr_conv.is_owned = false;
16117 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
16121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16122 LDKChannelHandshakeConfig this_ptr_conv;
16123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16124 this_ptr_conv.is_owned = false;
16125 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
16128 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16129 LDKChannelHandshakeConfig this_ptr_conv;
16130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16131 this_ptr_conv.is_owned = false;
16132 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
16136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16137 LDKChannelHandshakeConfig this_ptr_conv;
16138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16139 this_ptr_conv.is_owned = false;
16140 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
16143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16144 LDKChannelHandshakeConfig this_ptr_conv;
16145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16146 this_ptr_conv.is_owned = false;
16147 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
16151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16152 LDKChannelHandshakeConfig this_ptr_conv;
16153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16154 this_ptr_conv.is_owned = false;
16155 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
16158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
16159 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
16160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16162 uint64_t ret_ref = (uint64_t)ret_var.inner;
16163 if (ret_var.is_owned) {
16169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16170 LDKChannelHandshakeConfig orig_conv;
16171 orig_conv.inner = (void*)(orig & (~1));
16172 orig_conv.is_owned = false;
16173 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
16174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16176 uint64_t ret_ref = (uint64_t)ret_var.inner;
16177 if (ret_var.is_owned) {
16183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
16184 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
16185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16187 uint64_t ret_ref = (uint64_t)ret_var.inner;
16188 if (ret_var.is_owned) {
16194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16195 LDKChannelHandshakeLimits this_obj_conv;
16196 this_obj_conv.inner = (void*)(this_obj & (~1));
16197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16198 ChannelHandshakeLimits_free(this_obj_conv);
16201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16202 LDKChannelHandshakeLimits this_ptr_conv;
16203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16204 this_ptr_conv.is_owned = false;
16205 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
16209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16210 LDKChannelHandshakeLimits this_ptr_conv;
16211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16212 this_ptr_conv.is_owned = false;
16213 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
16216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16217 LDKChannelHandshakeLimits this_ptr_conv;
16218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16219 this_ptr_conv.is_owned = false;
16220 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
16224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16225 LDKChannelHandshakeLimits this_ptr_conv;
16226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16227 this_ptr_conv.is_owned = false;
16228 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
16231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16232 LDKChannelHandshakeLimits this_ptr_conv;
16233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16234 this_ptr_conv.is_owned = false;
16235 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
16239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16240 LDKChannelHandshakeLimits this_ptr_conv;
16241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16242 this_ptr_conv.is_owned = false;
16243 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16247 LDKChannelHandshakeLimits this_ptr_conv;
16248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16249 this_ptr_conv.is_owned = false;
16250 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
16254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16255 LDKChannelHandshakeLimits this_ptr_conv;
16256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16257 this_ptr_conv.is_owned = false;
16258 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
16261 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16262 LDKChannelHandshakeLimits this_ptr_conv;
16263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16264 this_ptr_conv.is_owned = false;
16265 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
16269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16270 LDKChannelHandshakeLimits this_ptr_conv;
16271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16272 this_ptr_conv.is_owned = false;
16273 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
16276 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16277 LDKChannelHandshakeLimits this_ptr_conv;
16278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16279 this_ptr_conv.is_owned = false;
16280 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
16284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16285 LDKChannelHandshakeLimits this_ptr_conv;
16286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16287 this_ptr_conv.is_owned = false;
16288 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
16291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
16292 LDKChannelHandshakeLimits this_ptr_conv;
16293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16294 this_ptr_conv.is_owned = false;
16295 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
16299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16300 LDKChannelHandshakeLimits this_ptr_conv;
16301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16302 this_ptr_conv.is_owned = false;
16303 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
16306 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16307 LDKChannelHandshakeLimits this_ptr_conv;
16308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16309 this_ptr_conv.is_owned = false;
16310 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
16314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16315 LDKChannelHandshakeLimits this_ptr_conv;
16316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16317 this_ptr_conv.is_owned = false;
16318 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
16321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
16322 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
16323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16325 uint64_t ret_ref = (uint64_t)ret_var.inner;
16326 if (ret_var.is_owned) {
16332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16333 LDKChannelHandshakeLimits orig_conv;
16334 orig_conv.inner = (void*)(orig & (~1));
16335 orig_conv.is_owned = false;
16336 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
16337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16339 uint64_t ret_ref = (uint64_t)ret_var.inner;
16340 if (ret_var.is_owned) {
16346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
16347 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
16348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16350 uint64_t ret_ref = (uint64_t)ret_var.inner;
16351 if (ret_var.is_owned) {
16357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16358 LDKChannelConfig this_obj_conv;
16359 this_obj_conv.inner = (void*)(this_obj & (~1));
16360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16361 ChannelConfig_free(this_obj_conv);
16364 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16365 LDKChannelConfig this_ptr_conv;
16366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16367 this_ptr_conv.is_owned = false;
16368 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
16372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16373 LDKChannelConfig this_ptr_conv;
16374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16375 this_ptr_conv.is_owned = false;
16376 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
16379 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16380 LDKChannelConfig this_ptr_conv;
16381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16382 this_ptr_conv.is_owned = false;
16383 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
16387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16388 LDKChannelConfig this_ptr_conv;
16389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16390 this_ptr_conv.is_owned = false;
16391 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
16394 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16395 LDKChannelConfig this_ptr_conv;
16396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16397 this_ptr_conv.is_owned = false;
16398 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
16402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16403 LDKChannelConfig this_ptr_conv;
16404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16405 this_ptr_conv.is_owned = false;
16406 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
16409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
16410 LDKChannelConfig this_ptr_conv;
16411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16412 this_ptr_conv.is_owned = false;
16413 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
16417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16418 LDKChannelConfig this_ptr_conv;
16419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16420 this_ptr_conv.is_owned = false;
16421 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
16424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16425 LDKChannelConfig this_ptr_conv;
16426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16427 this_ptr_conv.is_owned = false;
16428 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
16432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16433 LDKChannelConfig this_ptr_conv;
16434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16435 this_ptr_conv.is_owned = false;
16436 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
16439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16440 LDKChannelConfig this_ptr_conv;
16441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16442 this_ptr_conv.is_owned = false;
16443 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
16447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16448 LDKChannelConfig this_ptr_conv;
16449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16450 this_ptr_conv.is_owned = false;
16451 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
16454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16455 LDKChannelConfig this_ptr_conv;
16456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16457 this_ptr_conv.is_owned = false;
16458 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
16462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16463 LDKChannelConfig this_ptr_conv;
16464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16465 this_ptr_conv.is_owned = false;
16466 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
16469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
16470 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
16471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16473 uint64_t ret_ref = (uint64_t)ret_var.inner;
16474 if (ret_var.is_owned) {
16480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16481 LDKChannelConfig orig_conv;
16482 orig_conv.inner = (void*)(orig & (~1));
16483 orig_conv.is_owned = false;
16484 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
16485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16487 uint64_t ret_ref = (uint64_t)ret_var.inner;
16488 if (ret_var.is_owned) {
16494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
16495 LDKChannelConfig ret_var = ChannelConfig_default();
16496 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16497 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16498 uint64_t ret_ref = (uint64_t)ret_var.inner;
16499 if (ret_var.is_owned) {
16505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
16506 LDKChannelConfig obj_conv;
16507 obj_conv.inner = (void*)(obj & (~1));
16508 obj_conv.is_owned = false;
16509 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
16510 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16511 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16512 CVec_u8Z_free(ret_var);
16516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16517 LDKu8slice ser_ref;
16518 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16519 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16520 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16521 *ret_conv = ChannelConfig_read(ser_ref);
16522 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16523 return (uint64_t)ret_conv;
16526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16527 LDKUserConfig this_obj_conv;
16528 this_obj_conv.inner = (void*)(this_obj & (~1));
16529 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16530 UserConfig_free(this_obj_conv);
16533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16534 LDKUserConfig this_ptr_conv;
16535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16536 this_ptr_conv.is_owned = false;
16537 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
16538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16540 uint64_t ret_ref = (uint64_t)ret_var.inner;
16541 if (ret_var.is_owned) {
16547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16548 LDKUserConfig this_ptr_conv;
16549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16550 this_ptr_conv.is_owned = false;
16551 LDKChannelHandshakeConfig val_conv;
16552 val_conv.inner = (void*)(val & (~1));
16553 val_conv.is_owned = (val & 1) || (val == 0);
16554 val_conv = ChannelHandshakeConfig_clone(&val_conv);
16555 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
16558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
16559 LDKUserConfig this_ptr_conv;
16560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16561 this_ptr_conv.is_owned = false;
16562 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
16563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16565 uint64_t ret_ref = (uint64_t)ret_var.inner;
16566 if (ret_var.is_owned) {
16572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16573 LDKUserConfig this_ptr_conv;
16574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16575 this_ptr_conv.is_owned = false;
16576 LDKChannelHandshakeLimits val_conv;
16577 val_conv.inner = (void*)(val & (~1));
16578 val_conv.is_owned = (val & 1) || (val == 0);
16579 val_conv = ChannelHandshakeLimits_clone(&val_conv);
16580 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
16583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
16584 LDKUserConfig this_ptr_conv;
16585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16586 this_ptr_conv.is_owned = false;
16587 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
16588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16590 uint64_t ret_ref = (uint64_t)ret_var.inner;
16591 if (ret_var.is_owned) {
16597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16598 LDKUserConfig this_ptr_conv;
16599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16600 this_ptr_conv.is_owned = false;
16601 LDKChannelConfig val_conv;
16602 val_conv.inner = (void*)(val & (~1));
16603 val_conv.is_owned = (val & 1) || (val == 0);
16604 val_conv = ChannelConfig_clone(&val_conv);
16605 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
16608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
16609 LDKUserConfig this_ptr_conv;
16610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16611 this_ptr_conv.is_owned = false;
16612 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
16616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16617 LDKUserConfig this_ptr_conv;
16618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16619 this_ptr_conv.is_owned = false;
16620 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
16623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) {
16624 LDKChannelHandshakeConfig own_channel_config_arg_conv;
16625 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
16626 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
16627 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
16628 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
16629 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
16630 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
16631 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
16632 LDKChannelConfig channel_options_arg_conv;
16633 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
16634 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
16635 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
16636 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg);
16637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16639 uint64_t ret_ref = (uint64_t)ret_var.inner;
16640 if (ret_var.is_owned) {
16646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16647 LDKUserConfig orig_conv;
16648 orig_conv.inner = (void*)(orig & (~1));
16649 orig_conv.is_owned = false;
16650 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
16651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16653 uint64_t ret_ref = (uint64_t)ret_var.inner;
16654 if (ret_var.is_owned) {
16660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
16661 LDKUserConfig ret_var = UserConfig_default();
16662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16664 uint64_t ret_ref = (uint64_t)ret_var.inner;
16665 if (ret_var.is_owned) {
16671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16672 LDKBestBlock this_obj_conv;
16673 this_obj_conv.inner = (void*)(this_obj & (~1));
16674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16675 BestBlock_free(this_obj_conv);
16678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16679 LDKBestBlock orig_conv;
16680 orig_conv.inner = (void*)(orig & (~1));
16681 orig_conv.is_owned = false;
16682 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
16683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16685 uint64_t ret_ref = (uint64_t)ret_var.inner;
16686 if (ret_var.is_owned) {
16692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
16693 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
16694 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
16695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16697 uint64_t ret_ref = (uint64_t)ret_var.inner;
16698 if (ret_var.is_owned) {
16704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
16705 LDKThirtyTwoBytes block_hash_ref;
16706 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
16707 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
16708 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
16709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16711 uint64_t ret_ref = (uint64_t)ret_var.inner;
16712 if (ret_var.is_owned) {
16718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
16719 LDKBestBlock this_arg_conv;
16720 this_arg_conv.inner = (void*)(this_arg & (~1));
16721 this_arg_conv.is_owned = false;
16722 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16723 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
16727 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
16728 LDKBestBlock this_arg_conv;
16729 this_arg_conv.inner = (void*)(this_arg & (~1));
16730 this_arg_conv.is_owned = false;
16731 int32_t ret_val = BestBlock_height(&this_arg_conv);
16735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16736 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
16737 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
16741 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
16742 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
16746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
16747 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
16751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16752 if ((this_ptr & 1) != 0) return;
16753 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
16754 FREE((void*)this_ptr);
16755 Access_free(this_ptr_conv);
16758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16759 if ((this_ptr & 1) != 0) return;
16760 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
16761 FREE((void*)this_ptr);
16762 Listen_free(this_ptr_conv);
16765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16766 if ((this_ptr & 1) != 0) return;
16767 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
16768 FREE((void*)this_ptr);
16769 Confirm_free(this_ptr_conv);
16772 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16773 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
16774 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
16778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
16779 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
16783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
16784 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
16788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16789 if ((this_ptr & 1) != 0) return;
16790 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
16791 FREE((void*)this_ptr);
16792 Watch_free(this_ptr_conv);
16795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16796 if ((this_ptr & 1) != 0) return;
16797 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
16798 FREE((void*)this_ptr);
16799 Filter_free(this_ptr_conv);
16802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16803 LDKWatchedOutput this_obj_conv;
16804 this_obj_conv.inner = (void*)(this_obj & (~1));
16805 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16806 WatchedOutput_free(this_obj_conv);
16809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16810 LDKWatchedOutput this_ptr_conv;
16811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16812 this_ptr_conv.is_owned = false;
16813 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16814 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
16818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16819 LDKWatchedOutput this_ptr_conv;
16820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16821 this_ptr_conv.is_owned = false;
16822 LDKThirtyTwoBytes val_ref;
16823 CHECK((*env)->GetArrayLength(env, val) == 32);
16824 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16825 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
16828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16829 LDKWatchedOutput this_ptr_conv;
16830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16831 this_ptr_conv.is_owned = false;
16832 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
16833 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16834 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16835 uint64_t ret_ref = (uint64_t)ret_var.inner;
16836 if (ret_var.is_owned) {
16842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16843 LDKWatchedOutput this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = false;
16846 LDKOutPoint val_conv;
16847 val_conv.inner = (void*)(val & (~1));
16848 val_conv.is_owned = (val & 1) || (val == 0);
16849 val_conv = OutPoint_clone(&val_conv);
16850 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
16853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16854 LDKWatchedOutput this_ptr_conv;
16855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16856 this_ptr_conv.is_owned = false;
16857 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
16858 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16859 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16864 LDKWatchedOutput this_ptr_conv;
16865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16866 this_ptr_conv.is_owned = false;
16867 LDKCVec_u8Z val_ref;
16868 val_ref.datalen = (*env)->GetArrayLength(env, val);
16869 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16870 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16871 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
16874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
16875 LDKThirtyTwoBytes block_hash_arg_ref;
16876 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
16877 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
16878 LDKOutPoint outpoint_arg_conv;
16879 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16880 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16881 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16882 LDKCVec_u8Z script_pubkey_arg_ref;
16883 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
16884 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16885 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
16886 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
16887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16889 uint64_t ret_ref = (uint64_t)ret_var.inner;
16890 if (ret_var.is_owned) {
16896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16897 LDKWatchedOutput orig_conv;
16898 orig_conv.inner = (void*)(orig & (~1));
16899 orig_conv.is_owned = false;
16900 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
16901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16903 uint64_t ret_ref = (uint64_t)ret_var.inner;
16904 if (ret_var.is_owned) {
16910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
16911 LDKWatchedOutput o_conv;
16912 o_conv.inner = (void*)(o & (~1));
16913 o_conv.is_owned = false;
16914 int64_t ret_val = WatchedOutput_hash(&o_conv);
16918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16919 if ((this_ptr & 1) != 0) return;
16920 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
16921 FREE((void*)this_ptr);
16922 BroadcasterInterface_free(this_ptr_conv);
16925 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16926 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
16927 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
16931 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
16932 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
16936 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
16937 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
16941 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
16942 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
16946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16947 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
16948 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
16949 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
16953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16954 if ((this_ptr & 1) != 0) return;
16955 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
16956 FREE((void*)this_ptr);
16957 FeeEstimator_free(this_ptr_conv);
16960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16961 if ((this_ptr & 1) != 0) return;
16962 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
16963 FREE((void*)this_ptr);
16964 Persist_free(this_ptr_conv);
16967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16968 LDKLockedChannelMonitor this_obj_conv;
16969 this_obj_conv.inner = (void*)(this_obj & (~1));
16970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16971 LockedChannelMonitor_free(this_obj_conv);
16974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16975 LDKChainMonitor this_obj_conv;
16976 this_obj_conv.inner = (void*)(this_obj & (~1));
16977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16978 ChainMonitor_free(this_obj_conv);
16981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
16982 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
16983 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
16984 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
16985 // Manually implement clone for Java trait instances
16986 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
16987 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16988 LDKFilter_JCalls_cloned(&chain_source_conv.some);
16991 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16992 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16993 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16994 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16996 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16997 if (logger_conv.free == LDKLogger_JCalls_free) {
16998 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16999 LDKLogger_JCalls_cloned(&logger_conv);
17001 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
17002 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
17003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17004 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
17006 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
17007 if (persister_conv.free == LDKPersist_JCalls_free) {
17008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17009 LDKPersist_JCalls_cloned(&persister_conv);
17011 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
17012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17014 uint64_t ret_ref = (uint64_t)ret_var.inner;
17015 if (ret_var.is_owned) {
17021 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
17022 LDKChainMonitor this_arg_conv;
17023 this_arg_conv.inner = (void*)(this_arg & (~1));
17024 this_arg_conv.is_owned = false;
17025 LDKCVec_ChannelDetailsZ ignored_channels_constr;
17026 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
17027 if (ignored_channels_constr.datalen > 0)
17028 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17030 ignored_channels_constr.data = NULL;
17031 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
17032 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
17033 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
17034 LDKChannelDetails ignored_channels_conv_16_conv;
17035 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
17036 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
17037 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
17038 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
17040 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
17041 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
17042 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17043 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17044 for (size_t j = 0; j < ret_var.datalen; j++) {
17045 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17046 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
17047 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
17048 ret_arr_ptr[j] = ret_conv_9_ref;
17050 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17051 FREE(ret_var.data);
17055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
17056 LDKChainMonitor this_arg_conv;
17057 this_arg_conv.inner = (void*)(this_arg & (~1));
17058 this_arg_conv.is_owned = false;
17059 LDKOutPoint funding_txo_conv;
17060 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17061 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
17062 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
17063 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
17064 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
17065 return (uint64_t)ret_conv;
17068 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
17069 LDKChainMonitor this_arg_conv;
17070 this_arg_conv.inner = (void*)(this_arg & (~1));
17071 this_arg_conv.is_owned = false;
17072 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
17073 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17074 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17075 for (size_t k = 0; k < ret_var.datalen; k++) {
17076 LDKOutPoint ret_conv_10_var = ret_var.data[k];
17077 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17078 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17079 uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
17080 if (ret_conv_10_var.is_owned) {
17081 ret_conv_10_ref |= 1;
17083 ret_arr_ptr[k] = ret_conv_10_ref;
17085 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17086 FREE(ret_var.data);
17090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
17091 LDKChainMonitor this_arg_conv;
17092 this_arg_conv.inner = (void*)(this_arg & (~1));
17093 this_arg_conv.is_owned = false;
17094 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
17095 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
17096 return (uint64_t)ret_ret;
17099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
17100 LDKChainMonitor this_arg_conv;
17101 this_arg_conv.inner = (void*)(this_arg & (~1));
17102 this_arg_conv.is_owned = false;
17103 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17104 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
17105 return (uint64_t)ret_ret;
17108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
17109 LDKChainMonitor this_arg_conv;
17110 this_arg_conv.inner = (void*)(this_arg & (~1));
17111 this_arg_conv.is_owned = false;
17112 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
17113 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
17114 return (uint64_t)ret_ret;
17117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17118 LDKChainMonitor this_arg_conv;
17119 this_arg_conv.inner = (void*)(this_arg & (~1));
17120 this_arg_conv.is_owned = false;
17121 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17122 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
17123 return (uint64_t)ret_ret;
17126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17127 LDKChannelMonitorUpdate this_obj_conv;
17128 this_obj_conv.inner = (void*)(this_obj & (~1));
17129 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17130 ChannelMonitorUpdate_free(this_obj_conv);
17133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17134 LDKChannelMonitorUpdate this_ptr_conv;
17135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17136 this_ptr_conv.is_owned = false;
17137 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
17141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17142 LDKChannelMonitorUpdate this_ptr_conv;
17143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17144 this_ptr_conv.is_owned = false;
17145 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
17148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17149 LDKChannelMonitorUpdate orig_conv;
17150 orig_conv.inner = (void*)(orig & (~1));
17151 orig_conv.is_owned = false;
17152 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
17153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17155 uint64_t ret_ref = (uint64_t)ret_var.inner;
17156 if (ret_var.is_owned) {
17162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17163 LDKChannelMonitorUpdate obj_conv;
17164 obj_conv.inner = (void*)(obj & (~1));
17165 obj_conv.is_owned = false;
17166 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
17167 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17168 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17169 CVec_u8Z_free(ret_var);
17173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17174 LDKu8slice ser_ref;
17175 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17176 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17177 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17178 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
17179 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17180 return (uint64_t)ret_conv;
17183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17184 LDKMonitorUpdateError this_obj_conv;
17185 this_obj_conv.inner = (void*)(this_obj & (~1));
17186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17187 MonitorUpdateError_free(this_obj_conv);
17190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17191 LDKMonitorUpdateError orig_conv;
17192 orig_conv.inner = (void*)(orig & (~1));
17193 orig_conv.is_owned = false;
17194 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
17195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17197 uint64_t ret_ref = (uint64_t)ret_var.inner;
17198 if (ret_var.is_owned) {
17204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17205 if ((this_ptr & 1) != 0) return;
17206 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
17207 FREE((void*)this_ptr);
17208 MonitorEvent_free(this_ptr_conv);
17211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17212 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
17213 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17214 *ret_copy = MonitorEvent_clone(orig_conv);
17215 uint64_t ret_ref = (uint64_t)ret_copy;
17219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
17220 LDKHTLCUpdate a_conv;
17221 a_conv.inner = (void*)(a & (~1));
17222 a_conv.is_owned = (a & 1) || (a == 0);
17223 a_conv = HTLCUpdate_clone(&a_conv);
17224 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17225 *ret_copy = MonitorEvent_htlcevent(a_conv);
17226 uint64_t ret_ref = (uint64_t)ret_copy;
17230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
17231 LDKOutPoint a_conv;
17232 a_conv.inner = (void*)(a & (~1));
17233 a_conv.is_owned = (a & 1) || (a == 0);
17234 a_conv = OutPoint_clone(&a_conv);
17235 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17236 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
17237 uint64_t ret_ref = (uint64_t)ret_copy;
17241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17242 LDKHTLCUpdate this_obj_conv;
17243 this_obj_conv.inner = (void*)(this_obj & (~1));
17244 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17245 HTLCUpdate_free(this_obj_conv);
17248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17249 LDKHTLCUpdate orig_conv;
17250 orig_conv.inner = (void*)(orig & (~1));
17251 orig_conv.is_owned = false;
17252 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
17253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17255 uint64_t ret_ref = (uint64_t)ret_var.inner;
17256 if (ret_var.is_owned) {
17262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17263 LDKHTLCUpdate obj_conv;
17264 obj_conv.inner = (void*)(obj & (~1));
17265 obj_conv.is_owned = false;
17266 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
17267 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17268 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17269 CVec_u8Z_free(ret_var);
17273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17274 LDKu8slice ser_ref;
17275 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17276 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17277 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17278 *ret_conv = HTLCUpdate_read(ser_ref);
17279 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17280 return (uint64_t)ret_conv;
17283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17284 if ((this_ptr & 1) != 0) return;
17285 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
17286 FREE((void*)this_ptr);
17287 Balance_free(this_ptr_conv);
17290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17291 LDKBalance* orig_conv = (LDKBalance*)orig;
17292 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17293 *ret_copy = Balance_clone(orig_conv);
17294 uint64_t ret_ref = (uint64_t)ret_copy;
17298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
17299 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17300 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
17301 uint64_t ret_ref = (uint64_t)ret_copy;
17305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
17306 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17307 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
17308 uint64_t ret_ref = (uint64_t)ret_copy;
17312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
17313 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17314 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
17315 uint64_t ret_ref = (uint64_t)ret_copy;
17319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
17320 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17321 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
17322 uint64_t ret_ref = (uint64_t)ret_copy;
17326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17327 LDKBalance* a_conv = (LDKBalance*)a;
17328 LDKBalance* b_conv = (LDKBalance*)b;
17329 jboolean ret_val = Balance_eq(a_conv, b_conv);
17333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17334 LDKChannelMonitor this_obj_conv;
17335 this_obj_conv.inner = (void*)(this_obj & (~1));
17336 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17337 ChannelMonitor_free(this_obj_conv);
17340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17341 LDKChannelMonitor orig_conv;
17342 orig_conv.inner = (void*)(orig & (~1));
17343 orig_conv.is_owned = false;
17344 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
17345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17347 uint64_t ret_ref = (uint64_t)ret_var.inner;
17348 if (ret_var.is_owned) {
17354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17355 LDKChannelMonitor obj_conv;
17356 obj_conv.inner = (void*)(obj & (~1));
17357 obj_conv.is_owned = false;
17358 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
17359 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17360 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17361 CVec_u8Z_free(ret_var);
17365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17366 LDKChannelMonitor this_arg_conv;
17367 this_arg_conv.inner = (void*)(this_arg & (~1));
17368 this_arg_conv.is_owned = false;
17369 LDKChannelMonitorUpdate updates_conv;
17370 updates_conv.inner = (void*)(updates & (~1));
17371 updates_conv.is_owned = false;
17372 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17373 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17374 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
17375 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
17376 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
17377 return (uint64_t)ret_conv;
17380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17381 LDKChannelMonitor this_arg_conv;
17382 this_arg_conv.inner = (void*)(this_arg & (~1));
17383 this_arg_conv.is_owned = false;
17384 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
17388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
17389 LDKChannelMonitor this_arg_conv;
17390 this_arg_conv.inner = (void*)(this_arg & (~1));
17391 this_arg_conv.is_owned = false;
17392 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17393 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
17394 return ((uint64_t)ret_conv);
17397 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
17398 LDKChannelMonitor this_arg_conv;
17399 this_arg_conv.inner = (void*)(this_arg & (~1));
17400 this_arg_conv.is_owned = false;
17401 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
17402 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17403 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17404 for (size_t o = 0; o < ret_var.datalen; o++) {
17405 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17406 *ret_conv_40_conv = ret_var.data[o];
17407 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
17409 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17410 FREE(ret_var.data);
17414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
17415 LDKChannelMonitor this_arg_conv;
17416 this_arg_conv.inner = (void*)(this_arg & (~1));
17417 this_arg_conv.is_owned = false;
17418 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
17419 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
17422 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17423 LDKChannelMonitor this_arg_conv;
17424 this_arg_conv.inner = (void*)(this_arg & (~1));
17425 this_arg_conv.is_owned = false;
17426 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
17427 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17428 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17429 for (size_t o = 0; o < ret_var.datalen; o++) {
17430 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17431 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
17432 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
17433 ret_arr_ptr[o] = ret_conv_14_ref;
17435 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17436 FREE(ret_var.data);
17440 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17441 LDKChannelMonitor this_arg_conv;
17442 this_arg_conv.inner = (void*)(this_arg & (~1));
17443 this_arg_conv.is_owned = false;
17444 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
17445 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17446 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17447 for (size_t h = 0; h < ret_var.datalen; h++) {
17448 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17449 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
17450 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
17451 ret_arr_ptr[h] = ret_conv_7_ref;
17453 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17454 FREE(ret_var.data);
17458 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
17459 LDKChannelMonitor this_arg_conv;
17460 this_arg_conv.inner = (void*)(this_arg & (~1));
17461 this_arg_conv.is_owned = false;
17462 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
17463 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
17464 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17466 for (size_t i = 0; i < ret_var.datalen; i++) {
17467 LDKTransaction ret_conv_8_var = ret_var.data[i];
17468 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
17469 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
17470 Transaction_free(ret_conv_8_var);
17471 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17473 FREE(ret_var.data);
17477 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17478 LDKChannelMonitor this_arg_conv;
17479 this_arg_conv.inner = (void*)(this_arg & (~1));
17480 this_arg_conv.is_owned = false;
17481 unsigned char header_arr[80];
17482 CHECK((*env)->GetArrayLength(env, header) == 80);
17483 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17484 unsigned char (*header_ref)[80] = &header_arr;
17485 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
17486 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
17487 if (txdata_constr.datalen > 0)
17488 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17490 txdata_constr.data = NULL;
17491 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
17492 for (size_t c = 0; c < txdata_constr.datalen; c++) {
17493 int64_t txdata_conv_28 = txdata_vals[c];
17494 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
17495 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
17496 txdata_constr.data[c] = txdata_conv_28_conv;
17498 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
17499 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17500 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17502 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17504 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17505 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17506 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17507 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17509 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17510 if (logger_conv.free == LDKLogger_JCalls_free) {
17511 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17512 LDKLogger_JCalls_cloned(&logger_conv);
17514 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
17515 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17516 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17517 for (size_t n = 0; n < ret_var.datalen; n++) {
17518 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17519 *ret_conv_39_conv = ret_var.data[n];
17520 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
17522 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17523 FREE(ret_var.data);
17527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17528 LDKChannelMonitor this_arg_conv;
17529 this_arg_conv.inner = (void*)(this_arg & (~1));
17530 this_arg_conv.is_owned = false;
17531 unsigned char header_arr[80];
17532 CHECK((*env)->GetArrayLength(env, header) == 80);
17533 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17534 unsigned char (*header_ref)[80] = &header_arr;
17535 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17536 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17537 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17538 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17540 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17541 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17542 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17543 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17545 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17546 if (logger_conv.free == LDKLogger_JCalls_free) {
17547 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17548 LDKLogger_JCalls_cloned(&logger_conv);
17550 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
17553 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17554 LDKChannelMonitor this_arg_conv;
17555 this_arg_conv.inner = (void*)(this_arg & (~1));
17556 this_arg_conv.is_owned = false;
17557 unsigned char header_arr[80];
17558 CHECK((*env)->GetArrayLength(env, header) == 80);
17559 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17560 unsigned char (*header_ref)[80] = &header_arr;
17561 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
17562 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
17563 if (txdata_constr.datalen > 0)
17564 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17566 txdata_constr.data = NULL;
17567 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
17568 for (size_t c = 0; c < txdata_constr.datalen; c++) {
17569 int64_t txdata_conv_28 = txdata_vals[c];
17570 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
17571 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
17572 txdata_constr.data[c] = txdata_conv_28_conv;
17574 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
17575 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17576 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17577 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17578 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17580 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17581 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17582 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17583 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17585 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17586 if (logger_conv.free == LDKLogger_JCalls_free) {
17587 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17588 LDKLogger_JCalls_cloned(&logger_conv);
17590 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
17591 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17592 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17593 for (size_t n = 0; n < ret_var.datalen; n++) {
17594 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17595 *ret_conv_39_conv = ret_var.data[n];
17596 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
17598 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17599 FREE(ret_var.data);
17603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17604 LDKChannelMonitor this_arg_conv;
17605 this_arg_conv.inner = (void*)(this_arg & (~1));
17606 this_arg_conv.is_owned = false;
17607 unsigned char txid_arr[32];
17608 CHECK((*env)->GetArrayLength(env, txid) == 32);
17609 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
17610 unsigned char (*txid_ref)[32] = &txid_arr;
17611 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17612 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17613 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17614 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17616 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17617 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17618 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17619 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17621 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17622 if (logger_conv.free == LDKLogger_JCalls_free) {
17623 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17624 LDKLogger_JCalls_cloned(&logger_conv);
17626 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
17629 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
17630 LDKChannelMonitor this_arg_conv;
17631 this_arg_conv.inner = (void*)(this_arg & (~1));
17632 this_arg_conv.is_owned = false;
17633 unsigned char header_arr[80];
17634 CHECK((*env)->GetArrayLength(env, header) == 80);
17635 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17636 unsigned char (*header_ref)[80] = &header_arr;
17637 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17638 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17639 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17640 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17642 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17643 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17644 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17645 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17647 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17648 if (logger_conv.free == LDKLogger_JCalls_free) {
17649 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17650 LDKLogger_JCalls_cloned(&logger_conv);
17652 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
17653 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17654 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17655 for (size_t n = 0; n < ret_var.datalen; n++) {
17656 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17657 *ret_conv_39_conv = ret_var.data[n];
17658 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
17660 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17661 FREE(ret_var.data);
17665 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
17666 LDKChannelMonitor this_arg_conv;
17667 this_arg_conv.inner = (void*)(this_arg & (~1));
17668 this_arg_conv.is_owned = false;
17669 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
17670 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17672 for (size_t i = 0; i < ret_var.datalen; i++) {
17673 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
17674 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
17675 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17677 FREE(ret_var.data);
17681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
17682 LDKChannelMonitor this_arg_conv;
17683 this_arg_conv.inner = (void*)(this_arg & (~1));
17684 this_arg_conv.is_owned = false;
17685 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
17686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17688 uint64_t ret_ref = (uint64_t)ret_var.inner;
17689 if (ret_var.is_owned) {
17695 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
17696 LDKChannelMonitor this_arg_conv;
17697 this_arg_conv.inner = (void*)(this_arg & (~1));
17698 this_arg_conv.is_owned = false;
17699 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
17700 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17701 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17702 for (size_t j = 0; j < ret_var.datalen; j++) {
17703 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17704 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
17705 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
17706 ret_arr_ptr[j] = ret_conv_9_ref;
17708 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17709 FREE(ret_var.data);
17713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
17714 LDKu8slice ser_ref;
17715 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17716 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17717 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
17718 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17719 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
17720 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17721 return (uint64_t)ret_conv;
17724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17725 LDKOutPoint this_obj_conv;
17726 this_obj_conv.inner = (void*)(this_obj & (~1));
17727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17728 OutPoint_free(this_obj_conv);
17731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17732 LDKOutPoint this_ptr_conv;
17733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17734 this_ptr_conv.is_owned = false;
17735 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
17740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17741 LDKOutPoint this_ptr_conv;
17742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17743 this_ptr_conv.is_owned = false;
17744 LDKThirtyTwoBytes val_ref;
17745 CHECK((*env)->GetArrayLength(env, val) == 32);
17746 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17747 OutPoint_set_txid(&this_ptr_conv, val_ref);
17750 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17751 LDKOutPoint this_ptr_conv;
17752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17753 this_ptr_conv.is_owned = false;
17754 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
17758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17759 LDKOutPoint this_ptr_conv;
17760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17761 this_ptr_conv.is_owned = false;
17762 OutPoint_set_index(&this_ptr_conv, val);
17765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
17766 LDKThirtyTwoBytes txid_arg_ref;
17767 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
17768 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
17769 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
17770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17772 uint64_t ret_ref = (uint64_t)ret_var.inner;
17773 if (ret_var.is_owned) {
17779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17780 LDKOutPoint orig_conv;
17781 orig_conv.inner = (void*)(orig & (~1));
17782 orig_conv.is_owned = false;
17783 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
17784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17786 uint64_t ret_ref = (uint64_t)ret_var.inner;
17787 if (ret_var.is_owned) {
17793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17794 LDKOutPoint a_conv;
17795 a_conv.inner = (void*)(a & (~1));
17796 a_conv.is_owned = false;
17797 LDKOutPoint b_conv;
17798 b_conv.inner = (void*)(b & (~1));
17799 b_conv.is_owned = false;
17800 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
17804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
17805 LDKOutPoint o_conv;
17806 o_conv.inner = (void*)(o & (~1));
17807 o_conv.is_owned = false;
17808 int64_t ret_val = OutPoint_hash(&o_conv);
17812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17813 LDKOutPoint this_arg_conv;
17814 this_arg_conv.inner = (void*)(this_arg & (~1));
17815 this_arg_conv.is_owned = false;
17816 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17817 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
17821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
17822 LDKOutPoint obj_conv;
17823 obj_conv.inner = (void*)(obj & (~1));
17824 obj_conv.is_owned = false;
17825 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
17826 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17827 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17828 CVec_u8Z_free(ret_var);
17832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17833 LDKu8slice ser_ref;
17834 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17835 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17836 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17837 *ret_conv = OutPoint_read(ser_ref);
17838 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17839 return (uint64_t)ret_conv;
17842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17843 LDKDelayedPaymentOutputDescriptor this_obj_conv;
17844 this_obj_conv.inner = (void*)(this_obj & (~1));
17845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17846 DelayedPaymentOutputDescriptor_free(this_obj_conv);
17849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17850 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17852 this_ptr_conv.is_owned = false;
17853 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17856 uint64_t ret_ref = (uint64_t)ret_var.inner;
17857 if (ret_var.is_owned) {
17863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17864 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17866 this_ptr_conv.is_owned = false;
17867 LDKOutPoint val_conv;
17868 val_conv.inner = (void*)(val & (~1));
17869 val_conv.is_owned = (val & 1) || (val == 0);
17870 val_conv = OutPoint_clone(&val_conv);
17871 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17875 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17877 this_ptr_conv.is_owned = false;
17878 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
17883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17884 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17886 this_ptr_conv.is_owned = false;
17887 LDKPublicKey val_ref;
17888 CHECK((*env)->GetArrayLength(env, val) == 33);
17889 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17890 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
17893 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17894 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
17901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17902 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17904 this_ptr_conv.is_owned = false;
17905 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
17908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17909 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17911 this_ptr_conv.is_owned = false;
17912 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17913 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17914 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17918 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17920 this_ptr_conv.is_owned = false;
17921 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17922 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
17926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17927 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17929 this_ptr_conv.is_owned = false;
17930 LDKPublicKey val_ref;
17931 CHECK((*env)->GetArrayLength(env, val) == 33);
17932 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17933 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
17936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17937 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17939 this_ptr_conv.is_owned = false;
17940 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17946 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17948 this_ptr_conv.is_owned = false;
17949 LDKThirtyTwoBytes val_ref;
17950 CHECK((*env)->GetArrayLength(env, val) == 32);
17951 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17952 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17956 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17958 this_ptr_conv.is_owned = false;
17959 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17964 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17966 this_ptr_conv.is_owned = false;
17967 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
17971 LDKOutPoint outpoint_arg_conv;
17972 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17973 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17974 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17975 LDKPublicKey per_commitment_point_arg_ref;
17976 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17977 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17978 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17979 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17980 LDKPublicKey revocation_pubkey_arg_ref;
17981 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
17982 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
17983 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17984 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17985 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17986 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
17987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17989 uint64_t ret_ref = (uint64_t)ret_var.inner;
17990 if (ret_var.is_owned) {
17996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17997 LDKDelayedPaymentOutputDescriptor orig_conv;
17998 orig_conv.inner = (void*)(orig & (~1));
17999 orig_conv.is_owned = false;
18000 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
18001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18003 uint64_t ret_ref = (uint64_t)ret_var.inner;
18004 if (ret_var.is_owned) {
18010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18011 LDKDelayedPaymentOutputDescriptor obj_conv;
18012 obj_conv.inner = (void*)(obj & (~1));
18013 obj_conv.is_owned = false;
18014 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
18015 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18016 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18017 CVec_u8Z_free(ret_var);
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18022 LDKu8slice ser_ref;
18023 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18024 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18025 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18026 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
18027 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18028 return (uint64_t)ret_conv;
18031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18032 LDKStaticPaymentOutputDescriptor this_obj_conv;
18033 this_obj_conv.inner = (void*)(this_obj & (~1));
18034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18035 StaticPaymentOutputDescriptor_free(this_obj_conv);
18038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18039 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
18043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18045 uint64_t ret_ref = (uint64_t)ret_var.inner;
18046 if (ret_var.is_owned) {
18052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18053 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18055 this_ptr_conv.is_owned = false;
18056 LDKOutPoint val_conv;
18057 val_conv.inner = (void*)(val & (~1));
18058 val_conv.is_owned = (val & 1) || (val == 0);
18059 val_conv = OutPoint_clone(&val_conv);
18060 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
18063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18064 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18066 this_ptr_conv.is_owned = false;
18067 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
18068 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
18069 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
18072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18073 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18075 this_ptr_conv.is_owned = false;
18076 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
18081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18082 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18084 this_ptr_conv.is_owned = false;
18085 LDKThirtyTwoBytes val_ref;
18086 CHECK((*env)->GetArrayLength(env, val) == 32);
18087 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18088 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18092 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18094 this_ptr_conv.is_owned = false;
18095 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
18099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18100 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18102 this_ptr_conv.is_owned = false;
18103 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
18106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
18107 LDKOutPoint outpoint_arg_conv;
18108 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18109 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18110 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18111 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
18112 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
18113 LDKThirtyTwoBytes channel_keys_id_arg_ref;
18114 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
18115 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
18116 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
18117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18119 uint64_t ret_ref = (uint64_t)ret_var.inner;
18120 if (ret_var.is_owned) {
18126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18127 LDKStaticPaymentOutputDescriptor orig_conv;
18128 orig_conv.inner = (void*)(orig & (~1));
18129 orig_conv.is_owned = false;
18130 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
18131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18133 uint64_t ret_ref = (uint64_t)ret_var.inner;
18134 if (ret_var.is_owned) {
18140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18141 LDKStaticPaymentOutputDescriptor obj_conv;
18142 obj_conv.inner = (void*)(obj & (~1));
18143 obj_conv.is_owned = false;
18144 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
18145 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18146 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18147 CVec_u8Z_free(ret_var);
18151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18152 LDKu8slice ser_ref;
18153 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18154 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18155 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18156 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
18157 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18158 return (uint64_t)ret_conv;
18161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18162 if ((this_ptr & 1) != 0) return;
18163 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
18164 FREE((void*)this_ptr);
18165 SpendableOutputDescriptor_free(this_ptr_conv);
18168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18169 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
18170 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18171 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
18172 uint64_t ret_ref = (uint64_t)ret_copy;
18176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
18177 LDKOutPoint outpoint_conv;
18178 outpoint_conv.inner = (void*)(outpoint & (~1));
18179 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
18180 outpoint_conv = OutPoint_clone(&outpoint_conv);
18181 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
18182 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
18183 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18184 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
18185 uint64_t ret_ref = (uint64_t)ret_copy;
18189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
18190 LDKDelayedPaymentOutputDescriptor a_conv;
18191 a_conv.inner = (void*)(a & (~1));
18192 a_conv.is_owned = (a & 1) || (a == 0);
18193 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
18194 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18195 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
18196 uint64_t ret_ref = (uint64_t)ret_copy;
18200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
18201 LDKStaticPaymentOutputDescriptor a_conv;
18202 a_conv.inner = (void*)(a & (~1));
18203 a_conv.is_owned = (a & 1) || (a == 0);
18204 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
18205 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18206 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
18207 uint64_t ret_ref = (uint64_t)ret_copy;
18211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18212 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
18213 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
18214 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18215 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18216 CVec_u8Z_free(ret_var);
18220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18221 LDKu8slice ser_ref;
18222 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18223 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18224 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18225 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
18226 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18227 return (uint64_t)ret_conv;
18230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18231 if ((this_ptr & 1) != 0) return;
18232 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
18233 FREE((void*)this_ptr);
18234 BaseSign_free(this_ptr_conv);
18237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18238 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
18239 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
18240 *ret_ret = Sign_clone(orig_conv);
18241 return (uint64_t)ret_ret;
18244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18245 if ((this_ptr & 1) != 0) return;
18246 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
18247 FREE((void*)this_ptr);
18248 Sign_free(this_ptr_conv);
18251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18252 if ((this_ptr & 1) != 0) return;
18253 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
18254 FREE((void*)this_ptr);
18255 KeysInterface_free(this_ptr_conv);
18258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18259 LDKInMemorySigner this_obj_conv;
18260 this_obj_conv.inner = (void*)(this_obj & (~1));
18261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18262 InMemorySigner_free(this_obj_conv);
18265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18266 LDKInMemorySigner this_ptr_conv;
18267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18268 this_ptr_conv.is_owned = false;
18269 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18270 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
18274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18275 LDKInMemorySigner this_ptr_conv;
18276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18277 this_ptr_conv.is_owned = false;
18278 LDKSecretKey val_ref;
18279 CHECK((*env)->GetArrayLength(env, val) == 32);
18280 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18281 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
18284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18285 LDKInMemorySigner this_ptr_conv;
18286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18287 this_ptr_conv.is_owned = false;
18288 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18289 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
18293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18294 LDKInMemorySigner this_ptr_conv;
18295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18296 this_ptr_conv.is_owned = false;
18297 LDKSecretKey val_ref;
18298 CHECK((*env)->GetArrayLength(env, val) == 32);
18299 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18300 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
18303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18304 LDKInMemorySigner this_ptr_conv;
18305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18306 this_ptr_conv.is_owned = false;
18307 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18308 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
18312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18313 LDKInMemorySigner this_ptr_conv;
18314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18315 this_ptr_conv.is_owned = false;
18316 LDKSecretKey val_ref;
18317 CHECK((*env)->GetArrayLength(env, val) == 32);
18318 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18319 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
18322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18323 LDKInMemorySigner this_ptr_conv;
18324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18325 this_ptr_conv.is_owned = false;
18326 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18327 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
18331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18332 LDKInMemorySigner this_ptr_conv;
18333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18334 this_ptr_conv.is_owned = false;
18335 LDKSecretKey val_ref;
18336 CHECK((*env)->GetArrayLength(env, val) == 32);
18337 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18338 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
18341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18342 LDKInMemorySigner this_ptr_conv;
18343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18344 this_ptr_conv.is_owned = false;
18345 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18346 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
18350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18351 LDKInMemorySigner this_ptr_conv;
18352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18353 this_ptr_conv.is_owned = false;
18354 LDKSecretKey val_ref;
18355 CHECK((*env)->GetArrayLength(env, val) == 32);
18356 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18357 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
18360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
18361 LDKInMemorySigner this_ptr_conv;
18362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18363 this_ptr_conv.is_owned = false;
18364 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18365 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
18369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18370 LDKInMemorySigner this_ptr_conv;
18371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18372 this_ptr_conv.is_owned = false;
18373 LDKThirtyTwoBytes val_ref;
18374 CHECK((*env)->GetArrayLength(env, val) == 32);
18375 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18376 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
18379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18380 LDKInMemorySigner orig_conv;
18381 orig_conv.inner = (void*)(orig & (~1));
18382 orig_conv.is_owned = false;
18383 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
18384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18386 uint64_t ret_ref = (uint64_t)ret_var.inner;
18387 if (ret_var.is_owned) {
18393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
18394 LDKSecretKey funding_key_ref;
18395 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18396 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
18397 LDKSecretKey revocation_base_key_ref;
18398 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
18399 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
18400 LDKSecretKey payment_key_ref;
18401 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
18402 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
18403 LDKSecretKey delayed_payment_base_key_ref;
18404 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
18405 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
18406 LDKSecretKey htlc_base_key_ref;
18407 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
18408 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
18409 LDKThirtyTwoBytes commitment_seed_ref;
18410 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
18411 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
18412 LDKThirtyTwoBytes channel_keys_id_ref;
18413 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
18414 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
18415 LDKInMemorySigner ret_var = InMemorySigner_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, channel_keys_id_ref);
18416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18418 uint64_t ret_ref = (uint64_t)ret_var.inner;
18419 if (ret_var.is_owned) {
18425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18426 LDKInMemorySigner this_arg_conv;
18427 this_arg_conv.inner = (void*)(this_arg & (~1));
18428 this_arg_conv.is_owned = false;
18429 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
18430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18432 uint64_t ret_ref = (uint64_t)ret_var.inner;
18433 if (ret_var.is_owned) {
18439 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18440 LDKInMemorySigner this_arg_conv;
18441 this_arg_conv.inner = (void*)(this_arg & (~1));
18442 this_arg_conv.is_owned = false;
18443 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
18447 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18448 LDKInMemorySigner this_arg_conv;
18449 this_arg_conv.inner = (void*)(this_arg & (~1));
18450 this_arg_conv.is_owned = false;
18451 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
18455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
18456 LDKInMemorySigner this_arg_conv;
18457 this_arg_conv.inner = (void*)(this_arg & (~1));
18458 this_arg_conv.is_owned = false;
18459 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
18463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
18464 LDKInMemorySigner this_arg_conv;
18465 this_arg_conv.inner = (void*)(this_arg & (~1));
18466 this_arg_conv.is_owned = false;
18467 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
18468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18470 uint64_t ret_ref = (uint64_t)ret_var.inner;
18471 if (ret_var.is_owned) {
18477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
18478 LDKInMemorySigner this_arg_conv;
18479 this_arg_conv.inner = (void*)(this_arg & (~1));
18480 this_arg_conv.is_owned = false;
18481 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
18482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18484 uint64_t ret_ref = (uint64_t)ret_var.inner;
18485 if (ret_var.is_owned) {
18491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
18492 LDKInMemorySigner this_arg_conv;
18493 this_arg_conv.inner = (void*)(this_arg & (~1));
18494 this_arg_conv.is_owned = false;
18495 LDKTransaction spend_tx_ref;
18496 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
18497 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
18498 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
18499 spend_tx_ref.data_is_owned = true;
18500 LDKStaticPaymentOutputDescriptor descriptor_conv;
18501 descriptor_conv.inner = (void*)(descriptor & (~1));
18502 descriptor_conv.is_owned = false;
18503 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18504 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
18505 return (uint64_t)ret_conv;
18508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
18509 LDKInMemorySigner this_arg_conv;
18510 this_arg_conv.inner = (void*)(this_arg & (~1));
18511 this_arg_conv.is_owned = false;
18512 LDKTransaction spend_tx_ref;
18513 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
18514 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
18515 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
18516 spend_tx_ref.data_is_owned = true;
18517 LDKDelayedPaymentOutputDescriptor descriptor_conv;
18518 descriptor_conv.inner = (void*)(descriptor & (~1));
18519 descriptor_conv.is_owned = false;
18520 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18521 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
18522 return (uint64_t)ret_conv;
18525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
18526 LDKInMemorySigner this_arg_conv;
18527 this_arg_conv.inner = (void*)(this_arg & (~1));
18528 this_arg_conv.is_owned = false;
18529 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
18530 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
18531 return (uint64_t)ret_ret;
18534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
18535 LDKInMemorySigner this_arg_conv;
18536 this_arg_conv.inner = (void*)(this_arg & (~1));
18537 this_arg_conv.is_owned = false;
18538 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
18539 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
18540 return (uint64_t)ret_ret;
18543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
18544 LDKInMemorySigner obj_conv;
18545 obj_conv.inner = (void*)(obj & (~1));
18546 obj_conv.is_owned = false;
18547 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
18548 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18549 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18550 CVec_u8Z_free(ret_var);
18554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18555 LDKu8slice ser_ref;
18556 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18557 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18558 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18559 *ret_conv = InMemorySigner_read(ser_ref);
18560 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18561 return (uint64_t)ret_conv;
18564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18565 LDKKeysManager this_obj_conv;
18566 this_obj_conv.inner = (void*)(this_obj & (~1));
18567 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18568 KeysManager_free(this_obj_conv);
18571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
18572 unsigned char seed_arr[32];
18573 CHECK((*env)->GetArrayLength(env, seed) == 32);
18574 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
18575 unsigned char (*seed_ref)[32] = &seed_arr;
18576 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
18577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18579 uint64_t ret_ref = (uint64_t)ret_var.inner;
18580 if (ret_var.is_owned) {
18586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
18587 LDKKeysManager this_arg_conv;
18588 this_arg_conv.inner = (void*)(this_arg & (~1));
18589 this_arg_conv.is_owned = false;
18590 unsigned char params_arr[32];
18591 CHECK((*env)->GetArrayLength(env, params) == 32);
18592 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
18593 unsigned char (*params_ref)[32] = ¶ms_arr;
18594 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
18595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18597 uint64_t ret_ref = (uint64_t)ret_var.inner;
18598 if (ret_var.is_owned) {
18604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
18605 LDKKeysManager this_arg_conv;
18606 this_arg_conv.inner = (void*)(this_arg & (~1));
18607 this_arg_conv.is_owned = false;
18608 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
18609 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
18610 if (descriptors_constr.datalen > 0)
18611 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
18613 descriptors_constr.data = NULL;
18614 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
18615 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
18616 int64_t descriptors_conv_27 = descriptors_vals[b];
18617 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
18618 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
18619 descriptors_constr.data[b] = descriptors_conv_27_conv;
18621 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
18622 LDKCVec_TxOutZ outputs_constr;
18623 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
18624 if (outputs_constr.datalen > 0)
18625 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18627 outputs_constr.data = NULL;
18628 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
18629 for (size_t h = 0; h < outputs_constr.datalen; h++) {
18630 int64_t outputs_conv_7 = outputs_vals[h];
18631 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
18632 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
18633 outputs_constr.data[h] = outputs_conv_7_conv;
18635 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
18636 LDKCVec_u8Z change_destination_script_ref;
18637 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
18638 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
18639 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
18640 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18641 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
18642 return (uint64_t)ret_conv;
18645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
18646 LDKKeysManager this_arg_conv;
18647 this_arg_conv.inner = (void*)(this_arg & (~1));
18648 this_arg_conv.is_owned = false;
18649 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
18650 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
18651 return (uint64_t)ret_ret;
18654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18655 LDKPaymentId this_obj_conv;
18656 this_obj_conv.inner = (void*)(this_obj & (~1));
18657 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18658 PaymentId_free(this_obj_conv);
18661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash(JNIEnv *env, jclass clz, int64_t o) {
18662 LDKPaymentId o_conv;
18663 o_conv.inner = (void*)(o & (~1));
18664 o_conv.is_owned = false;
18665 int64_t ret_val = PaymentId_hash(&o_conv);
18669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18670 LDKPaymentId orig_conv;
18671 orig_conv.inner = (void*)(orig & (~1));
18672 orig_conv.is_owned = false;
18673 LDKPaymentId ret_var = PaymentId_clone(&orig_conv);
18674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18676 uint64_t ret_ref = (uint64_t)ret_var.inner;
18677 if (ret_var.is_owned) {
18683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
18684 LDKPaymentId a_conv;
18685 a_conv.inner = (void*)(a & (~1));
18686 a_conv.is_owned = false;
18687 LDKPaymentId b_conv;
18688 b_conv.inner = (void*)(b & (~1));
18689 b_conv.is_owned = false;
18690 jboolean ret_val = PaymentId_eq(&a_conv, &b_conv);
18694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write(JNIEnv *env, jclass clz, int64_t obj) {
18695 LDKPaymentId obj_conv;
18696 obj_conv.inner = (void*)(obj & (~1));
18697 obj_conv.is_owned = false;
18698 LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv);
18699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18701 CVec_u8Z_free(ret_var);
18705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18706 LDKu8slice ser_ref;
18707 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18708 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18709 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
18710 *ret_conv = PaymentId_read(ser_ref);
18711 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18712 return (uint64_t)ret_conv;
18715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18716 LDKChannelManager this_obj_conv;
18717 this_obj_conv.inner = (void*)(this_obj & (~1));
18718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18719 ChannelManager_free(this_obj_conv);
18722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18723 LDKChainParameters this_obj_conv;
18724 this_obj_conv.inner = (void*)(this_obj & (~1));
18725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18726 ChainParameters_free(this_obj_conv);
18729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
18730 LDKChainParameters this_ptr_conv;
18731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18732 this_ptr_conv.is_owned = false;
18733 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
18737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
18738 LDKChainParameters this_ptr_conv;
18739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18740 this_ptr_conv.is_owned = false;
18741 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
18742 ChainParameters_set_network(&this_ptr_conv, val_conv);
18745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
18746 LDKChainParameters this_ptr_conv;
18747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18748 this_ptr_conv.is_owned = false;
18749 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
18750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18752 uint64_t ret_ref = (uint64_t)ret_var.inner;
18753 if (ret_var.is_owned) {
18759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18760 LDKChainParameters this_ptr_conv;
18761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18762 this_ptr_conv.is_owned = false;
18763 LDKBestBlock val_conv;
18764 val_conv.inner = (void*)(val & (~1));
18765 val_conv.is_owned = (val & 1) || (val == 0);
18766 val_conv = BestBlock_clone(&val_conv);
18767 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
18770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
18771 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
18772 LDKBestBlock best_block_arg_conv;
18773 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
18774 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
18775 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
18776 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
18777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18779 uint64_t ret_ref = (uint64_t)ret_var.inner;
18780 if (ret_var.is_owned) {
18786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18787 LDKChainParameters orig_conv;
18788 orig_conv.inner = (void*)(orig & (~1));
18789 orig_conv.is_owned = false;
18790 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
18791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18793 uint64_t ret_ref = (uint64_t)ret_var.inner;
18794 if (ret_var.is_owned) {
18800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18801 LDKCounterpartyForwardingInfo this_obj_conv;
18802 this_obj_conv.inner = (void*)(this_obj & (~1));
18803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18804 CounterpartyForwardingInfo_free(this_obj_conv);
18807 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18808 LDKCounterpartyForwardingInfo this_ptr_conv;
18809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18810 this_ptr_conv.is_owned = false;
18811 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
18815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18816 LDKCounterpartyForwardingInfo this_ptr_conv;
18817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18818 this_ptr_conv.is_owned = false;
18819 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
18822 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18823 LDKCounterpartyForwardingInfo this_ptr_conv;
18824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18825 this_ptr_conv.is_owned = false;
18826 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
18830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18831 LDKCounterpartyForwardingInfo this_ptr_conv;
18832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18833 this_ptr_conv.is_owned = false;
18834 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
18837 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18838 LDKCounterpartyForwardingInfo this_ptr_conv;
18839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18840 this_ptr_conv.is_owned = false;
18841 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
18845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18846 LDKCounterpartyForwardingInfo this_ptr_conv;
18847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18848 this_ptr_conv.is_owned = false;
18849 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
18853 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
18854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18856 uint64_t ret_ref = (uint64_t)ret_var.inner;
18857 if (ret_var.is_owned) {
18863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18864 LDKCounterpartyForwardingInfo orig_conv;
18865 orig_conv.inner = (void*)(orig & (~1));
18866 orig_conv.is_owned = false;
18867 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
18868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18870 uint64_t ret_ref = (uint64_t)ret_var.inner;
18871 if (ret_var.is_owned) {
18877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18878 LDKChannelCounterparty this_obj_conv;
18879 this_obj_conv.inner = (void*)(this_obj & (~1));
18880 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18881 ChannelCounterparty_free(this_obj_conv);
18884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18885 LDKChannelCounterparty this_ptr_conv;
18886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18887 this_ptr_conv.is_owned = false;
18888 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18889 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
18893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18894 LDKChannelCounterparty this_ptr_conv;
18895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18896 this_ptr_conv.is_owned = false;
18897 LDKPublicKey val_ref;
18898 CHECK((*env)->GetArrayLength(env, val) == 33);
18899 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18900 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
18903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18904 LDKChannelCounterparty this_ptr_conv;
18905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18906 this_ptr_conv.is_owned = false;
18907 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
18908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18910 uint64_t ret_ref = (uint64_t)ret_var.inner;
18911 if (ret_var.is_owned) {
18917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18918 LDKChannelCounterparty this_ptr_conv;
18919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18920 this_ptr_conv.is_owned = false;
18921 LDKInitFeatures val_conv;
18922 val_conv.inner = (void*)(val & (~1));
18923 val_conv.is_owned = (val & 1) || (val == 0);
18924 val_conv = InitFeatures_clone(&val_conv);
18925 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
18928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18929 LDKChannelCounterparty this_ptr_conv;
18930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18931 this_ptr_conv.is_owned = false;
18932 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
18936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18937 LDKChannelCounterparty this_ptr_conv;
18938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18939 this_ptr_conv.is_owned = false;
18940 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
18943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
18944 LDKChannelCounterparty this_ptr_conv;
18945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18946 this_ptr_conv.is_owned = false;
18947 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
18948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18950 uint64_t ret_ref = (uint64_t)ret_var.inner;
18951 if (ret_var.is_owned) {
18957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18958 LDKChannelCounterparty this_ptr_conv;
18959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18960 this_ptr_conv.is_owned = false;
18961 LDKCounterpartyForwardingInfo val_conv;
18962 val_conv.inner = (void*)(val & (~1));
18963 val_conv.is_owned = (val & 1) || (val == 0);
18964 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
18965 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
18968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
18969 LDKPublicKey node_id_arg_ref;
18970 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
18971 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
18972 LDKInitFeatures features_arg_conv;
18973 features_arg_conv.inner = (void*)(features_arg & (~1));
18974 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18975 features_arg_conv = InitFeatures_clone(&features_arg_conv);
18976 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
18977 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
18978 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
18979 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
18980 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
18981 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18982 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18983 uint64_t ret_ref = (uint64_t)ret_var.inner;
18984 if (ret_var.is_owned) {
18990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18991 LDKChannelCounterparty orig_conv;
18992 orig_conv.inner = (void*)(orig & (~1));
18993 orig_conv.is_owned = false;
18994 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
18995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18997 uint64_t ret_ref = (uint64_t)ret_var.inner;
18998 if (ret_var.is_owned) {
19004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19005 LDKChannelDetails this_obj_conv;
19006 this_obj_conv.inner = (void*)(this_obj & (~1));
19007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19008 ChannelDetails_free(this_obj_conv);
19011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19012 LDKChannelDetails this_ptr_conv;
19013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19014 this_ptr_conv.is_owned = false;
19015 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19016 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
19020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19021 LDKChannelDetails this_ptr_conv;
19022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19023 this_ptr_conv.is_owned = false;
19024 LDKThirtyTwoBytes val_ref;
19025 CHECK((*env)->GetArrayLength(env, val) == 32);
19026 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19027 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
19030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
19031 LDKChannelDetails this_ptr_conv;
19032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19033 this_ptr_conv.is_owned = false;
19034 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
19035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19037 uint64_t ret_ref = (uint64_t)ret_var.inner;
19038 if (ret_var.is_owned) {
19044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19045 LDKChannelDetails this_ptr_conv;
19046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19047 this_ptr_conv.is_owned = false;
19048 LDKChannelCounterparty val_conv;
19049 val_conv.inner = (void*)(val & (~1));
19050 val_conv.is_owned = (val & 1) || (val == 0);
19051 val_conv = ChannelCounterparty_clone(&val_conv);
19052 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
19055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
19056 LDKChannelDetails this_ptr_conv;
19057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19058 this_ptr_conv.is_owned = false;
19059 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
19060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19062 uint64_t ret_ref = (uint64_t)ret_var.inner;
19063 if (ret_var.is_owned) {
19069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19070 LDKChannelDetails this_ptr_conv;
19071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19072 this_ptr_conv.is_owned = false;
19073 LDKOutPoint val_conv;
19074 val_conv.inner = (void*)(val & (~1));
19075 val_conv.is_owned = (val & 1) || (val == 0);
19076 val_conv = OutPoint_clone(&val_conv);
19077 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19081 LDKChannelDetails this_ptr_conv;
19082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19083 this_ptr_conv.is_owned = false;
19084 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19085 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
19086 uint64_t ret_ref = (uint64_t)ret_copy;
19090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19091 LDKChannelDetails this_ptr_conv;
19092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19093 this_ptr_conv.is_owned = false;
19094 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19095 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
19096 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
19099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19100 LDKChannelDetails this_ptr_conv;
19101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19102 this_ptr_conv.is_owned = false;
19103 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
19107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19108 LDKChannelDetails this_ptr_conv;
19109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19110 this_ptr_conv.is_owned = false;
19111 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
19114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
19115 LDKChannelDetails this_ptr_conv;
19116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19117 this_ptr_conv.is_owned = false;
19118 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19119 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
19120 uint64_t ret_ref = (uint64_t)ret_copy;
19124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19125 LDKChannelDetails this_ptr_conv;
19126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19127 this_ptr_conv.is_owned = false;
19128 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
19129 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
19130 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
19133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19134 LDKChannelDetails this_ptr_conv;
19135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19136 this_ptr_conv.is_owned = false;
19137 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
19141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19142 LDKChannelDetails this_ptr_conv;
19143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19144 this_ptr_conv.is_owned = false;
19145 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
19148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19149 LDKChannelDetails this_ptr_conv;
19150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19151 this_ptr_conv.is_owned = false;
19152 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
19156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19157 LDKChannelDetails this_ptr_conv;
19158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19159 this_ptr_conv.is_owned = false;
19160 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
19163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19164 LDKChannelDetails this_ptr_conv;
19165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19166 this_ptr_conv.is_owned = false;
19167 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
19171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19172 LDKChannelDetails this_ptr_conv;
19173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19174 this_ptr_conv.is_owned = false;
19175 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
19178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
19179 LDKChannelDetails this_ptr_conv;
19180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19181 this_ptr_conv.is_owned = false;
19182 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19183 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
19184 uint64_t ret_ref = (uint64_t)ret_copy;
19188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19189 LDKChannelDetails this_ptr_conv;
19190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19191 this_ptr_conv.is_owned = false;
19192 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
19193 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
19194 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
19197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19198 LDKChannelDetails this_ptr_conv;
19199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19200 this_ptr_conv.is_owned = false;
19201 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19202 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
19203 uint64_t ret_ref = (uint64_t)ret_copy;
19207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19208 LDKChannelDetails this_ptr_conv;
19209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19210 this_ptr_conv.is_owned = false;
19211 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
19212 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
19213 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
19216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
19217 LDKChannelDetails this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
19224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19225 LDKChannelDetails this_ptr_conv;
19226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19227 this_ptr_conv.is_owned = false;
19228 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
19231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
19232 LDKChannelDetails this_ptr_conv;
19233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19234 this_ptr_conv.is_owned = false;
19235 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
19239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19240 LDKChannelDetails this_ptr_conv;
19241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19242 this_ptr_conv.is_owned = false;
19243 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
19246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
19247 LDKChannelDetails this_ptr_conv;
19248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19249 this_ptr_conv.is_owned = false;
19250 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
19254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19255 LDKChannelDetails this_ptr_conv;
19256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19257 this_ptr_conv.is_owned = false;
19258 ChannelDetails_set_is_usable(&this_ptr_conv, val);
19261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
19262 LDKChannelDetails this_ptr_conv;
19263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19264 this_ptr_conv.is_owned = false;
19265 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
19269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19270 LDKChannelDetails this_ptr_conv;
19271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19272 this_ptr_conv.is_owned = false;
19273 ChannelDetails_set_is_public(&this_ptr_conv, val);
19276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
19277 LDKThirtyTwoBytes channel_id_arg_ref;
19278 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19279 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19280 LDKChannelCounterparty counterparty_arg_conv;
19281 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
19282 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
19283 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
19284 LDKOutPoint funding_txo_arg_conv;
19285 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
19286 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
19287 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
19288 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
19289 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
19290 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
19291 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
19292 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
19293 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
19294 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
19295 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
19296 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19297 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19298 uint64_t ret_ref = (uint64_t)ret_var.inner;
19299 if (ret_var.is_owned) {
19305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19306 LDKChannelDetails orig_conv;
19307 orig_conv.inner = (void*)(orig & (~1));
19308 orig_conv.is_owned = false;
19309 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
19310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19312 uint64_t ret_ref = (uint64_t)ret_var.inner;
19313 if (ret_var.is_owned) {
19319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19320 if ((this_ptr & 1) != 0) return;
19321 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
19322 FREE((void*)this_ptr);
19323 PaymentSendFailure_free(this_ptr_conv);
19326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19327 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
19328 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19329 *ret_copy = PaymentSendFailure_clone(orig_conv);
19330 uint64_t ret_ref = (uint64_t)ret_copy;
19334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
19335 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
19336 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
19337 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19338 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
19339 uint64_t ret_ref = (uint64_t)ret_copy;
19343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
19344 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
19345 a_constr.datalen = (*env)->GetArrayLength(env, a);
19346 if (a_constr.datalen > 0)
19347 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19349 a_constr.data = NULL;
19350 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19351 for (size_t w = 0; w < a_constr.datalen; w++) {
19352 int64_t a_conv_22 = a_vals[w];
19353 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
19354 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
19355 a_constr.data[w] = a_conv_22_conv;
19357 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19358 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19359 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
19360 uint64_t ret_ref = (uint64_t)ret_copy;
19364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
19365 LDKCVec_APIErrorZ a_constr;
19366 a_constr.datalen = (*env)->GetArrayLength(env, a);
19367 if (a_constr.datalen > 0)
19368 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19370 a_constr.data = NULL;
19371 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19372 for (size_t k = 0; k < a_constr.datalen; k++) {
19373 int64_t a_conv_10 = a_vals[k];
19374 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
19375 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
19376 a_constr.data[k] = a_conv_10_conv;
19378 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19379 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19380 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
19381 uint64_t ret_ref = (uint64_t)ret_copy;
19385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
19386 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
19387 a_constr.datalen = (*env)->GetArrayLength(env, a);
19388 if (a_constr.datalen > 0)
19389 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19391 a_constr.data = NULL;
19392 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19393 for (size_t w = 0; w < a_constr.datalen; w++) {
19394 int64_t a_conv_22 = a_vals[w];
19395 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
19396 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
19397 a_constr.data[w] = a_conv_22_conv;
19399 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19400 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19401 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
19402 uint64_t ret_ref = (uint64_t)ret_copy;
19406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
19407 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
19408 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
19409 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19410 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
19412 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
19413 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
19414 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19415 LDKWatch_JCalls_cloned(&chain_monitor_conv);
19417 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
19418 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19419 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19420 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
19422 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19423 if (logger_conv.free == LDKLogger_JCalls_free) {
19424 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19425 LDKLogger_JCalls_cloned(&logger_conv);
19427 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
19428 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
19429 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19430 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
19432 LDKUserConfig config_conv;
19433 config_conv.inner = (void*)(config & (~1));
19434 config_conv.is_owned = (config & 1) || (config == 0);
19435 config_conv = UserConfig_clone(&config_conv);
19436 LDKChainParameters params_conv;
19437 params_conv.inner = (void*)(params & (~1));
19438 params_conv.is_owned = (params & 1) || (params == 0);
19439 params_conv = ChainParameters_clone(¶ms_conv);
19440 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
19441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19443 uint64_t ret_ref = (uint64_t)ret_var.inner;
19444 if (ret_var.is_owned) {
19450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
19451 LDKChannelManager this_arg_conv;
19452 this_arg_conv.inner = (void*)(this_arg & (~1));
19453 this_arg_conv.is_owned = false;
19454 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
19455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19457 uint64_t ret_ref = (uint64_t)ret_var.inner;
19458 if (ret_var.is_owned) {
19464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, int64_t override_config) {
19465 LDKChannelManager this_arg_conv;
19466 this_arg_conv.inner = (void*)(this_arg & (~1));
19467 this_arg_conv.is_owned = false;
19468 LDKPublicKey their_network_key_ref;
19469 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
19470 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
19471 LDKUserConfig override_config_conv;
19472 override_config_conv.inner = (void*)(override_config & (~1));
19473 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
19474 override_config_conv = UserConfig_clone(&override_config_conv);
19475 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19476 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
19477 return (uint64_t)ret_conv;
19480 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
19481 LDKChannelManager this_arg_conv;
19482 this_arg_conv.inner = (void*)(this_arg & (~1));
19483 this_arg_conv.is_owned = false;
19484 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
19485 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19486 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19487 for (size_t q = 0; q < ret_var.datalen; q++) {
19488 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
19489 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19490 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19491 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
19492 if (ret_conv_16_var.is_owned) {
19493 ret_conv_16_ref |= 1;
19495 ret_arr_ptr[q] = ret_conv_16_ref;
19497 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19498 FREE(ret_var.data);
19502 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
19503 LDKChannelManager this_arg_conv;
19504 this_arg_conv.inner = (void*)(this_arg & (~1));
19505 this_arg_conv.is_owned = false;
19506 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
19507 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19508 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19509 for (size_t q = 0; q < ret_var.datalen; q++) {
19510 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
19511 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19512 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19513 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
19514 if (ret_conv_16_var.is_owned) {
19515 ret_conv_16_ref |= 1;
19517 ret_arr_ptr[q] = ret_conv_16_ref;
19519 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19520 FREE(ret_var.data);
19524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
19525 LDKChannelManager this_arg_conv;
19526 this_arg_conv.inner = (void*)(this_arg & (~1));
19527 this_arg_conv.is_owned = false;
19528 unsigned char channel_id_arr[32];
19529 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
19530 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
19531 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
19532 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19533 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
19534 return (uint64_t)ret_conv;
19537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
19538 LDKChannelManager this_arg_conv;
19539 this_arg_conv.inner = (void*)(this_arg & (~1));
19540 this_arg_conv.is_owned = false;
19541 unsigned char channel_id_arr[32];
19542 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
19543 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
19544 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
19545 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19546 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
19547 return (uint64_t)ret_conv;
19550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
19551 LDKChannelManager this_arg_conv;
19552 this_arg_conv.inner = (void*)(this_arg & (~1));
19553 this_arg_conv.is_owned = false;
19554 unsigned char channel_id_arr[32];
19555 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
19556 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
19557 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
19558 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19559 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
19560 return (uint64_t)ret_conv;
19563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
19564 LDKChannelManager this_arg_conv;
19565 this_arg_conv.inner = (void*)(this_arg & (~1));
19566 this_arg_conv.is_owned = false;
19567 ChannelManager_force_close_all_channels(&this_arg_conv);
19570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
19571 LDKChannelManager this_arg_conv;
19572 this_arg_conv.inner = (void*)(this_arg & (~1));
19573 this_arg_conv.is_owned = false;
19574 LDKRoute route_conv;
19575 route_conv.inner = (void*)(route & (~1));
19576 route_conv.is_owned = false;
19577 LDKThirtyTwoBytes payment_hash_ref;
19578 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
19579 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
19580 LDKThirtyTwoBytes payment_secret_ref;
19581 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
19582 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
19583 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
19584 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
19585 return (uint64_t)ret_conv;
19588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_id) {
19589 LDKChannelManager this_arg_conv;
19590 this_arg_conv.inner = (void*)(this_arg & (~1));
19591 this_arg_conv.is_owned = false;
19592 LDKRoute route_conv;
19593 route_conv.inner = (void*)(route & (~1));
19594 route_conv.is_owned = false;
19595 LDKPaymentId payment_id_conv;
19596 payment_id_conv.inner = (void*)(payment_id & (~1));
19597 payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0);
19598 payment_id_conv = PaymentId_clone(&payment_id_conv);
19599 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
19600 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv);
19601 return (uint64_t)ret_conv;
19604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
19605 LDKChannelManager this_arg_conv;
19606 this_arg_conv.inner = (void*)(this_arg & (~1));
19607 this_arg_conv.is_owned = false;
19608 LDKRoute route_conv;
19609 route_conv.inner = (void*)(route & (~1));
19610 route_conv.is_owned = false;
19611 LDKThirtyTwoBytes payment_preimage_ref;
19612 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
19613 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
19614 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
19615 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
19616 return (uint64_t)ret_conv;
19619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
19620 LDKChannelManager this_arg_conv;
19621 this_arg_conv.inner = (void*)(this_arg & (~1));
19622 this_arg_conv.is_owned = false;
19623 unsigned char temporary_channel_id_arr[32];
19624 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
19625 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
19626 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
19627 LDKTransaction funding_transaction_ref;
19628 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
19629 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
19630 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
19631 funding_transaction_ref.data_is_owned = true;
19632 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19633 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
19634 return (uint64_t)ret_conv;
19637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
19638 LDKChannelManager this_arg_conv;
19639 this_arg_conv.inner = (void*)(this_arg & (~1));
19640 this_arg_conv.is_owned = false;
19641 LDKThreeBytes rgb_ref;
19642 CHECK((*env)->GetArrayLength(env, rgb) == 3);
19643 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
19644 LDKThirtyTwoBytes alias_ref;
19645 CHECK((*env)->GetArrayLength(env, alias) == 32);
19646 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
19647 LDKCVec_NetAddressZ addresses_constr;
19648 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
19649 if (addresses_constr.datalen > 0)
19650 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19652 addresses_constr.data = NULL;
19653 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
19654 for (size_t m = 0; m < addresses_constr.datalen; m++) {
19655 int64_t addresses_conv_12 = addresses_vals[m];
19656 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
19657 addresses_constr.data[m] = addresses_conv_12_conv;
19659 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
19660 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
19663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
19664 LDKChannelManager this_arg_conv;
19665 this_arg_conv.inner = (void*)(this_arg & (~1));
19666 this_arg_conv.is_owned = false;
19667 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
19670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
19671 LDKChannelManager this_arg_conv;
19672 this_arg_conv.inner = (void*)(this_arg & (~1));
19673 this_arg_conv.is_owned = false;
19674 ChannelManager_timer_tick_occurred(&this_arg_conv);
19677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
19678 LDKChannelManager this_arg_conv;
19679 this_arg_conv.inner = (void*)(this_arg & (~1));
19680 this_arg_conv.is_owned = false;
19681 unsigned char payment_hash_arr[32];
19682 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
19683 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
19684 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
19685 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
19689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
19690 LDKChannelManager this_arg_conv;
19691 this_arg_conv.inner = (void*)(this_arg & (~1));
19692 this_arg_conv.is_owned = false;
19693 LDKThirtyTwoBytes payment_preimage_ref;
19694 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
19695 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
19696 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
19700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
19701 LDKChannelManager this_arg_conv;
19702 this_arg_conv.inner = (void*)(this_arg & (~1));
19703 this_arg_conv.is_owned = false;
19704 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19705 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
19709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
19710 LDKChannelManager this_arg_conv;
19711 this_arg_conv.inner = (void*)(this_arg & (~1));
19712 this_arg_conv.is_owned = false;
19713 LDKOutPoint funding_txo_conv;
19714 funding_txo_conv.inner = (void*)(funding_txo & (~1));
19715 funding_txo_conv.is_owned = false;
19716 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
19719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
19720 LDKChannelManager this_arg_conv;
19721 this_arg_conv.inner = (void*)(this_arg & (~1));
19722 this_arg_conv.is_owned = false;
19723 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
19724 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
19725 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19726 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
19727 return ((uint64_t)ret_conv);
19730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
19731 LDKChannelManager this_arg_conv;
19732 this_arg_conv.inner = (void*)(this_arg & (~1));
19733 this_arg_conv.is_owned = false;
19734 LDKThirtyTwoBytes payment_hash_ref;
19735 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
19736 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
19737 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
19738 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
19739 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19740 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
19741 return (uint64_t)ret_conv;
19744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19745 LDKChannelManager this_arg_conv;
19746 this_arg_conv.inner = (void*)(this_arg & (~1));
19747 this_arg_conv.is_owned = false;
19748 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19749 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
19750 return (uint64_t)ret_ret;
19753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19754 LDKChannelManager this_arg_conv;
19755 this_arg_conv.inner = (void*)(this_arg & (~1));
19756 this_arg_conv.is_owned = false;
19757 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
19758 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
19759 return (uint64_t)ret_ret;
19762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
19763 LDKChannelManager this_arg_conv;
19764 this_arg_conv.inner = (void*)(this_arg & (~1));
19765 this_arg_conv.is_owned = false;
19766 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
19767 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
19768 return (uint64_t)ret_ret;
19771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
19772 LDKChannelManager this_arg_conv;
19773 this_arg_conv.inner = (void*)(this_arg & (~1));
19774 this_arg_conv.is_owned = false;
19775 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
19776 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
19777 return (uint64_t)ret_ret;
19780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
19781 LDKChannelManager this_arg_conv;
19782 this_arg_conv.inner = (void*)(this_arg & (~1));
19783 this_arg_conv.is_owned = false;
19784 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
19788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
19789 LDKChannelManager this_arg_conv;
19790 this_arg_conv.inner = (void*)(this_arg & (~1));
19791 this_arg_conv.is_owned = false;
19792 ChannelManager_await_persistable_update(&this_arg_conv);
19795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
19796 LDKChannelManager this_arg_conv;
19797 this_arg_conv.inner = (void*)(this_arg & (~1));
19798 this_arg_conv.is_owned = false;
19799 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
19800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19802 uint64_t ret_ref = (uint64_t)ret_var.inner;
19803 if (ret_var.is_owned) {
19809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
19810 LDKChannelManager this_arg_conv;
19811 this_arg_conv.inner = (void*)(this_arg & (~1));
19812 this_arg_conv.is_owned = false;
19813 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
19814 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
19815 return (uint64_t)ret_ret;
19818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
19819 LDKChannelManager obj_conv;
19820 obj_conv.inner = (void*)(obj & (~1));
19821 obj_conv.is_owned = false;
19822 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
19823 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19824 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19825 CVec_u8Z_free(ret_var);
19829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19830 LDKChannelManagerReadArgs this_obj_conv;
19831 this_obj_conv.inner = (void*)(this_obj & (~1));
19832 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19833 ChannelManagerReadArgs_free(this_obj_conv);
19836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
19837 LDKChannelManagerReadArgs this_ptr_conv;
19838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19839 this_ptr_conv.is_owned = false;
19840 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
19844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19845 LDKChannelManagerReadArgs this_ptr_conv;
19846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19847 this_ptr_conv.is_owned = false;
19848 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
19849 if (val_conv.free == LDKKeysInterface_JCalls_free) {
19850 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19851 LDKKeysInterface_JCalls_cloned(&val_conv);
19853 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
19856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
19857 LDKChannelManagerReadArgs this_ptr_conv;
19858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19859 this_ptr_conv.is_owned = false;
19860 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
19864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19865 LDKChannelManagerReadArgs this_ptr_conv;
19866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19867 this_ptr_conv.is_owned = false;
19868 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
19869 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
19870 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19871 LDKFeeEstimator_JCalls_cloned(&val_conv);
19873 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
19876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
19877 LDKChannelManagerReadArgs this_ptr_conv;
19878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19879 this_ptr_conv.is_owned = false;
19880 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
19884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19885 LDKChannelManagerReadArgs this_ptr_conv;
19886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19887 this_ptr_conv.is_owned = false;
19888 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
19889 if (val_conv.free == LDKWatch_JCalls_free) {
19890 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19891 LDKWatch_JCalls_cloned(&val_conv);
19893 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
19896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
19897 LDKChannelManagerReadArgs this_ptr_conv;
19898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19899 this_ptr_conv.is_owned = false;
19900 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
19904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19905 LDKChannelManagerReadArgs this_ptr_conv;
19906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19907 this_ptr_conv.is_owned = false;
19908 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
19909 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
19910 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19911 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
19913 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
19916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
19917 LDKChannelManagerReadArgs this_ptr_conv;
19918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19919 this_ptr_conv.is_owned = false;
19920 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
19924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19925 LDKChannelManagerReadArgs this_ptr_conv;
19926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19927 this_ptr_conv.is_owned = false;
19928 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
19929 if (val_conv.free == LDKLogger_JCalls_free) {
19930 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19931 LDKLogger_JCalls_cloned(&val_conv);
19933 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
19936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
19937 LDKChannelManagerReadArgs this_ptr_conv;
19938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19939 this_ptr_conv.is_owned = false;
19940 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
19941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19943 uint64_t ret_ref = (uint64_t)ret_var.inner;
19944 if (ret_var.is_owned) {
19950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19951 LDKChannelManagerReadArgs this_ptr_conv;
19952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19953 this_ptr_conv.is_owned = false;
19954 LDKUserConfig val_conv;
19955 val_conv.inner = (void*)(val & (~1));
19956 val_conv.is_owned = (val & 1) || (val == 0);
19957 val_conv = UserConfig_clone(&val_conv);
19958 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
19961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
19962 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
19963 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
19964 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19965 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
19967 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
19968 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19969 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19970 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19972 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
19973 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
19974 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19975 LDKWatch_JCalls_cloned(&chain_monitor_conv);
19977 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
19978 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19979 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19980 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
19982 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19983 if (logger_conv.free == LDKLogger_JCalls_free) {
19984 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19985 LDKLogger_JCalls_cloned(&logger_conv);
19987 LDKUserConfig default_config_conv;
19988 default_config_conv.inner = (void*)(default_config & (~1));
19989 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
19990 default_config_conv = UserConfig_clone(&default_config_conv);
19991 LDKCVec_ChannelMonitorZ channel_monitors_constr;
19992 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
19993 if (channel_monitors_constr.datalen > 0)
19994 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19996 channel_monitors_constr.data = NULL;
19997 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
19998 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
19999 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
20000 LDKChannelMonitor channel_monitors_conv_16_conv;
20001 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
20002 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
20003 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
20005 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
20006 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
20007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20009 uint64_t ret_ref = (uint64_t)ret_var.inner;
20010 if (ret_var.is_owned) {
20016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
20017 LDKu8slice ser_ref;
20018 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20019 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20020 LDKChannelManagerReadArgs arg_conv;
20021 arg_conv.inner = (void*)(arg & (~1));
20022 arg_conv.is_owned = (arg & 1) || (arg == 0);
20023 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
20024 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20025 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
20026 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20027 return (uint64_t)ret_conv;
20030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20031 LDKDecodeError this_obj_conv;
20032 this_obj_conv.inner = (void*)(this_obj & (~1));
20033 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20034 DecodeError_free(this_obj_conv);
20037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20038 LDKDecodeError orig_conv;
20039 orig_conv.inner = (void*)(orig & (~1));
20040 orig_conv.is_owned = false;
20041 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
20042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20044 uint64_t ret_ref = (uint64_t)ret_var.inner;
20045 if (ret_var.is_owned) {
20051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20052 LDKInit this_obj_conv;
20053 this_obj_conv.inner = (void*)(this_obj & (~1));
20054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20055 Init_free(this_obj_conv);
20058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20059 LDKInit this_ptr_conv;
20060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20061 this_ptr_conv.is_owned = false;
20062 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
20063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20065 uint64_t ret_ref = (uint64_t)ret_var.inner;
20066 if (ret_var.is_owned) {
20072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20073 LDKInit this_ptr_conv;
20074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20075 this_ptr_conv.is_owned = false;
20076 LDKInitFeatures val_conv;
20077 val_conv.inner = (void*)(val & (~1));
20078 val_conv.is_owned = (val & 1) || (val == 0);
20079 val_conv = InitFeatures_clone(&val_conv);
20080 Init_set_features(&this_ptr_conv, val_conv);
20083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
20084 LDKInitFeatures features_arg_conv;
20085 features_arg_conv.inner = (void*)(features_arg & (~1));
20086 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20087 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20088 LDKInit ret_var = Init_new(features_arg_conv);
20089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20091 uint64_t ret_ref = (uint64_t)ret_var.inner;
20092 if (ret_var.is_owned) {
20098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20100 orig_conv.inner = (void*)(orig & (~1));
20101 orig_conv.is_owned = false;
20102 LDKInit ret_var = Init_clone(&orig_conv);
20103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20105 uint64_t ret_ref = (uint64_t)ret_var.inner;
20106 if (ret_var.is_owned) {
20112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20113 LDKErrorMessage this_obj_conv;
20114 this_obj_conv.inner = (void*)(this_obj & (~1));
20115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20116 ErrorMessage_free(this_obj_conv);
20119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20120 LDKErrorMessage this_ptr_conv;
20121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20122 this_ptr_conv.is_owned = false;
20123 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
20128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20129 LDKErrorMessage this_ptr_conv;
20130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20131 this_ptr_conv.is_owned = false;
20132 LDKThirtyTwoBytes val_ref;
20133 CHECK((*env)->GetArrayLength(env, val) == 32);
20134 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20135 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
20138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
20139 LDKErrorMessage this_ptr_conv;
20140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20141 this_ptr_conv.is_owned = false;
20142 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
20143 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20149 LDKErrorMessage this_ptr_conv;
20150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20151 this_ptr_conv.is_owned = false;
20152 LDKStr val_conv = java_to_owned_str(env, val);
20153 ErrorMessage_set_data(&this_ptr_conv, val_conv);
20156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
20157 LDKThirtyTwoBytes channel_id_arg_ref;
20158 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20159 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20160 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
20161 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
20162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20164 uint64_t ret_ref = (uint64_t)ret_var.inner;
20165 if (ret_var.is_owned) {
20171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20172 LDKErrorMessage orig_conv;
20173 orig_conv.inner = (void*)(orig & (~1));
20174 orig_conv.is_owned = false;
20175 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
20176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20178 uint64_t ret_ref = (uint64_t)ret_var.inner;
20179 if (ret_var.is_owned) {
20185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20186 LDKPing this_obj_conv;
20187 this_obj_conv.inner = (void*)(this_obj & (~1));
20188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20189 Ping_free(this_obj_conv);
20192 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20193 LDKPing this_ptr_conv;
20194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20195 this_ptr_conv.is_owned = false;
20196 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
20200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20201 LDKPing this_ptr_conv;
20202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20203 this_ptr_conv.is_owned = false;
20204 Ping_set_ponglen(&this_ptr_conv, val);
20207 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20208 LDKPing this_ptr_conv;
20209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20210 this_ptr_conv.is_owned = false;
20211 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
20215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20216 LDKPing this_ptr_conv;
20217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20218 this_ptr_conv.is_owned = false;
20219 Ping_set_byteslen(&this_ptr_conv, val);
20222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
20223 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
20224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20226 uint64_t ret_ref = (uint64_t)ret_var.inner;
20227 if (ret_var.is_owned) {
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20235 orig_conv.inner = (void*)(orig & (~1));
20236 orig_conv.is_owned = false;
20237 LDKPing ret_var = Ping_clone(&orig_conv);
20238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20240 uint64_t ret_ref = (uint64_t)ret_var.inner;
20241 if (ret_var.is_owned) {
20247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20248 LDKPong this_obj_conv;
20249 this_obj_conv.inner = (void*)(this_obj & (~1));
20250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20251 Pong_free(this_obj_conv);
20254 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20255 LDKPong this_ptr_conv;
20256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20257 this_ptr_conv.is_owned = false;
20258 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
20262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20263 LDKPong this_ptr_conv;
20264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20265 this_ptr_conv.is_owned = false;
20266 Pong_set_byteslen(&this_ptr_conv, val);
20269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
20270 LDKPong ret_var = Pong_new(byteslen_arg);
20271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20273 uint64_t ret_ref = (uint64_t)ret_var.inner;
20274 if (ret_var.is_owned) {
20280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20282 orig_conv.inner = (void*)(orig & (~1));
20283 orig_conv.is_owned = false;
20284 LDKPong ret_var = Pong_clone(&orig_conv);
20285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20287 uint64_t ret_ref = (uint64_t)ret_var.inner;
20288 if (ret_var.is_owned) {
20294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20295 LDKOpenChannel this_obj_conv;
20296 this_obj_conv.inner = (void*)(this_obj & (~1));
20297 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20298 OpenChannel_free(this_obj_conv);
20301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20302 LDKOpenChannel this_ptr_conv;
20303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20304 this_ptr_conv.is_owned = false;
20305 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20306 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
20310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20311 LDKOpenChannel this_ptr_conv;
20312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20313 this_ptr_conv.is_owned = false;
20314 LDKThirtyTwoBytes val_ref;
20315 CHECK((*env)->GetArrayLength(env, val) == 32);
20316 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20317 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
20320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20321 LDKOpenChannel this_ptr_conv;
20322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20323 this_ptr_conv.is_owned = false;
20324 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
20329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20330 LDKOpenChannel this_ptr_conv;
20331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20332 this_ptr_conv.is_owned = false;
20333 LDKThirtyTwoBytes val_ref;
20334 CHECK((*env)->GetArrayLength(env, val) == 32);
20335 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20336 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
20339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20340 LDKOpenChannel this_ptr_conv;
20341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20342 this_ptr_conv.is_owned = false;
20343 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
20347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20348 LDKOpenChannel this_ptr_conv;
20349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20350 this_ptr_conv.is_owned = false;
20351 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
20354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20355 LDKOpenChannel this_ptr_conv;
20356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20357 this_ptr_conv.is_owned = false;
20358 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
20362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20363 LDKOpenChannel this_ptr_conv;
20364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20365 this_ptr_conv.is_owned = false;
20366 OpenChannel_set_push_msat(&this_ptr_conv, val);
20369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20370 LDKOpenChannel this_ptr_conv;
20371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20372 this_ptr_conv.is_owned = false;
20373 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
20377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20378 LDKOpenChannel this_ptr_conv;
20379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20380 this_ptr_conv.is_owned = false;
20381 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
20384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20385 LDKOpenChannel this_ptr_conv;
20386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20387 this_ptr_conv.is_owned = false;
20388 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
20392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20393 LDKOpenChannel this_ptr_conv;
20394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20395 this_ptr_conv.is_owned = false;
20396 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20400 LDKOpenChannel this_ptr_conv;
20401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20402 this_ptr_conv.is_owned = false;
20403 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
20407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20408 LDKOpenChannel this_ptr_conv;
20409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20410 this_ptr_conv.is_owned = false;
20411 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
20414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20415 LDKOpenChannel this_ptr_conv;
20416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20417 this_ptr_conv.is_owned = false;
20418 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
20422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20423 LDKOpenChannel this_ptr_conv;
20424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20425 this_ptr_conv.is_owned = false;
20426 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
20429 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
20430 LDKOpenChannel this_ptr_conv;
20431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20432 this_ptr_conv.is_owned = false;
20433 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
20437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20438 LDKOpenChannel this_ptr_conv;
20439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20440 this_ptr_conv.is_owned = false;
20441 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
20444 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
20445 LDKOpenChannel this_ptr_conv;
20446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20447 this_ptr_conv.is_owned = false;
20448 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
20452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20453 LDKOpenChannel this_ptr_conv;
20454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20455 this_ptr_conv.is_owned = false;
20456 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
20459 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
20460 LDKOpenChannel this_ptr_conv;
20461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20462 this_ptr_conv.is_owned = false;
20463 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
20467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20468 LDKOpenChannel this_ptr_conv;
20469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20470 this_ptr_conv.is_owned = false;
20471 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
20474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20475 LDKOpenChannel this_ptr_conv;
20476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20477 this_ptr_conv.is_owned = false;
20478 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20479 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
20483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20484 LDKOpenChannel this_ptr_conv;
20485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20486 this_ptr_conv.is_owned = false;
20487 LDKPublicKey val_ref;
20488 CHECK((*env)->GetArrayLength(env, val) == 33);
20489 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20490 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
20493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20494 LDKOpenChannel this_ptr_conv;
20495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20496 this_ptr_conv.is_owned = false;
20497 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20498 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
20502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20503 LDKOpenChannel this_ptr_conv;
20504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20505 this_ptr_conv.is_owned = false;
20506 LDKPublicKey val_ref;
20507 CHECK((*env)->GetArrayLength(env, val) == 33);
20508 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20509 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
20512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20513 LDKOpenChannel this_ptr_conv;
20514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20515 this_ptr_conv.is_owned = false;
20516 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20517 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
20521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20522 LDKOpenChannel this_ptr_conv;
20523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20524 this_ptr_conv.is_owned = false;
20525 LDKPublicKey val_ref;
20526 CHECK((*env)->GetArrayLength(env, val) == 33);
20527 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20528 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
20531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20532 LDKOpenChannel this_ptr_conv;
20533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20534 this_ptr_conv.is_owned = false;
20535 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20536 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
20540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20541 LDKOpenChannel this_ptr_conv;
20542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20543 this_ptr_conv.is_owned = false;
20544 LDKPublicKey val_ref;
20545 CHECK((*env)->GetArrayLength(env, val) == 33);
20546 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20547 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
20550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20551 LDKOpenChannel this_ptr_conv;
20552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20553 this_ptr_conv.is_owned = false;
20554 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20555 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
20559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20560 LDKOpenChannel this_ptr_conv;
20561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20562 this_ptr_conv.is_owned = false;
20563 LDKPublicKey val_ref;
20564 CHECK((*env)->GetArrayLength(env, val) == 33);
20565 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20566 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
20569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20570 LDKOpenChannel this_ptr_conv;
20571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20572 this_ptr_conv.is_owned = false;
20573 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20574 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
20578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20579 LDKOpenChannel this_ptr_conv;
20580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20581 this_ptr_conv.is_owned = false;
20582 LDKPublicKey val_ref;
20583 CHECK((*env)->GetArrayLength(env, val) == 33);
20584 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20585 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
20588 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
20589 LDKOpenChannel this_ptr_conv;
20590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20591 this_ptr_conv.is_owned = false;
20592 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
20596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
20597 LDKOpenChannel this_ptr_conv;
20598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20599 this_ptr_conv.is_owned = false;
20600 OpenChannel_set_channel_flags(&this_ptr_conv, val);
20603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20604 LDKOpenChannel orig_conv;
20605 orig_conv.inner = (void*)(orig & (~1));
20606 orig_conv.is_owned = false;
20607 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
20608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20610 uint64_t ret_ref = (uint64_t)ret_var.inner;
20611 if (ret_var.is_owned) {
20617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20618 LDKAcceptChannel this_obj_conv;
20619 this_obj_conv.inner = (void*)(this_obj & (~1));
20620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20621 AcceptChannel_free(this_obj_conv);
20624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20625 LDKAcceptChannel this_ptr_conv;
20626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20627 this_ptr_conv.is_owned = false;
20628 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20629 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
20633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20634 LDKAcceptChannel this_ptr_conv;
20635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20636 this_ptr_conv.is_owned = false;
20637 LDKThirtyTwoBytes val_ref;
20638 CHECK((*env)->GetArrayLength(env, val) == 32);
20639 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20640 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
20643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20644 LDKAcceptChannel this_ptr_conv;
20645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20646 this_ptr_conv.is_owned = false;
20647 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
20651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20652 LDKAcceptChannel this_ptr_conv;
20653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20654 this_ptr_conv.is_owned = false;
20655 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
20658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20659 LDKAcceptChannel this_ptr_conv;
20660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20661 this_ptr_conv.is_owned = false;
20662 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
20666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20667 LDKAcceptChannel this_ptr_conv;
20668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20669 this_ptr_conv.is_owned = false;
20670 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
20673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20674 LDKAcceptChannel this_ptr_conv;
20675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20676 this_ptr_conv.is_owned = false;
20677 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
20681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20682 LDKAcceptChannel this_ptr_conv;
20683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20684 this_ptr_conv.is_owned = false;
20685 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
20688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20689 LDKAcceptChannel this_ptr_conv;
20690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20691 this_ptr_conv.is_owned = false;
20692 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
20696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20697 LDKAcceptChannel this_ptr_conv;
20698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20699 this_ptr_conv.is_owned = false;
20700 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
20703 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
20704 LDKAcceptChannel this_ptr_conv;
20705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20706 this_ptr_conv.is_owned = false;
20707 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
20711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20712 LDKAcceptChannel this_ptr_conv;
20713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20714 this_ptr_conv.is_owned = false;
20715 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
20718 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
20719 LDKAcceptChannel this_ptr_conv;
20720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20721 this_ptr_conv.is_owned = false;
20722 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
20726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20727 LDKAcceptChannel this_ptr_conv;
20728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20729 this_ptr_conv.is_owned = false;
20730 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
20733 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
20734 LDKAcceptChannel this_ptr_conv;
20735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20736 this_ptr_conv.is_owned = false;
20737 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
20741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20742 LDKAcceptChannel this_ptr_conv;
20743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20744 this_ptr_conv.is_owned = false;
20745 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
20748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20749 LDKAcceptChannel this_ptr_conv;
20750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20751 this_ptr_conv.is_owned = false;
20752 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
20757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20758 LDKAcceptChannel this_ptr_conv;
20759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20760 this_ptr_conv.is_owned = false;
20761 LDKPublicKey val_ref;
20762 CHECK((*env)->GetArrayLength(env, val) == 33);
20763 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20764 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
20767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20768 LDKAcceptChannel this_ptr_conv;
20769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20770 this_ptr_conv.is_owned = false;
20771 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20772 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
20776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20777 LDKAcceptChannel this_ptr_conv;
20778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20779 this_ptr_conv.is_owned = false;
20780 LDKPublicKey val_ref;
20781 CHECK((*env)->GetArrayLength(env, val) == 33);
20782 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20783 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
20786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20787 LDKAcceptChannel this_ptr_conv;
20788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20789 this_ptr_conv.is_owned = false;
20790 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20791 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
20795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20796 LDKAcceptChannel this_ptr_conv;
20797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20798 this_ptr_conv.is_owned = false;
20799 LDKPublicKey val_ref;
20800 CHECK((*env)->GetArrayLength(env, val) == 33);
20801 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20802 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
20805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20806 LDKAcceptChannel this_ptr_conv;
20807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20808 this_ptr_conv.is_owned = false;
20809 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
20814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20815 LDKAcceptChannel this_ptr_conv;
20816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20817 this_ptr_conv.is_owned = false;
20818 LDKPublicKey val_ref;
20819 CHECK((*env)->GetArrayLength(env, val) == 33);
20820 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20821 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
20824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20825 LDKAcceptChannel this_ptr_conv;
20826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20827 this_ptr_conv.is_owned = false;
20828 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
20833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20834 LDKAcceptChannel this_ptr_conv;
20835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20836 this_ptr_conv.is_owned = false;
20837 LDKPublicKey val_ref;
20838 CHECK((*env)->GetArrayLength(env, val) == 33);
20839 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20840 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
20843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20844 LDKAcceptChannel this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
20852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20853 LDKAcceptChannel this_ptr_conv;
20854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20855 this_ptr_conv.is_owned = false;
20856 LDKPublicKey val_ref;
20857 CHECK((*env)->GetArrayLength(env, val) == 33);
20858 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20859 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
20862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20863 LDKAcceptChannel orig_conv;
20864 orig_conv.inner = (void*)(orig & (~1));
20865 orig_conv.is_owned = false;
20866 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
20867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20869 uint64_t ret_ref = (uint64_t)ret_var.inner;
20870 if (ret_var.is_owned) {
20876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20877 LDKFundingCreated this_obj_conv;
20878 this_obj_conv.inner = (void*)(this_obj & (~1));
20879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20880 FundingCreated_free(this_obj_conv);
20883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20884 LDKFundingCreated this_ptr_conv;
20885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20886 this_ptr_conv.is_owned = false;
20887 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
20892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20893 LDKFundingCreated this_ptr_conv;
20894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20895 this_ptr_conv.is_owned = false;
20896 LDKThirtyTwoBytes val_ref;
20897 CHECK((*env)->GetArrayLength(env, val) == 32);
20898 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20899 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
20902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
20903 LDKFundingCreated this_ptr_conv;
20904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20905 this_ptr_conv.is_owned = false;
20906 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20907 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
20911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20912 LDKFundingCreated this_ptr_conv;
20913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20914 this_ptr_conv.is_owned = false;
20915 LDKThirtyTwoBytes val_ref;
20916 CHECK((*env)->GetArrayLength(env, val) == 32);
20917 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20918 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
20921 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
20922 LDKFundingCreated this_ptr_conv;
20923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20924 this_ptr_conv.is_owned = false;
20925 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
20929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20930 LDKFundingCreated this_ptr_conv;
20931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20932 this_ptr_conv.is_owned = false;
20933 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
20936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20937 LDKFundingCreated this_ptr_conv;
20938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20939 this_ptr_conv.is_owned = false;
20940 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
20945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20946 LDKFundingCreated this_ptr_conv;
20947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20948 this_ptr_conv.is_owned = false;
20949 LDKSignature val_ref;
20950 CHECK((*env)->GetArrayLength(env, val) == 64);
20951 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20952 FundingCreated_set_signature(&this_ptr_conv, val_ref);
20955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
20956 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
20957 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
20958 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
20959 LDKThirtyTwoBytes funding_txid_arg_ref;
20960 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
20961 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
20962 LDKSignature signature_arg_ref;
20963 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20964 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20965 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
20966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20968 uint64_t ret_ref = (uint64_t)ret_var.inner;
20969 if (ret_var.is_owned) {
20975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20976 LDKFundingCreated orig_conv;
20977 orig_conv.inner = (void*)(orig & (~1));
20978 orig_conv.is_owned = false;
20979 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
20980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20982 uint64_t ret_ref = (uint64_t)ret_var.inner;
20983 if (ret_var.is_owned) {
20989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20990 LDKFundingSigned this_obj_conv;
20991 this_obj_conv.inner = (void*)(this_obj & (~1));
20992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20993 FundingSigned_free(this_obj_conv);
20996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20997 LDKFundingSigned this_ptr_conv;
20998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20999 this_ptr_conv.is_owned = false;
21000 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21001 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
21005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21006 LDKFundingSigned this_ptr_conv;
21007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21008 this_ptr_conv.is_owned = false;
21009 LDKThirtyTwoBytes val_ref;
21010 CHECK((*env)->GetArrayLength(env, val) == 32);
21011 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21012 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
21015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21016 LDKFundingSigned this_ptr_conv;
21017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21018 this_ptr_conv.is_owned = false;
21019 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
21024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21025 LDKFundingSigned this_ptr_conv;
21026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21027 this_ptr_conv.is_owned = false;
21028 LDKSignature val_ref;
21029 CHECK((*env)->GetArrayLength(env, val) == 64);
21030 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21031 FundingSigned_set_signature(&this_ptr_conv, val_ref);
21034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
21035 LDKThirtyTwoBytes channel_id_arg_ref;
21036 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21037 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21038 LDKSignature signature_arg_ref;
21039 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21040 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21041 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
21042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21044 uint64_t ret_ref = (uint64_t)ret_var.inner;
21045 if (ret_var.is_owned) {
21051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21052 LDKFundingSigned orig_conv;
21053 orig_conv.inner = (void*)(orig & (~1));
21054 orig_conv.is_owned = false;
21055 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
21056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21058 uint64_t ret_ref = (uint64_t)ret_var.inner;
21059 if (ret_var.is_owned) {
21065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21066 LDKFundingLocked this_obj_conv;
21067 this_obj_conv.inner = (void*)(this_obj & (~1));
21068 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21069 FundingLocked_free(this_obj_conv);
21072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21073 LDKFundingLocked this_ptr_conv;
21074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21075 this_ptr_conv.is_owned = false;
21076 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
21081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21082 LDKFundingLocked this_ptr_conv;
21083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21084 this_ptr_conv.is_owned = false;
21085 LDKThirtyTwoBytes val_ref;
21086 CHECK((*env)->GetArrayLength(env, val) == 32);
21087 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21088 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
21091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21092 LDKFundingLocked this_ptr_conv;
21093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21094 this_ptr_conv.is_owned = false;
21095 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21096 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21101 LDKFundingLocked this_ptr_conv;
21102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21103 this_ptr_conv.is_owned = false;
21104 LDKPublicKey val_ref;
21105 CHECK((*env)->GetArrayLength(env, val) == 33);
21106 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21107 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
21111 LDKThirtyTwoBytes channel_id_arg_ref;
21112 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21113 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21114 LDKPublicKey next_per_commitment_point_arg_ref;
21115 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21116 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21117 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
21118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21120 uint64_t ret_ref = (uint64_t)ret_var.inner;
21121 if (ret_var.is_owned) {
21127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21128 LDKFundingLocked orig_conv;
21129 orig_conv.inner = (void*)(orig & (~1));
21130 orig_conv.is_owned = false;
21131 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
21132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21134 uint64_t ret_ref = (uint64_t)ret_var.inner;
21135 if (ret_var.is_owned) {
21141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21142 LDKShutdown this_obj_conv;
21143 this_obj_conv.inner = (void*)(this_obj & (~1));
21144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21145 Shutdown_free(this_obj_conv);
21148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21149 LDKShutdown this_ptr_conv;
21150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21151 this_ptr_conv.is_owned = false;
21152 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21153 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
21157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21158 LDKShutdown this_ptr_conv;
21159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21160 this_ptr_conv.is_owned = false;
21161 LDKThirtyTwoBytes val_ref;
21162 CHECK((*env)->GetArrayLength(env, val) == 32);
21163 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21164 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
21167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21168 LDKShutdown this_ptr_conv;
21169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21170 this_ptr_conv.is_owned = false;
21171 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
21172 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21173 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21178 LDKShutdown this_ptr_conv;
21179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21180 this_ptr_conv.is_owned = false;
21181 LDKCVec_u8Z val_ref;
21182 val_ref.datalen = (*env)->GetArrayLength(env, val);
21183 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21184 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
21185 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
21188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
21189 LDKThirtyTwoBytes channel_id_arg_ref;
21190 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21191 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21192 LDKCVec_u8Z scriptpubkey_arg_ref;
21193 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
21194 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21195 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
21196 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
21197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21199 uint64_t ret_ref = (uint64_t)ret_var.inner;
21200 if (ret_var.is_owned) {
21206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21207 LDKShutdown orig_conv;
21208 orig_conv.inner = (void*)(orig & (~1));
21209 orig_conv.is_owned = false;
21210 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
21211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21213 uint64_t ret_ref = (uint64_t)ret_var.inner;
21214 if (ret_var.is_owned) {
21220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21221 LDKClosingSignedFeeRange this_obj_conv;
21222 this_obj_conv.inner = (void*)(this_obj & (~1));
21223 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21224 ClosingSignedFeeRange_free(this_obj_conv);
21227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21228 LDKClosingSignedFeeRange this_ptr_conv;
21229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21230 this_ptr_conv.is_owned = false;
21231 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
21235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21236 LDKClosingSignedFeeRange this_ptr_conv;
21237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21238 this_ptr_conv.is_owned = false;
21239 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
21242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21243 LDKClosingSignedFeeRange this_ptr_conv;
21244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21245 this_ptr_conv.is_owned = false;
21246 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
21250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21251 LDKClosingSignedFeeRange this_ptr_conv;
21252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21253 this_ptr_conv.is_owned = false;
21254 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
21257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
21258 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
21259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21261 uint64_t ret_ref = (uint64_t)ret_var.inner;
21262 if (ret_var.is_owned) {
21268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21269 LDKClosingSignedFeeRange orig_conv;
21270 orig_conv.inner = (void*)(orig & (~1));
21271 orig_conv.is_owned = false;
21272 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
21273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21275 uint64_t ret_ref = (uint64_t)ret_var.inner;
21276 if (ret_var.is_owned) {
21282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21283 LDKClosingSigned this_obj_conv;
21284 this_obj_conv.inner = (void*)(this_obj & (~1));
21285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21286 ClosingSigned_free(this_obj_conv);
21289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21290 LDKClosingSigned this_ptr_conv;
21291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21292 this_ptr_conv.is_owned = false;
21293 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21294 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
21298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21299 LDKClosingSigned this_ptr_conv;
21300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21301 this_ptr_conv.is_owned = false;
21302 LDKThirtyTwoBytes val_ref;
21303 CHECK((*env)->GetArrayLength(env, val) == 32);
21304 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21305 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
21308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21309 LDKClosingSigned this_ptr_conv;
21310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21311 this_ptr_conv.is_owned = false;
21312 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
21316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21317 LDKClosingSigned this_ptr_conv;
21318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21319 this_ptr_conv.is_owned = false;
21320 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
21323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21324 LDKClosingSigned this_ptr_conv;
21325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21326 this_ptr_conv.is_owned = false;
21327 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21328 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
21332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21333 LDKClosingSigned this_ptr_conv;
21334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21335 this_ptr_conv.is_owned = false;
21336 LDKSignature val_ref;
21337 CHECK((*env)->GetArrayLength(env, val) == 64);
21338 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21339 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
21342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
21343 LDKClosingSigned this_ptr_conv;
21344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21345 this_ptr_conv.is_owned = false;
21346 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
21347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21349 uint64_t ret_ref = (uint64_t)ret_var.inner;
21350 if (ret_var.is_owned) {
21356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21357 LDKClosingSigned this_ptr_conv;
21358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21359 this_ptr_conv.is_owned = false;
21360 LDKClosingSignedFeeRange val_conv;
21361 val_conv.inner = (void*)(val & (~1));
21362 val_conv.is_owned = (val & 1) || (val == 0);
21363 val_conv = ClosingSignedFeeRange_clone(&val_conv);
21364 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
21367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
21368 LDKThirtyTwoBytes channel_id_arg_ref;
21369 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21370 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21371 LDKSignature signature_arg_ref;
21372 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21373 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21374 LDKClosingSignedFeeRange fee_range_arg_conv;
21375 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
21376 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
21377 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
21378 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
21379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21381 uint64_t ret_ref = (uint64_t)ret_var.inner;
21382 if (ret_var.is_owned) {
21388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21389 LDKClosingSigned orig_conv;
21390 orig_conv.inner = (void*)(orig & (~1));
21391 orig_conv.is_owned = false;
21392 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
21393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21395 uint64_t ret_ref = (uint64_t)ret_var.inner;
21396 if (ret_var.is_owned) {
21402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21403 LDKUpdateAddHTLC this_obj_conv;
21404 this_obj_conv.inner = (void*)(this_obj & (~1));
21405 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21406 UpdateAddHTLC_free(this_obj_conv);
21409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21410 LDKUpdateAddHTLC this_ptr_conv;
21411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21412 this_ptr_conv.is_owned = false;
21413 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21414 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
21418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21419 LDKUpdateAddHTLC this_ptr_conv;
21420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21421 this_ptr_conv.is_owned = false;
21422 LDKThirtyTwoBytes val_ref;
21423 CHECK((*env)->GetArrayLength(env, val) == 32);
21424 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21425 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
21428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21429 LDKUpdateAddHTLC this_ptr_conv;
21430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21431 this_ptr_conv.is_owned = false;
21432 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
21436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21437 LDKUpdateAddHTLC this_ptr_conv;
21438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21439 this_ptr_conv.is_owned = false;
21440 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
21443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21444 LDKUpdateAddHTLC this_ptr_conv;
21445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21446 this_ptr_conv.is_owned = false;
21447 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
21451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21452 LDKUpdateAddHTLC this_ptr_conv;
21453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21454 this_ptr_conv.is_owned = false;
21455 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
21458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21459 LDKUpdateAddHTLC this_ptr_conv;
21460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21461 this_ptr_conv.is_owned = false;
21462 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21463 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
21467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21468 LDKUpdateAddHTLC this_ptr_conv;
21469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21470 this_ptr_conv.is_owned = false;
21471 LDKThirtyTwoBytes val_ref;
21472 CHECK((*env)->GetArrayLength(env, val) == 32);
21473 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21474 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
21477 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21478 LDKUpdateAddHTLC this_ptr_conv;
21479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21480 this_ptr_conv.is_owned = false;
21481 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
21485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21486 LDKUpdateAddHTLC this_ptr_conv;
21487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21488 this_ptr_conv.is_owned = false;
21489 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
21492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21493 LDKUpdateAddHTLC orig_conv;
21494 orig_conv.inner = (void*)(orig & (~1));
21495 orig_conv.is_owned = false;
21496 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
21497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21499 uint64_t ret_ref = (uint64_t)ret_var.inner;
21500 if (ret_var.is_owned) {
21506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21507 LDKUpdateFulfillHTLC this_obj_conv;
21508 this_obj_conv.inner = (void*)(this_obj & (~1));
21509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21510 UpdateFulfillHTLC_free(this_obj_conv);
21513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21514 LDKUpdateFulfillHTLC this_ptr_conv;
21515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21516 this_ptr_conv.is_owned = false;
21517 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21518 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
21522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21523 LDKUpdateFulfillHTLC this_ptr_conv;
21524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21525 this_ptr_conv.is_owned = false;
21526 LDKThirtyTwoBytes val_ref;
21527 CHECK((*env)->GetArrayLength(env, val) == 32);
21528 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21529 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
21532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21533 LDKUpdateFulfillHTLC this_ptr_conv;
21534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21535 this_ptr_conv.is_owned = false;
21536 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
21540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21541 LDKUpdateFulfillHTLC this_ptr_conv;
21542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21543 this_ptr_conv.is_owned = false;
21544 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
21547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
21548 LDKUpdateFulfillHTLC this_ptr_conv;
21549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21550 this_ptr_conv.is_owned = false;
21551 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21552 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
21556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21557 LDKUpdateFulfillHTLC this_ptr_conv;
21558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21559 this_ptr_conv.is_owned = false;
21560 LDKThirtyTwoBytes val_ref;
21561 CHECK((*env)->GetArrayLength(env, val) == 32);
21562 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21563 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
21566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
21567 LDKThirtyTwoBytes channel_id_arg_ref;
21568 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21569 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21570 LDKThirtyTwoBytes payment_preimage_arg_ref;
21571 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
21572 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
21573 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
21574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21576 uint64_t ret_ref = (uint64_t)ret_var.inner;
21577 if (ret_var.is_owned) {
21583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21584 LDKUpdateFulfillHTLC orig_conv;
21585 orig_conv.inner = (void*)(orig & (~1));
21586 orig_conv.is_owned = false;
21587 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
21588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21590 uint64_t ret_ref = (uint64_t)ret_var.inner;
21591 if (ret_var.is_owned) {
21597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21598 LDKUpdateFailHTLC this_obj_conv;
21599 this_obj_conv.inner = (void*)(this_obj & (~1));
21600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21601 UpdateFailHTLC_free(this_obj_conv);
21604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21605 LDKUpdateFailHTLC this_ptr_conv;
21606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21607 this_ptr_conv.is_owned = false;
21608 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21609 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
21613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21614 LDKUpdateFailHTLC this_ptr_conv;
21615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21616 this_ptr_conv.is_owned = false;
21617 LDKThirtyTwoBytes val_ref;
21618 CHECK((*env)->GetArrayLength(env, val) == 32);
21619 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21620 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
21623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21624 LDKUpdateFailHTLC this_ptr_conv;
21625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21626 this_ptr_conv.is_owned = false;
21627 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
21631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21632 LDKUpdateFailHTLC this_ptr_conv;
21633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21634 this_ptr_conv.is_owned = false;
21635 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
21638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21639 LDKUpdateFailHTLC orig_conv;
21640 orig_conv.inner = (void*)(orig & (~1));
21641 orig_conv.is_owned = false;
21642 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
21643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21645 uint64_t ret_ref = (uint64_t)ret_var.inner;
21646 if (ret_var.is_owned) {
21652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21653 LDKUpdateFailMalformedHTLC this_obj_conv;
21654 this_obj_conv.inner = (void*)(this_obj & (~1));
21655 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21656 UpdateFailMalformedHTLC_free(this_obj_conv);
21659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21660 LDKUpdateFailMalformedHTLC this_ptr_conv;
21661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21662 this_ptr_conv.is_owned = false;
21663 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21664 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
21668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21669 LDKUpdateFailMalformedHTLC this_ptr_conv;
21670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21671 this_ptr_conv.is_owned = false;
21672 LDKThirtyTwoBytes val_ref;
21673 CHECK((*env)->GetArrayLength(env, val) == 32);
21674 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21675 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
21678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21679 LDKUpdateFailMalformedHTLC this_ptr_conv;
21680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21681 this_ptr_conv.is_owned = false;
21682 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
21686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21687 LDKUpdateFailMalformedHTLC this_ptr_conv;
21688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21689 this_ptr_conv.is_owned = false;
21690 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
21693 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
21694 LDKUpdateFailMalformedHTLC this_ptr_conv;
21695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21696 this_ptr_conv.is_owned = false;
21697 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
21701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21702 LDKUpdateFailMalformedHTLC this_ptr_conv;
21703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21704 this_ptr_conv.is_owned = false;
21705 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
21708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21709 LDKUpdateFailMalformedHTLC orig_conv;
21710 orig_conv.inner = (void*)(orig & (~1));
21711 orig_conv.is_owned = false;
21712 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
21713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21715 uint64_t ret_ref = (uint64_t)ret_var.inner;
21716 if (ret_var.is_owned) {
21722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21723 LDKCommitmentSigned this_obj_conv;
21724 this_obj_conv.inner = (void*)(this_obj & (~1));
21725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21726 CommitmentSigned_free(this_obj_conv);
21729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21730 LDKCommitmentSigned this_ptr_conv;
21731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21732 this_ptr_conv.is_owned = false;
21733 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
21738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21739 LDKCommitmentSigned this_ptr_conv;
21740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21741 this_ptr_conv.is_owned = false;
21742 LDKThirtyTwoBytes val_ref;
21743 CHECK((*env)->GetArrayLength(env, val) == 32);
21744 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21745 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
21748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21749 LDKCommitmentSigned this_ptr_conv;
21750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21751 this_ptr_conv.is_owned = false;
21752 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
21757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21758 LDKCommitmentSigned this_ptr_conv;
21759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21760 this_ptr_conv.is_owned = false;
21761 LDKSignature val_ref;
21762 CHECK((*env)->GetArrayLength(env, val) == 64);
21763 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21764 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
21767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21768 LDKCommitmentSigned this_ptr_conv;
21769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21770 this_ptr_conv.is_owned = false;
21771 LDKCVec_SignatureZ val_constr;
21772 val_constr.datalen = (*env)->GetArrayLength(env, val);
21773 if (val_constr.datalen > 0)
21774 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21776 val_constr.data = NULL;
21777 for (size_t i = 0; i < val_constr.datalen; i++) {
21778 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21779 LDKSignature val_conv_8_ref;
21780 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21781 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21782 val_constr.data[i] = val_conv_8_ref;
21784 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
21787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
21788 LDKThirtyTwoBytes channel_id_arg_ref;
21789 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21790 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21791 LDKSignature signature_arg_ref;
21792 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21793 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21794 LDKCVec_SignatureZ htlc_signatures_arg_constr;
21795 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
21796 if (htlc_signatures_arg_constr.datalen > 0)
21797 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21799 htlc_signatures_arg_constr.data = NULL;
21800 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
21801 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
21802 LDKSignature htlc_signatures_arg_conv_8_ref;
21803 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
21804 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
21805 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
21807 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
21808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21810 uint64_t ret_ref = (uint64_t)ret_var.inner;
21811 if (ret_var.is_owned) {
21817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21818 LDKCommitmentSigned orig_conv;
21819 orig_conv.inner = (void*)(orig & (~1));
21820 orig_conv.is_owned = false;
21821 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
21822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21824 uint64_t ret_ref = (uint64_t)ret_var.inner;
21825 if (ret_var.is_owned) {
21831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21832 LDKRevokeAndACK this_obj_conv;
21833 this_obj_conv.inner = (void*)(this_obj & (~1));
21834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21835 RevokeAndACK_free(this_obj_conv);
21838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21839 LDKRevokeAndACK this_ptr_conv;
21840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21841 this_ptr_conv.is_owned = false;
21842 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21843 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
21847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21848 LDKRevokeAndACK this_ptr_conv;
21849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21850 this_ptr_conv.is_owned = false;
21851 LDKThirtyTwoBytes val_ref;
21852 CHECK((*env)->GetArrayLength(env, val) == 32);
21853 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21854 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
21857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21858 LDKRevokeAndACK this_ptr_conv;
21859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21860 this_ptr_conv.is_owned = false;
21861 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21862 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
21866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21867 LDKRevokeAndACK this_ptr_conv;
21868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21869 this_ptr_conv.is_owned = false;
21870 LDKThirtyTwoBytes val_ref;
21871 CHECK((*env)->GetArrayLength(env, val) == 32);
21872 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21873 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
21876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21877 LDKRevokeAndACK this_ptr_conv;
21878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21879 this_ptr_conv.is_owned = false;
21880 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21881 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21886 LDKRevokeAndACK this_ptr_conv;
21887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21888 this_ptr_conv.is_owned = false;
21889 LDKPublicKey val_ref;
21890 CHECK((*env)->GetArrayLength(env, val) == 33);
21891 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21892 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
21896 LDKThirtyTwoBytes channel_id_arg_ref;
21897 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21898 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21899 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
21900 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
21901 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
21902 LDKPublicKey next_per_commitment_point_arg_ref;
21903 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21904 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21905 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
21906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21908 uint64_t ret_ref = (uint64_t)ret_var.inner;
21909 if (ret_var.is_owned) {
21915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21916 LDKRevokeAndACK orig_conv;
21917 orig_conv.inner = (void*)(orig & (~1));
21918 orig_conv.is_owned = false;
21919 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
21920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21922 uint64_t ret_ref = (uint64_t)ret_var.inner;
21923 if (ret_var.is_owned) {
21929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21930 LDKUpdateFee this_obj_conv;
21931 this_obj_conv.inner = (void*)(this_obj & (~1));
21932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21933 UpdateFee_free(this_obj_conv);
21936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21937 LDKUpdateFee this_ptr_conv;
21938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21939 this_ptr_conv.is_owned = false;
21940 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
21945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21946 LDKUpdateFee this_ptr_conv;
21947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21948 this_ptr_conv.is_owned = false;
21949 LDKThirtyTwoBytes val_ref;
21950 CHECK((*env)->GetArrayLength(env, val) == 32);
21951 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21952 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
21955 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
21956 LDKUpdateFee this_ptr_conv;
21957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21958 this_ptr_conv.is_owned = false;
21959 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
21963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21964 LDKUpdateFee this_ptr_conv;
21965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21966 this_ptr_conv.is_owned = false;
21967 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
21970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
21971 LDKThirtyTwoBytes channel_id_arg_ref;
21972 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21973 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21974 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
21975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21977 uint64_t ret_ref = (uint64_t)ret_var.inner;
21978 if (ret_var.is_owned) {
21984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21985 LDKUpdateFee orig_conv;
21986 orig_conv.inner = (void*)(orig & (~1));
21987 orig_conv.is_owned = false;
21988 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
21989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21991 uint64_t ret_ref = (uint64_t)ret_var.inner;
21992 if (ret_var.is_owned) {
21998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21999 LDKDataLossProtect this_obj_conv;
22000 this_obj_conv.inner = (void*)(this_obj & (~1));
22001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22002 DataLossProtect_free(this_obj_conv);
22005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
22006 LDKDataLossProtect this_ptr_conv;
22007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22008 this_ptr_conv.is_owned = false;
22009 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22010 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
22014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22015 LDKDataLossProtect this_ptr_conv;
22016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22017 this_ptr_conv.is_owned = false;
22018 LDKThirtyTwoBytes val_ref;
22019 CHECK((*env)->GetArrayLength(env, val) == 32);
22020 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22021 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
22024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22025 LDKDataLossProtect this_ptr_conv;
22026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22027 this_ptr_conv.is_owned = false;
22028 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22029 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
22033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22034 LDKDataLossProtect this_ptr_conv;
22035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22036 this_ptr_conv.is_owned = false;
22037 LDKPublicKey val_ref;
22038 CHECK((*env)->GetArrayLength(env, val) == 33);
22039 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22040 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
22043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
22044 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
22045 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
22046 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
22047 LDKPublicKey my_current_per_commitment_point_arg_ref;
22048 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
22049 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
22050 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
22051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22053 uint64_t ret_ref = (uint64_t)ret_var.inner;
22054 if (ret_var.is_owned) {
22060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22061 LDKDataLossProtect orig_conv;
22062 orig_conv.inner = (void*)(orig & (~1));
22063 orig_conv.is_owned = false;
22064 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
22065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22067 uint64_t ret_ref = (uint64_t)ret_var.inner;
22068 if (ret_var.is_owned) {
22074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22075 LDKChannelReestablish this_obj_conv;
22076 this_obj_conv.inner = (void*)(this_obj & (~1));
22077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22078 ChannelReestablish_free(this_obj_conv);
22081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22082 LDKChannelReestablish this_ptr_conv;
22083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22084 this_ptr_conv.is_owned = false;
22085 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22086 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
22090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22091 LDKChannelReestablish this_ptr_conv;
22092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22093 this_ptr_conv.is_owned = false;
22094 LDKThirtyTwoBytes val_ref;
22095 CHECK((*env)->GetArrayLength(env, val) == 32);
22096 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22097 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
22100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
22101 LDKChannelReestablish this_ptr_conv;
22102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22103 this_ptr_conv.is_owned = false;
22104 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
22108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22109 LDKChannelReestablish this_ptr_conv;
22110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22111 this_ptr_conv.is_owned = false;
22112 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
22115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
22116 LDKChannelReestablish this_ptr_conv;
22117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22118 this_ptr_conv.is_owned = false;
22119 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
22123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22124 LDKChannelReestablish this_ptr_conv;
22125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22126 this_ptr_conv.is_owned = false;
22127 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
22130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22131 LDKChannelReestablish orig_conv;
22132 orig_conv.inner = (void*)(orig & (~1));
22133 orig_conv.is_owned = false;
22134 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
22135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22137 uint64_t ret_ref = (uint64_t)ret_var.inner;
22138 if (ret_var.is_owned) {
22144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22145 LDKAnnouncementSignatures this_obj_conv;
22146 this_obj_conv.inner = (void*)(this_obj & (~1));
22147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22148 AnnouncementSignatures_free(this_obj_conv);
22151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22152 LDKAnnouncementSignatures this_ptr_conv;
22153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22154 this_ptr_conv.is_owned = false;
22155 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
22160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22161 LDKAnnouncementSignatures this_ptr_conv;
22162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22163 this_ptr_conv.is_owned = false;
22164 LDKThirtyTwoBytes val_ref;
22165 CHECK((*env)->GetArrayLength(env, val) == 32);
22166 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22167 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
22170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22171 LDKAnnouncementSignatures this_ptr_conv;
22172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22173 this_ptr_conv.is_owned = false;
22174 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
22178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22179 LDKAnnouncementSignatures this_ptr_conv;
22180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22181 this_ptr_conv.is_owned = false;
22182 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
22185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22186 LDKAnnouncementSignatures this_ptr_conv;
22187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22188 this_ptr_conv.is_owned = false;
22189 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22190 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
22194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22195 LDKAnnouncementSignatures this_ptr_conv;
22196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22197 this_ptr_conv.is_owned = false;
22198 LDKSignature val_ref;
22199 CHECK((*env)->GetArrayLength(env, val) == 64);
22200 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22201 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
22204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22205 LDKAnnouncementSignatures this_ptr_conv;
22206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22207 this_ptr_conv.is_owned = false;
22208 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
22213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22214 LDKAnnouncementSignatures this_ptr_conv;
22215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22216 this_ptr_conv.is_owned = false;
22217 LDKSignature val_ref;
22218 CHECK((*env)->GetArrayLength(env, val) == 64);
22219 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22220 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
22223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
22224 LDKThirtyTwoBytes channel_id_arg_ref;
22225 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22226 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22227 LDKSignature node_signature_arg_ref;
22228 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
22229 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
22230 LDKSignature bitcoin_signature_arg_ref;
22231 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
22232 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
22233 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
22234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22236 uint64_t ret_ref = (uint64_t)ret_var.inner;
22237 if (ret_var.is_owned) {
22243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22244 LDKAnnouncementSignatures orig_conv;
22245 orig_conv.inner = (void*)(orig & (~1));
22246 orig_conv.is_owned = false;
22247 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
22248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22250 uint64_t ret_ref = (uint64_t)ret_var.inner;
22251 if (ret_var.is_owned) {
22257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22258 if ((this_ptr & 1) != 0) return;
22259 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
22260 FREE((void*)this_ptr);
22261 NetAddress_free(this_ptr_conv);
22264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22265 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
22266 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22267 *ret_copy = NetAddress_clone(orig_conv);
22268 uint64_t ret_ref = (uint64_t)ret_copy;
22272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22273 LDKFourBytes addr_ref;
22274 CHECK((*env)->GetArrayLength(env, addr) == 4);
22275 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
22276 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22277 *ret_copy = NetAddress_ipv4(addr_ref, port);
22278 uint64_t ret_ref = (uint64_t)ret_copy;
22282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22283 LDKSixteenBytes addr_ref;
22284 CHECK((*env)->GetArrayLength(env, addr) == 16);
22285 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
22286 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22287 *ret_copy = NetAddress_ipv6(addr_ref, port);
22288 uint64_t ret_ref = (uint64_t)ret_copy;
22292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22293 LDKTenBytes addr_ref;
22294 CHECK((*env)->GetArrayLength(env, addr) == 10);
22295 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
22296 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22297 *ret_copy = NetAddress_onion_v2(addr_ref, port);
22298 uint64_t ret_ref = (uint64_t)ret_copy;
22302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
22303 LDKThirtyTwoBytes ed25519_pubkey_ref;
22304 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
22305 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
22306 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22307 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
22308 uint64_t ret_ref = (uint64_t)ret_copy;
22312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
22313 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
22314 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
22315 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22316 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22317 CVec_u8Z_free(ret_var);
22321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22322 LDKu8slice ser_ref;
22323 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22324 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22325 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
22326 *ret_conv = Result_read(ser_ref);
22327 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22328 return (uint64_t)ret_conv;
22331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22332 LDKu8slice ser_ref;
22333 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22334 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22335 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22336 *ret_conv = NetAddress_read(ser_ref);
22337 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22338 return (uint64_t)ret_conv;
22341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22342 LDKUnsignedNodeAnnouncement this_obj_conv;
22343 this_obj_conv.inner = (void*)(this_obj & (~1));
22344 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22345 UnsignedNodeAnnouncement_free(this_obj_conv);
22348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22349 LDKUnsignedNodeAnnouncement this_ptr_conv;
22350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22351 this_ptr_conv.is_owned = false;
22352 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
22353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22355 uint64_t ret_ref = (uint64_t)ret_var.inner;
22356 if (ret_var.is_owned) {
22362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22363 LDKUnsignedNodeAnnouncement this_ptr_conv;
22364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22365 this_ptr_conv.is_owned = false;
22366 LDKNodeFeatures val_conv;
22367 val_conv.inner = (void*)(val & (~1));
22368 val_conv.is_owned = (val & 1) || (val == 0);
22369 val_conv = NodeFeatures_clone(&val_conv);
22370 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
22373 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22374 LDKUnsignedNodeAnnouncement this_ptr_conv;
22375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22376 this_ptr_conv.is_owned = false;
22377 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
22381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22382 LDKUnsignedNodeAnnouncement this_ptr_conv;
22383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22384 this_ptr_conv.is_owned = false;
22385 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
22388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22389 LDKUnsignedNodeAnnouncement this_ptr_conv;
22390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22391 this_ptr_conv.is_owned = false;
22392 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22393 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
22397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22398 LDKUnsignedNodeAnnouncement this_ptr_conv;
22399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22400 this_ptr_conv.is_owned = false;
22401 LDKPublicKey val_ref;
22402 CHECK((*env)->GetArrayLength(env, val) == 33);
22403 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22404 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
22407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
22408 LDKUnsignedNodeAnnouncement this_ptr_conv;
22409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22410 this_ptr_conv.is_owned = false;
22411 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
22412 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
22416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22417 LDKUnsignedNodeAnnouncement this_ptr_conv;
22418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22419 this_ptr_conv.is_owned = false;
22420 LDKThreeBytes val_ref;
22421 CHECK((*env)->GetArrayLength(env, val) == 3);
22422 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
22423 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
22426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
22427 LDKUnsignedNodeAnnouncement this_ptr_conv;
22428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22429 this_ptr_conv.is_owned = false;
22430 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22431 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
22435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22436 LDKUnsignedNodeAnnouncement this_ptr_conv;
22437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22438 this_ptr_conv.is_owned = false;
22439 LDKThirtyTwoBytes val_ref;
22440 CHECK((*env)->GetArrayLength(env, val) == 32);
22441 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22442 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
22445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22446 LDKUnsignedNodeAnnouncement this_ptr_conv;
22447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22448 this_ptr_conv.is_owned = false;
22449 LDKCVec_NetAddressZ val_constr;
22450 val_constr.datalen = (*env)->GetArrayLength(env, val);
22451 if (val_constr.datalen > 0)
22452 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
22454 val_constr.data = NULL;
22455 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22456 for (size_t m = 0; m < val_constr.datalen; m++) {
22457 int64_t val_conv_12 = val_vals[m];
22458 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
22459 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
22460 val_constr.data[m] = val_conv_12_conv;
22462 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22463 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
22466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22467 LDKUnsignedNodeAnnouncement orig_conv;
22468 orig_conv.inner = (void*)(orig & (~1));
22469 orig_conv.is_owned = false;
22470 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
22471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22473 uint64_t ret_ref = (uint64_t)ret_var.inner;
22474 if (ret_var.is_owned) {
22480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22481 LDKNodeAnnouncement this_obj_conv;
22482 this_obj_conv.inner = (void*)(this_obj & (~1));
22483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22484 NodeAnnouncement_free(this_obj_conv);
22487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22488 LDKNodeAnnouncement this_ptr_conv;
22489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22490 this_ptr_conv.is_owned = false;
22491 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
22496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22497 LDKNodeAnnouncement this_ptr_conv;
22498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22499 this_ptr_conv.is_owned = false;
22500 LDKSignature val_ref;
22501 CHECK((*env)->GetArrayLength(env, val) == 64);
22502 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22503 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
22506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22507 LDKNodeAnnouncement this_ptr_conv;
22508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22509 this_ptr_conv.is_owned = false;
22510 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
22511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22513 uint64_t ret_ref = (uint64_t)ret_var.inner;
22514 if (ret_var.is_owned) {
22520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22521 LDKNodeAnnouncement this_ptr_conv;
22522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22523 this_ptr_conv.is_owned = false;
22524 LDKUnsignedNodeAnnouncement val_conv;
22525 val_conv.inner = (void*)(val & (~1));
22526 val_conv.is_owned = (val & 1) || (val == 0);
22527 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
22528 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
22531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
22532 LDKSignature signature_arg_ref;
22533 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22534 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22535 LDKUnsignedNodeAnnouncement contents_arg_conv;
22536 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22537 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22538 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
22539 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
22540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22542 uint64_t ret_ref = (uint64_t)ret_var.inner;
22543 if (ret_var.is_owned) {
22549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22550 LDKNodeAnnouncement orig_conv;
22551 orig_conv.inner = (void*)(orig & (~1));
22552 orig_conv.is_owned = false;
22553 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
22554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22556 uint64_t ret_ref = (uint64_t)ret_var.inner;
22557 if (ret_var.is_owned) {
22563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22564 LDKUnsignedChannelAnnouncement this_obj_conv;
22565 this_obj_conv.inner = (void*)(this_obj & (~1));
22566 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22567 UnsignedChannelAnnouncement_free(this_obj_conv);
22570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22571 LDKUnsignedChannelAnnouncement this_ptr_conv;
22572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22573 this_ptr_conv.is_owned = false;
22574 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
22575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22577 uint64_t ret_ref = (uint64_t)ret_var.inner;
22578 if (ret_var.is_owned) {
22584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22585 LDKUnsignedChannelAnnouncement this_ptr_conv;
22586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22587 this_ptr_conv.is_owned = false;
22588 LDKChannelFeatures val_conv;
22589 val_conv.inner = (void*)(val & (~1));
22590 val_conv.is_owned = (val & 1) || (val == 0);
22591 val_conv = ChannelFeatures_clone(&val_conv);
22592 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
22595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22596 LDKUnsignedChannelAnnouncement this_ptr_conv;
22597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22598 this_ptr_conv.is_owned = false;
22599 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22600 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
22604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22605 LDKUnsignedChannelAnnouncement this_ptr_conv;
22606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22607 this_ptr_conv.is_owned = false;
22608 LDKThirtyTwoBytes val_ref;
22609 CHECK((*env)->GetArrayLength(env, val) == 32);
22610 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22611 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
22614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22615 LDKUnsignedChannelAnnouncement this_ptr_conv;
22616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22617 this_ptr_conv.is_owned = false;
22618 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
22622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22623 LDKUnsignedChannelAnnouncement this_ptr_conv;
22624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22625 this_ptr_conv.is_owned = false;
22626 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
22629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22630 LDKUnsignedChannelAnnouncement this_ptr_conv;
22631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22632 this_ptr_conv.is_owned = false;
22633 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22634 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
22638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22639 LDKUnsignedChannelAnnouncement this_ptr_conv;
22640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22641 this_ptr_conv.is_owned = false;
22642 LDKPublicKey val_ref;
22643 CHECK((*env)->GetArrayLength(env, val) == 33);
22644 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22645 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
22648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22649 LDKUnsignedChannelAnnouncement this_ptr_conv;
22650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22651 this_ptr_conv.is_owned = false;
22652 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
22657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22658 LDKUnsignedChannelAnnouncement this_ptr_conv;
22659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22660 this_ptr_conv.is_owned = false;
22661 LDKPublicKey val_ref;
22662 CHECK((*env)->GetArrayLength(env, val) == 33);
22663 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22664 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
22667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22668 LDKUnsignedChannelAnnouncement this_ptr_conv;
22669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22670 this_ptr_conv.is_owned = false;
22671 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22672 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
22676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22677 LDKUnsignedChannelAnnouncement this_ptr_conv;
22678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22679 this_ptr_conv.is_owned = false;
22680 LDKPublicKey val_ref;
22681 CHECK((*env)->GetArrayLength(env, val) == 33);
22682 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22683 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
22686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22687 LDKUnsignedChannelAnnouncement this_ptr_conv;
22688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22689 this_ptr_conv.is_owned = false;
22690 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22691 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
22695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22696 LDKUnsignedChannelAnnouncement this_ptr_conv;
22697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22698 this_ptr_conv.is_owned = false;
22699 LDKPublicKey val_ref;
22700 CHECK((*env)->GetArrayLength(env, val) == 33);
22701 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22702 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
22705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22706 LDKUnsignedChannelAnnouncement orig_conv;
22707 orig_conv.inner = (void*)(orig & (~1));
22708 orig_conv.is_owned = false;
22709 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
22710 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22711 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22712 uint64_t ret_ref = (uint64_t)ret_var.inner;
22713 if (ret_var.is_owned) {
22719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22720 LDKChannelAnnouncement this_obj_conv;
22721 this_obj_conv.inner = (void*)(this_obj & (~1));
22722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22723 ChannelAnnouncement_free(this_obj_conv);
22726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22727 LDKChannelAnnouncement this_ptr_conv;
22728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22729 this_ptr_conv.is_owned = false;
22730 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22731 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
22735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22736 LDKChannelAnnouncement this_ptr_conv;
22737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22738 this_ptr_conv.is_owned = false;
22739 LDKSignature val_ref;
22740 CHECK((*env)->GetArrayLength(env, val) == 64);
22741 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22742 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
22745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22746 LDKChannelAnnouncement this_ptr_conv;
22747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22748 this_ptr_conv.is_owned = false;
22749 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22750 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
22754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22755 LDKChannelAnnouncement this_ptr_conv;
22756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22757 this_ptr_conv.is_owned = false;
22758 LDKSignature val_ref;
22759 CHECK((*env)->GetArrayLength(env, val) == 64);
22760 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22761 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
22764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22765 LDKChannelAnnouncement this_ptr_conv;
22766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22767 this_ptr_conv.is_owned = false;
22768 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22769 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
22773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22774 LDKChannelAnnouncement this_ptr_conv;
22775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22776 this_ptr_conv.is_owned = false;
22777 LDKSignature val_ref;
22778 CHECK((*env)->GetArrayLength(env, val) == 64);
22779 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22780 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
22783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22784 LDKChannelAnnouncement this_ptr_conv;
22785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22786 this_ptr_conv.is_owned = false;
22787 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22788 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
22792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22793 LDKChannelAnnouncement this_ptr_conv;
22794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22795 this_ptr_conv.is_owned = false;
22796 LDKSignature val_ref;
22797 CHECK((*env)->GetArrayLength(env, val) == 64);
22798 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22799 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
22802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22803 LDKChannelAnnouncement this_ptr_conv;
22804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22805 this_ptr_conv.is_owned = false;
22806 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
22807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22809 uint64_t ret_ref = (uint64_t)ret_var.inner;
22810 if (ret_var.is_owned) {
22816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22817 LDKChannelAnnouncement this_ptr_conv;
22818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22819 this_ptr_conv.is_owned = false;
22820 LDKUnsignedChannelAnnouncement val_conv;
22821 val_conv.inner = (void*)(val & (~1));
22822 val_conv.is_owned = (val & 1) || (val == 0);
22823 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
22824 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
22827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, int64_t contents_arg) {
22828 LDKSignature node_signature_1_arg_ref;
22829 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
22830 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
22831 LDKSignature node_signature_2_arg_ref;
22832 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
22833 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
22834 LDKSignature bitcoin_signature_1_arg_ref;
22835 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
22836 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
22837 LDKSignature bitcoin_signature_2_arg_ref;
22838 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
22839 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
22840 LDKUnsignedChannelAnnouncement contents_arg_conv;
22841 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22842 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22843 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
22844 LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
22845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22847 uint64_t ret_ref = (uint64_t)ret_var.inner;
22848 if (ret_var.is_owned) {
22854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22855 LDKChannelAnnouncement orig_conv;
22856 orig_conv.inner = (void*)(orig & (~1));
22857 orig_conv.is_owned = false;
22858 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
22859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22861 uint64_t ret_ref = (uint64_t)ret_var.inner;
22862 if (ret_var.is_owned) {
22868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22869 LDKUnsignedChannelUpdate this_obj_conv;
22870 this_obj_conv.inner = (void*)(this_obj & (~1));
22871 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22872 UnsignedChannelUpdate_free(this_obj_conv);
22875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22876 LDKUnsignedChannelUpdate this_ptr_conv;
22877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22878 this_ptr_conv.is_owned = false;
22879 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22880 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
22884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22885 LDKUnsignedChannelUpdate this_ptr_conv;
22886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22887 this_ptr_conv.is_owned = false;
22888 LDKThirtyTwoBytes val_ref;
22889 CHECK((*env)->GetArrayLength(env, val) == 32);
22890 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22891 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
22894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22895 LDKUnsignedChannelUpdate this_ptr_conv;
22896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22897 this_ptr_conv.is_owned = false;
22898 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
22902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22903 LDKUnsignedChannelUpdate this_ptr_conv;
22904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22905 this_ptr_conv.is_owned = false;
22906 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
22909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22910 LDKUnsignedChannelUpdate this_ptr_conv;
22911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22912 this_ptr_conv.is_owned = false;
22913 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
22917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22918 LDKUnsignedChannelUpdate this_ptr_conv;
22919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22920 this_ptr_conv.is_owned = false;
22921 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
22924 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
22925 LDKUnsignedChannelUpdate this_ptr_conv;
22926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22927 this_ptr_conv.is_owned = false;
22928 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
22932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
22933 LDKUnsignedChannelUpdate this_ptr_conv;
22934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22935 this_ptr_conv.is_owned = false;
22936 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
22939 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22940 LDKUnsignedChannelUpdate this_ptr_conv;
22941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22942 this_ptr_conv.is_owned = false;
22943 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
22947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22948 LDKUnsignedChannelUpdate this_ptr_conv;
22949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22950 this_ptr_conv.is_owned = false;
22951 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
22954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22955 LDKUnsignedChannelUpdate this_ptr_conv;
22956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22957 this_ptr_conv.is_owned = false;
22958 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
22962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22963 LDKUnsignedChannelUpdate this_ptr_conv;
22964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22965 this_ptr_conv.is_owned = false;
22966 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
22969 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22970 LDKUnsignedChannelUpdate this_ptr_conv;
22971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22972 this_ptr_conv.is_owned = false;
22973 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
22977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22978 LDKUnsignedChannelUpdate this_ptr_conv;
22979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22980 this_ptr_conv.is_owned = false;
22981 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
22984 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
22985 LDKUnsignedChannelUpdate this_ptr_conv;
22986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22987 this_ptr_conv.is_owned = false;
22988 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
22992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22993 LDKUnsignedChannelUpdate this_ptr_conv;
22994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22995 this_ptr_conv.is_owned = false;
22996 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
22999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23000 LDKUnsignedChannelUpdate orig_conv;
23001 orig_conv.inner = (void*)(orig & (~1));
23002 orig_conv.is_owned = false;
23003 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
23004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23006 uint64_t ret_ref = (uint64_t)ret_var.inner;
23007 if (ret_var.is_owned) {
23013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23014 LDKChannelUpdate this_obj_conv;
23015 this_obj_conv.inner = (void*)(this_obj & (~1));
23016 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23017 ChannelUpdate_free(this_obj_conv);
23020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23021 LDKChannelUpdate this_ptr_conv;
23022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23023 this_ptr_conv.is_owned = false;
23024 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
23029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23030 LDKChannelUpdate this_ptr_conv;
23031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23032 this_ptr_conv.is_owned = false;
23033 LDKSignature val_ref;
23034 CHECK((*env)->GetArrayLength(env, val) == 64);
23035 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23036 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
23039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
23040 LDKChannelUpdate this_ptr_conv;
23041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23042 this_ptr_conv.is_owned = false;
23043 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
23044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23046 uint64_t ret_ref = (uint64_t)ret_var.inner;
23047 if (ret_var.is_owned) {
23053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23054 LDKChannelUpdate this_ptr_conv;
23055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23056 this_ptr_conv.is_owned = false;
23057 LDKUnsignedChannelUpdate val_conv;
23058 val_conv.inner = (void*)(val & (~1));
23059 val_conv.is_owned = (val & 1) || (val == 0);
23060 val_conv = UnsignedChannelUpdate_clone(&val_conv);
23061 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
23064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
23065 LDKSignature signature_arg_ref;
23066 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23067 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23068 LDKUnsignedChannelUpdate contents_arg_conv;
23069 contents_arg_conv.inner = (void*)(contents_arg & (~1));
23070 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
23071 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
23072 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
23073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23075 uint64_t ret_ref = (uint64_t)ret_var.inner;
23076 if (ret_var.is_owned) {
23082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23083 LDKChannelUpdate orig_conv;
23084 orig_conv.inner = (void*)(orig & (~1));
23085 orig_conv.is_owned = false;
23086 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
23087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23089 uint64_t ret_ref = (uint64_t)ret_var.inner;
23090 if (ret_var.is_owned) {
23096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23097 LDKQueryChannelRange this_obj_conv;
23098 this_obj_conv.inner = (void*)(this_obj & (~1));
23099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23100 QueryChannelRange_free(this_obj_conv);
23103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23104 LDKQueryChannelRange this_ptr_conv;
23105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23106 this_ptr_conv.is_owned = false;
23107 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23108 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
23112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23113 LDKQueryChannelRange this_ptr_conv;
23114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23115 this_ptr_conv.is_owned = false;
23116 LDKThirtyTwoBytes val_ref;
23117 CHECK((*env)->GetArrayLength(env, val) == 32);
23118 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23119 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
23122 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
23123 LDKQueryChannelRange this_ptr_conv;
23124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23125 this_ptr_conv.is_owned = false;
23126 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
23130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23131 LDKQueryChannelRange this_ptr_conv;
23132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23133 this_ptr_conv.is_owned = false;
23134 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
23137 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
23138 LDKQueryChannelRange this_ptr_conv;
23139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23140 this_ptr_conv.is_owned = false;
23141 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
23145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23146 LDKQueryChannelRange this_ptr_conv;
23147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23148 this_ptr_conv.is_owned = false;
23149 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
23152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
23153 LDKThirtyTwoBytes chain_hash_arg_ref;
23154 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23155 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23156 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
23157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23159 uint64_t ret_ref = (uint64_t)ret_var.inner;
23160 if (ret_var.is_owned) {
23166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23167 LDKQueryChannelRange orig_conv;
23168 orig_conv.inner = (void*)(orig & (~1));
23169 orig_conv.is_owned = false;
23170 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
23171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23173 uint64_t ret_ref = (uint64_t)ret_var.inner;
23174 if (ret_var.is_owned) {
23180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23181 LDKReplyChannelRange this_obj_conv;
23182 this_obj_conv.inner = (void*)(this_obj & (~1));
23183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23184 ReplyChannelRange_free(this_obj_conv);
23187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23188 LDKReplyChannelRange this_ptr_conv;
23189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23190 this_ptr_conv.is_owned = false;
23191 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23192 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
23196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23197 LDKReplyChannelRange this_ptr_conv;
23198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23199 this_ptr_conv.is_owned = false;
23200 LDKThirtyTwoBytes val_ref;
23201 CHECK((*env)->GetArrayLength(env, val) == 32);
23202 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23203 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
23206 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
23207 LDKReplyChannelRange this_ptr_conv;
23208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23209 this_ptr_conv.is_owned = false;
23210 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
23214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23215 LDKReplyChannelRange this_ptr_conv;
23216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23217 this_ptr_conv.is_owned = false;
23218 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
23221 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
23222 LDKReplyChannelRange this_ptr_conv;
23223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23224 this_ptr_conv.is_owned = false;
23225 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
23229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23230 LDKReplyChannelRange this_ptr_conv;
23231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23232 this_ptr_conv.is_owned = false;
23233 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
23236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
23237 LDKReplyChannelRange this_ptr_conv;
23238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23239 this_ptr_conv.is_owned = false;
23240 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
23244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23245 LDKReplyChannelRange this_ptr_conv;
23246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23247 this_ptr_conv.is_owned = false;
23248 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
23251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23252 LDKReplyChannelRange this_ptr_conv;
23253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23254 this_ptr_conv.is_owned = false;
23255 LDKCVec_u64Z val_constr;
23256 val_constr.datalen = (*env)->GetArrayLength(env, val);
23257 if (val_constr.datalen > 0)
23258 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23260 val_constr.data = NULL;
23261 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23262 for (size_t g = 0; g < val_constr.datalen; g++) {
23263 int64_t val_conv_6 = val_vals[g];
23264 val_constr.data[g] = val_conv_6;
23266 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23267 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
23270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
23271 LDKThirtyTwoBytes chain_hash_arg_ref;
23272 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23273 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23274 LDKCVec_u64Z short_channel_ids_arg_constr;
23275 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
23276 if (short_channel_ids_arg_constr.datalen > 0)
23277 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23279 short_channel_ids_arg_constr.data = NULL;
23280 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
23281 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
23282 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
23283 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
23285 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
23286 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
23287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23289 uint64_t ret_ref = (uint64_t)ret_var.inner;
23290 if (ret_var.is_owned) {
23296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23297 LDKReplyChannelRange orig_conv;
23298 orig_conv.inner = (void*)(orig & (~1));
23299 orig_conv.is_owned = false;
23300 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
23301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23303 uint64_t ret_ref = (uint64_t)ret_var.inner;
23304 if (ret_var.is_owned) {
23310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23311 LDKQueryShortChannelIds this_obj_conv;
23312 this_obj_conv.inner = (void*)(this_obj & (~1));
23313 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23314 QueryShortChannelIds_free(this_obj_conv);
23317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23318 LDKQueryShortChannelIds this_ptr_conv;
23319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23320 this_ptr_conv.is_owned = false;
23321 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
23326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23327 LDKQueryShortChannelIds this_ptr_conv;
23328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23329 this_ptr_conv.is_owned = false;
23330 LDKThirtyTwoBytes val_ref;
23331 CHECK((*env)->GetArrayLength(env, val) == 32);
23332 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23333 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
23336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23337 LDKQueryShortChannelIds this_ptr_conv;
23338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23339 this_ptr_conv.is_owned = false;
23340 LDKCVec_u64Z val_constr;
23341 val_constr.datalen = (*env)->GetArrayLength(env, val);
23342 if (val_constr.datalen > 0)
23343 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23345 val_constr.data = NULL;
23346 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23347 for (size_t g = 0; g < val_constr.datalen; g++) {
23348 int64_t val_conv_6 = val_vals[g];
23349 val_constr.data[g] = val_conv_6;
23351 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23352 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
23355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
23356 LDKThirtyTwoBytes chain_hash_arg_ref;
23357 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23358 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23359 LDKCVec_u64Z short_channel_ids_arg_constr;
23360 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
23361 if (short_channel_ids_arg_constr.datalen > 0)
23362 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23364 short_channel_ids_arg_constr.data = NULL;
23365 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
23366 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
23367 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
23368 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
23370 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
23371 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
23372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23374 uint64_t ret_ref = (uint64_t)ret_var.inner;
23375 if (ret_var.is_owned) {
23381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23382 LDKQueryShortChannelIds orig_conv;
23383 orig_conv.inner = (void*)(orig & (~1));
23384 orig_conv.is_owned = false;
23385 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
23386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23388 uint64_t ret_ref = (uint64_t)ret_var.inner;
23389 if (ret_var.is_owned) {
23395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23396 LDKReplyShortChannelIdsEnd this_obj_conv;
23397 this_obj_conv.inner = (void*)(this_obj & (~1));
23398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23399 ReplyShortChannelIdsEnd_free(this_obj_conv);
23402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23403 LDKReplyShortChannelIdsEnd this_ptr_conv;
23404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23405 this_ptr_conv.is_owned = false;
23406 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
23411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23412 LDKReplyShortChannelIdsEnd this_ptr_conv;
23413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23414 this_ptr_conv.is_owned = false;
23415 LDKThirtyTwoBytes val_ref;
23416 CHECK((*env)->GetArrayLength(env, val) == 32);
23417 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23418 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
23421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
23422 LDKReplyShortChannelIdsEnd this_ptr_conv;
23423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23424 this_ptr_conv.is_owned = false;
23425 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
23429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23430 LDKReplyShortChannelIdsEnd this_ptr_conv;
23431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23432 this_ptr_conv.is_owned = false;
23433 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
23436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
23437 LDKThirtyTwoBytes chain_hash_arg_ref;
23438 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23439 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23440 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
23441 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23442 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23443 uint64_t ret_ref = (uint64_t)ret_var.inner;
23444 if (ret_var.is_owned) {
23450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23451 LDKReplyShortChannelIdsEnd orig_conv;
23452 orig_conv.inner = (void*)(orig & (~1));
23453 orig_conv.is_owned = false;
23454 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
23455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23457 uint64_t ret_ref = (uint64_t)ret_var.inner;
23458 if (ret_var.is_owned) {
23464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23465 LDKGossipTimestampFilter this_obj_conv;
23466 this_obj_conv.inner = (void*)(this_obj & (~1));
23467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23468 GossipTimestampFilter_free(this_obj_conv);
23471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23472 LDKGossipTimestampFilter this_ptr_conv;
23473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23474 this_ptr_conv.is_owned = false;
23475 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23476 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
23480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23481 LDKGossipTimestampFilter this_ptr_conv;
23482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23483 this_ptr_conv.is_owned = false;
23484 LDKThirtyTwoBytes val_ref;
23485 CHECK((*env)->GetArrayLength(env, val) == 32);
23486 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23487 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
23490 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
23491 LDKGossipTimestampFilter this_ptr_conv;
23492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23493 this_ptr_conv.is_owned = false;
23494 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
23498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23499 LDKGossipTimestampFilter this_ptr_conv;
23500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23501 this_ptr_conv.is_owned = false;
23502 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
23505 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
23506 LDKGossipTimestampFilter this_ptr_conv;
23507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23508 this_ptr_conv.is_owned = false;
23509 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
23513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23514 LDKGossipTimestampFilter this_ptr_conv;
23515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23516 this_ptr_conv.is_owned = false;
23517 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
23520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
23521 LDKThirtyTwoBytes chain_hash_arg_ref;
23522 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23523 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23524 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
23525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23527 uint64_t ret_ref = (uint64_t)ret_var.inner;
23528 if (ret_var.is_owned) {
23534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23535 LDKGossipTimestampFilter orig_conv;
23536 orig_conv.inner = (void*)(orig & (~1));
23537 orig_conv.is_owned = false;
23538 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
23539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23541 uint64_t ret_ref = (uint64_t)ret_var.inner;
23542 if (ret_var.is_owned) {
23548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23549 if ((this_ptr & 1) != 0) return;
23550 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
23551 FREE((void*)this_ptr);
23552 ErrorAction_free(this_ptr_conv);
23555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23556 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
23557 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23558 *ret_copy = ErrorAction_clone(orig_conv);
23559 uint64_t ret_ref = (uint64_t)ret_copy;
23563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
23564 LDKErrorMessage msg_conv;
23565 msg_conv.inner = (void*)(msg & (~1));
23566 msg_conv.is_owned = (msg & 1) || (msg == 0);
23567 msg_conv = ErrorMessage_clone(&msg_conv);
23568 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23569 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
23570 uint64_t ret_ref = (uint64_t)ret_copy;
23574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
23575 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23576 *ret_copy = ErrorAction_ignore_error();
23577 uint64_t ret_ref = (uint64_t)ret_copy;
23581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
23582 LDKLevel a_conv = LDKLevel_from_java(env, a);
23583 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23584 *ret_copy = ErrorAction_ignore_and_log(a_conv);
23585 uint64_t ret_ref = (uint64_t)ret_copy;
23589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
23590 LDKErrorMessage msg_conv;
23591 msg_conv.inner = (void*)(msg & (~1));
23592 msg_conv.is_owned = (msg & 1) || (msg == 0);
23593 msg_conv = ErrorMessage_clone(&msg_conv);
23594 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23595 *ret_copy = ErrorAction_send_error_message(msg_conv);
23596 uint64_t ret_ref = (uint64_t)ret_copy;
23600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23601 LDKLightningError this_obj_conv;
23602 this_obj_conv.inner = (void*)(this_obj & (~1));
23603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23604 LightningError_free(this_obj_conv);
23607 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
23608 LDKLightningError this_ptr_conv;
23609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23610 this_ptr_conv.is_owned = false;
23611 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
23612 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23618 LDKLightningError this_ptr_conv;
23619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23620 this_ptr_conv.is_owned = false;
23621 LDKStr val_conv = java_to_owned_str(env, val);
23622 LightningError_set_err(&this_ptr_conv, val_conv);
23625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
23626 LDKLightningError this_ptr_conv;
23627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23628 this_ptr_conv.is_owned = false;
23629 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
23630 *ret_copy = LightningError_get_action(&this_ptr_conv);
23631 uint64_t ret_ref = (uint64_t)ret_copy;
23635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23636 LDKLightningError this_ptr_conv;
23637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23638 this_ptr_conv.is_owned = false;
23639 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
23640 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
23641 LightningError_set_action(&this_ptr_conv, val_conv);
23644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
23645 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
23646 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
23647 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
23648 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
23649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23651 uint64_t ret_ref = (uint64_t)ret_var.inner;
23652 if (ret_var.is_owned) {
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23659 LDKLightningError orig_conv;
23660 orig_conv.inner = (void*)(orig & (~1));
23661 orig_conv.is_owned = false;
23662 LDKLightningError ret_var = LightningError_clone(&orig_conv);
23663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23665 uint64_t ret_ref = (uint64_t)ret_var.inner;
23666 if (ret_var.is_owned) {
23672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23673 LDKCommitmentUpdate this_obj_conv;
23674 this_obj_conv.inner = (void*)(this_obj & (~1));
23675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23676 CommitmentUpdate_free(this_obj_conv);
23679 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23680 LDKCommitmentUpdate this_ptr_conv;
23681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23682 this_ptr_conv.is_owned = false;
23683 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
23684 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23685 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23686 for (size_t p = 0; p < ret_var.datalen; p++) {
23687 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
23688 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23689 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23690 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
23691 if (ret_conv_15_var.is_owned) {
23692 ret_conv_15_ref |= 1;
23694 ret_arr_ptr[p] = ret_conv_15_ref;
23696 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23697 FREE(ret_var.data);
23701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23702 LDKCommitmentUpdate this_ptr_conv;
23703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23704 this_ptr_conv.is_owned = false;
23705 LDKCVec_UpdateAddHTLCZ val_constr;
23706 val_constr.datalen = (*env)->GetArrayLength(env, val);
23707 if (val_constr.datalen > 0)
23708 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23710 val_constr.data = NULL;
23711 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23712 for (size_t p = 0; p < val_constr.datalen; p++) {
23713 int64_t val_conv_15 = val_vals[p];
23714 LDKUpdateAddHTLC val_conv_15_conv;
23715 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
23716 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
23717 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
23718 val_constr.data[p] = val_conv_15_conv;
23720 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23721 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
23724 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23725 LDKCommitmentUpdate this_ptr_conv;
23726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23727 this_ptr_conv.is_owned = false;
23728 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
23729 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23730 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23731 for (size_t t = 0; t < ret_var.datalen; t++) {
23732 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
23733 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23734 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23735 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
23736 if (ret_conv_19_var.is_owned) {
23737 ret_conv_19_ref |= 1;
23739 ret_arr_ptr[t] = ret_conv_19_ref;
23741 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23742 FREE(ret_var.data);
23746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23747 LDKCommitmentUpdate this_ptr_conv;
23748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23749 this_ptr_conv.is_owned = false;
23750 LDKCVec_UpdateFulfillHTLCZ val_constr;
23751 val_constr.datalen = (*env)->GetArrayLength(env, val);
23752 if (val_constr.datalen > 0)
23753 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23755 val_constr.data = NULL;
23756 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23757 for (size_t t = 0; t < val_constr.datalen; t++) {
23758 int64_t val_conv_19 = val_vals[t];
23759 LDKUpdateFulfillHTLC val_conv_19_conv;
23760 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
23761 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
23762 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
23763 val_constr.data[t] = val_conv_19_conv;
23765 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23766 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
23769 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23770 LDKCommitmentUpdate this_ptr_conv;
23771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23772 this_ptr_conv.is_owned = false;
23773 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
23774 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23775 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23776 for (size_t q = 0; q < ret_var.datalen; q++) {
23777 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
23778 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23779 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23780 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
23781 if (ret_conv_16_var.is_owned) {
23782 ret_conv_16_ref |= 1;
23784 ret_arr_ptr[q] = ret_conv_16_ref;
23786 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23787 FREE(ret_var.data);
23791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23792 LDKCommitmentUpdate this_ptr_conv;
23793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23794 this_ptr_conv.is_owned = false;
23795 LDKCVec_UpdateFailHTLCZ val_constr;
23796 val_constr.datalen = (*env)->GetArrayLength(env, val);
23797 if (val_constr.datalen > 0)
23798 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23800 val_constr.data = NULL;
23801 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23802 for (size_t q = 0; q < val_constr.datalen; q++) {
23803 int64_t val_conv_16 = val_vals[q];
23804 LDKUpdateFailHTLC val_conv_16_conv;
23805 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
23806 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
23807 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
23808 val_constr.data[q] = val_conv_16_conv;
23810 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23811 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
23814 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23815 LDKCommitmentUpdate this_ptr_conv;
23816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23817 this_ptr_conv.is_owned = false;
23818 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
23819 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23820 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23821 for (size_t z = 0; z < ret_var.datalen; z++) {
23822 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
23823 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23824 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23825 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
23826 if (ret_conv_25_var.is_owned) {
23827 ret_conv_25_ref |= 1;
23829 ret_arr_ptr[z] = ret_conv_25_ref;
23831 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23832 FREE(ret_var.data);
23836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23837 LDKCommitmentUpdate this_ptr_conv;
23838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23839 this_ptr_conv.is_owned = false;
23840 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
23841 val_constr.datalen = (*env)->GetArrayLength(env, val);
23842 if (val_constr.datalen > 0)
23843 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23845 val_constr.data = NULL;
23846 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23847 for (size_t z = 0; z < val_constr.datalen; z++) {
23848 int64_t val_conv_25 = val_vals[z];
23849 LDKUpdateFailMalformedHTLC val_conv_25_conv;
23850 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
23851 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
23852 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
23853 val_constr.data[z] = val_conv_25_conv;
23855 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23856 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
23859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
23860 LDKCommitmentUpdate this_ptr_conv;
23861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23862 this_ptr_conv.is_owned = false;
23863 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
23864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23866 uint64_t ret_ref = (uint64_t)ret_var.inner;
23867 if (ret_var.is_owned) {
23873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23874 LDKCommitmentUpdate this_ptr_conv;
23875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23876 this_ptr_conv.is_owned = false;
23877 LDKUpdateFee val_conv;
23878 val_conv.inner = (void*)(val & (~1));
23879 val_conv.is_owned = (val & 1) || (val == 0);
23880 val_conv = UpdateFee_clone(&val_conv);
23881 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
23884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
23885 LDKCommitmentUpdate this_ptr_conv;
23886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23887 this_ptr_conv.is_owned = false;
23888 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
23889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23891 uint64_t ret_ref = (uint64_t)ret_var.inner;
23892 if (ret_var.is_owned) {
23898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23899 LDKCommitmentUpdate this_ptr_conv;
23900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23901 this_ptr_conv.is_owned = false;
23902 LDKCommitmentSigned val_conv;
23903 val_conv.inner = (void*)(val & (~1));
23904 val_conv.is_owned = (val & 1) || (val == 0);
23905 val_conv = CommitmentSigned_clone(&val_conv);
23906 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
23909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv *env, jclass clz, int64_tArray update_add_htlcs_arg, int64_tArray update_fulfill_htlcs_arg, int64_tArray update_fail_htlcs_arg, int64_tArray update_fail_malformed_htlcs_arg, int64_t update_fee_arg, int64_t commitment_signed_arg) {
23910 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
23911 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
23912 if (update_add_htlcs_arg_constr.datalen > 0)
23913 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23915 update_add_htlcs_arg_constr.data = NULL;
23916 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
23917 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
23918 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
23919 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
23920 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
23921 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
23922 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
23923 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
23925 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
23926 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
23927 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
23928 if (update_fulfill_htlcs_arg_constr.datalen > 0)
23929 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23931 update_fulfill_htlcs_arg_constr.data = NULL;
23932 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
23933 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
23934 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
23935 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
23936 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
23937 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
23938 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
23939 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
23941 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
23942 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
23943 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
23944 if (update_fail_htlcs_arg_constr.datalen > 0)
23945 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23947 update_fail_htlcs_arg_constr.data = NULL;
23948 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
23949 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
23950 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
23951 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
23952 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
23953 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
23954 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
23955 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
23957 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
23958 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
23959 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
23960 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
23961 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23963 update_fail_malformed_htlcs_arg_constr.data = NULL;
23964 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
23965 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
23966 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
23967 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
23968 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
23969 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
23970 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
23971 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
23973 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
23974 LDKUpdateFee update_fee_arg_conv;
23975 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
23976 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
23977 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
23978 LDKCommitmentSigned commitment_signed_arg_conv;
23979 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
23980 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
23981 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
23982 LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
23983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23985 uint64_t ret_ref = (uint64_t)ret_var.inner;
23986 if (ret_var.is_owned) {
23992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23993 LDKCommitmentUpdate orig_conv;
23994 orig_conv.inner = (void*)(orig & (~1));
23995 orig_conv.is_owned = false;
23996 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
23997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23999 uint64_t ret_ref = (uint64_t)ret_var.inner;
24000 if (ret_var.is_owned) {
24006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24007 if ((this_ptr & 1) != 0) return;
24008 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
24009 FREE((void*)this_ptr);
24010 ChannelMessageHandler_free(this_ptr_conv);
24013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24014 if ((this_ptr & 1) != 0) return;
24015 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
24016 FREE((void*)this_ptr);
24017 RoutingMessageHandler_free(this_ptr_conv);
24020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
24021 LDKAcceptChannel obj_conv;
24022 obj_conv.inner = (void*)(obj & (~1));
24023 obj_conv.is_owned = false;
24024 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
24025 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24026 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24027 CVec_u8Z_free(ret_var);
24031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24032 LDKu8slice ser_ref;
24033 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24034 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24035 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24036 *ret_conv = AcceptChannel_read(ser_ref);
24037 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24038 return (uint64_t)ret_conv;
24041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24042 LDKAnnouncementSignatures obj_conv;
24043 obj_conv.inner = (void*)(obj & (~1));
24044 obj_conv.is_owned = false;
24045 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
24046 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24047 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24048 CVec_u8Z_free(ret_var);
24052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24053 LDKu8slice ser_ref;
24054 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24055 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24056 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24057 *ret_conv = AnnouncementSignatures_read(ser_ref);
24058 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24059 return (uint64_t)ret_conv;
24062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
24063 LDKChannelReestablish obj_conv;
24064 obj_conv.inner = (void*)(obj & (~1));
24065 obj_conv.is_owned = false;
24066 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
24067 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24068 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24069 CVec_u8Z_free(ret_var);
24073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24074 LDKu8slice ser_ref;
24075 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24076 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24077 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24078 *ret_conv = ChannelReestablish_read(ser_ref);
24079 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24080 return (uint64_t)ret_conv;
24083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24084 LDKClosingSigned obj_conv;
24085 obj_conv.inner = (void*)(obj & (~1));
24086 obj_conv.is_owned = false;
24087 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
24088 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24089 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24090 CVec_u8Z_free(ret_var);
24094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24095 LDKu8slice ser_ref;
24096 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24097 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24098 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24099 *ret_conv = ClosingSigned_read(ser_ref);
24100 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24101 return (uint64_t)ret_conv;
24104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
24105 LDKClosingSignedFeeRange obj_conv;
24106 obj_conv.inner = (void*)(obj & (~1));
24107 obj_conv.is_owned = false;
24108 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
24109 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24110 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24111 CVec_u8Z_free(ret_var);
24115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24116 LDKu8slice ser_ref;
24117 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24118 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24119 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24120 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
24121 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24122 return (uint64_t)ret_conv;
24125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24126 LDKCommitmentSigned obj_conv;
24127 obj_conv.inner = (void*)(obj & (~1));
24128 obj_conv.is_owned = false;
24129 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
24130 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24131 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24132 CVec_u8Z_free(ret_var);
24136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24137 LDKu8slice ser_ref;
24138 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24139 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24140 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24141 *ret_conv = CommitmentSigned_read(ser_ref);
24142 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24143 return (uint64_t)ret_conv;
24146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
24147 LDKFundingCreated obj_conv;
24148 obj_conv.inner = (void*)(obj & (~1));
24149 obj_conv.is_owned = false;
24150 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
24151 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24152 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24153 CVec_u8Z_free(ret_var);
24157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24158 LDKu8slice ser_ref;
24159 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24160 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24161 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24162 *ret_conv = FundingCreated_read(ser_ref);
24163 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24164 return (uint64_t)ret_conv;
24167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24168 LDKFundingSigned obj_conv;
24169 obj_conv.inner = (void*)(obj & (~1));
24170 obj_conv.is_owned = false;
24171 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
24172 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24173 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24174 CVec_u8Z_free(ret_var);
24178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24179 LDKu8slice ser_ref;
24180 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24181 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24182 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24183 *ret_conv = FundingSigned_read(ser_ref);
24184 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24185 return (uint64_t)ret_conv;
24188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
24189 LDKFundingLocked obj_conv;
24190 obj_conv.inner = (void*)(obj & (~1));
24191 obj_conv.is_owned = false;
24192 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
24193 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24194 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24195 CVec_u8Z_free(ret_var);
24199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24200 LDKu8slice ser_ref;
24201 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24202 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24203 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
24204 *ret_conv = FundingLocked_read(ser_ref);
24205 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24206 return (uint64_t)ret_conv;
24209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
24211 obj_conv.inner = (void*)(obj & (~1));
24212 obj_conv.is_owned = false;
24213 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
24214 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24215 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24216 CVec_u8Z_free(ret_var);
24220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24221 LDKu8slice ser_ref;
24222 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24223 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24224 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24225 *ret_conv = Init_read(ser_ref);
24226 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24227 return (uint64_t)ret_conv;
24230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
24231 LDKOpenChannel obj_conv;
24232 obj_conv.inner = (void*)(obj & (~1));
24233 obj_conv.is_owned = false;
24234 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
24235 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24236 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24237 CVec_u8Z_free(ret_var);
24241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24242 LDKu8slice ser_ref;
24243 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24244 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24245 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24246 *ret_conv = OpenChannel_read(ser_ref);
24247 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24248 return (uint64_t)ret_conv;
24251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
24252 LDKRevokeAndACK obj_conv;
24253 obj_conv.inner = (void*)(obj & (~1));
24254 obj_conv.is_owned = false;
24255 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
24256 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24257 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24258 CVec_u8Z_free(ret_var);
24262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24263 LDKu8slice ser_ref;
24264 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24265 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24266 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24267 *ret_conv = RevokeAndACK_read(ser_ref);
24268 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24269 return (uint64_t)ret_conv;
24272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
24273 LDKShutdown obj_conv;
24274 obj_conv.inner = (void*)(obj & (~1));
24275 obj_conv.is_owned = false;
24276 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
24277 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24278 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24279 CVec_u8Z_free(ret_var);
24283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24284 LDKu8slice ser_ref;
24285 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24286 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24287 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24288 *ret_conv = Shutdown_read(ser_ref);
24289 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24290 return (uint64_t)ret_conv;
24293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24294 LDKUpdateFailHTLC obj_conv;
24295 obj_conv.inner = (void*)(obj & (~1));
24296 obj_conv.is_owned = false;
24297 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
24298 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24299 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24300 CVec_u8Z_free(ret_var);
24304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24305 LDKu8slice ser_ref;
24306 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24307 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24308 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24309 *ret_conv = UpdateFailHTLC_read(ser_ref);
24310 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24311 return (uint64_t)ret_conv;
24314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24315 LDKUpdateFailMalformedHTLC obj_conv;
24316 obj_conv.inner = (void*)(obj & (~1));
24317 obj_conv.is_owned = false;
24318 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
24319 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24320 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24321 CVec_u8Z_free(ret_var);
24325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24326 LDKu8slice ser_ref;
24327 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24328 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24329 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24330 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
24331 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24332 return (uint64_t)ret_conv;
24335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
24336 LDKUpdateFee obj_conv;
24337 obj_conv.inner = (void*)(obj & (~1));
24338 obj_conv.is_owned = false;
24339 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
24340 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24341 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24342 CVec_u8Z_free(ret_var);
24346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24347 LDKu8slice ser_ref;
24348 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24349 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24350 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24351 *ret_conv = UpdateFee_read(ser_ref);
24352 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24353 return (uint64_t)ret_conv;
24356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24357 LDKUpdateFulfillHTLC obj_conv;
24358 obj_conv.inner = (void*)(obj & (~1));
24359 obj_conv.is_owned = false;
24360 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
24361 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24362 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24363 CVec_u8Z_free(ret_var);
24367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24368 LDKu8slice ser_ref;
24369 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24370 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24371 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
24372 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
24373 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24374 return (uint64_t)ret_conv;
24377 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24378 LDKUpdateAddHTLC obj_conv;
24379 obj_conv.inner = (void*)(obj & (~1));
24380 obj_conv.is_owned = false;
24381 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
24382 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24383 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24384 CVec_u8Z_free(ret_var);
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24389 LDKu8slice ser_ref;
24390 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24391 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24392 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
24393 *ret_conv = UpdateAddHTLC_read(ser_ref);
24394 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24395 return (uint64_t)ret_conv;
24398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
24400 obj_conv.inner = (void*)(obj & (~1));
24401 obj_conv.is_owned = false;
24402 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
24403 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24404 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24405 CVec_u8Z_free(ret_var);
24409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24410 LDKu8slice ser_ref;
24411 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24412 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24413 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
24414 *ret_conv = Ping_read(ser_ref);
24415 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24416 return (uint64_t)ret_conv;
24419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
24421 obj_conv.inner = (void*)(obj & (~1));
24422 obj_conv.is_owned = false;
24423 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
24424 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24425 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24426 CVec_u8Z_free(ret_var);
24430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24431 LDKu8slice ser_ref;
24432 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24433 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24434 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
24435 *ret_conv = Pong_read(ser_ref);
24436 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24437 return (uint64_t)ret_conv;
24440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
24441 LDKUnsignedChannelAnnouncement obj_conv;
24442 obj_conv.inner = (void*)(obj & (~1));
24443 obj_conv.is_owned = false;
24444 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
24445 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24446 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24447 CVec_u8Z_free(ret_var);
24451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24452 LDKu8slice ser_ref;
24453 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24454 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24455 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
24456 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
24457 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24458 return (uint64_t)ret_conv;
24461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
24462 LDKChannelAnnouncement obj_conv;
24463 obj_conv.inner = (void*)(obj & (~1));
24464 obj_conv.is_owned = false;
24465 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
24466 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24467 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24468 CVec_u8Z_free(ret_var);
24472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24473 LDKu8slice ser_ref;
24474 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24475 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24476 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24477 *ret_conv = ChannelAnnouncement_read(ser_ref);
24478 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24479 return (uint64_t)ret_conv;
24482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
24483 LDKUnsignedChannelUpdate obj_conv;
24484 obj_conv.inner = (void*)(obj & (~1));
24485 obj_conv.is_owned = false;
24486 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
24487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24489 CVec_u8Z_free(ret_var);
24493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24494 LDKu8slice ser_ref;
24495 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24496 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24497 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
24498 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
24499 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24500 return (uint64_t)ret_conv;
24503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
24504 LDKChannelUpdate obj_conv;
24505 obj_conv.inner = (void*)(obj & (~1));
24506 obj_conv.is_owned = false;
24507 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
24508 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24509 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24510 CVec_u8Z_free(ret_var);
24514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24515 LDKu8slice ser_ref;
24516 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24517 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24518 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
24519 *ret_conv = ChannelUpdate_read(ser_ref);
24520 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24521 return (uint64_t)ret_conv;
24524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
24525 LDKErrorMessage obj_conv;
24526 obj_conv.inner = (void*)(obj & (~1));
24527 obj_conv.is_owned = false;
24528 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
24529 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24530 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24531 CVec_u8Z_free(ret_var);
24535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24536 LDKu8slice ser_ref;
24537 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24538 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24539 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
24540 *ret_conv = ErrorMessage_read(ser_ref);
24541 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24542 return (uint64_t)ret_conv;
24545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
24546 LDKUnsignedNodeAnnouncement obj_conv;
24547 obj_conv.inner = (void*)(obj & (~1));
24548 obj_conv.is_owned = false;
24549 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
24550 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24551 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24552 CVec_u8Z_free(ret_var);
24556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24557 LDKu8slice ser_ref;
24558 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24559 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24560 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
24561 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
24562 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24563 return (uint64_t)ret_conv;
24566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
24567 LDKNodeAnnouncement obj_conv;
24568 obj_conv.inner = (void*)(obj & (~1));
24569 obj_conv.is_owned = false;
24570 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
24571 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24572 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24573 CVec_u8Z_free(ret_var);
24577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24578 LDKu8slice ser_ref;
24579 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24580 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24581 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
24582 *ret_conv = NodeAnnouncement_read(ser_ref);
24583 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24584 return (uint64_t)ret_conv;
24587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24588 LDKu8slice ser_ref;
24589 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24590 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24591 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
24592 *ret_conv = QueryShortChannelIds_read(ser_ref);
24593 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24594 return (uint64_t)ret_conv;
24597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
24598 LDKQueryShortChannelIds obj_conv;
24599 obj_conv.inner = (void*)(obj & (~1));
24600 obj_conv.is_owned = false;
24601 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
24602 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24603 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24604 CVec_u8Z_free(ret_var);
24608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
24609 LDKReplyShortChannelIdsEnd obj_conv;
24610 obj_conv.inner = (void*)(obj & (~1));
24611 obj_conv.is_owned = false;
24612 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
24613 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24614 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24615 CVec_u8Z_free(ret_var);
24619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24620 LDKu8slice ser_ref;
24621 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24622 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24623 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
24624 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
24625 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24626 return (uint64_t)ret_conv;
24629 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
24630 LDKQueryChannelRange this_arg_conv;
24631 this_arg_conv.inner = (void*)(this_arg & (~1));
24632 this_arg_conv.is_owned = false;
24633 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
24637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
24638 LDKQueryChannelRange obj_conv;
24639 obj_conv.inner = (void*)(obj & (~1));
24640 obj_conv.is_owned = false;
24641 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
24642 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24643 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24644 CVec_u8Z_free(ret_var);
24648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24649 LDKu8slice ser_ref;
24650 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24651 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24652 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24653 *ret_conv = QueryChannelRange_read(ser_ref);
24654 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24655 return (uint64_t)ret_conv;
24658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24659 LDKu8slice ser_ref;
24660 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24661 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24662 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24663 *ret_conv = ReplyChannelRange_read(ser_ref);
24664 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24665 return (uint64_t)ret_conv;
24668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
24669 LDKReplyChannelRange obj_conv;
24670 obj_conv.inner = (void*)(obj & (~1));
24671 obj_conv.is_owned = false;
24672 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
24673 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24674 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24675 CVec_u8Z_free(ret_var);
24679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
24680 LDKGossipTimestampFilter obj_conv;
24681 obj_conv.inner = (void*)(obj & (~1));
24682 obj_conv.is_owned = false;
24683 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
24684 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24685 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24686 CVec_u8Z_free(ret_var);
24690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24691 LDKu8slice ser_ref;
24692 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24693 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24694 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24695 *ret_conv = GossipTimestampFilter_read(ser_ref);
24696 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24697 return (uint64_t)ret_conv;
24700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24701 if ((this_ptr & 1) != 0) return;
24702 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
24703 FREE((void*)this_ptr);
24704 CustomMessageHandler_free(this_ptr_conv);
24707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24708 LDKIgnoringMessageHandler this_obj_conv;
24709 this_obj_conv.inner = (void*)(this_obj & (~1));
24710 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24711 IgnoringMessageHandler_free(this_obj_conv);
24714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
24715 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
24716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24718 uint64_t ret_ref = (uint64_t)ret_var.inner;
24719 if (ret_var.is_owned) {
24725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
24726 LDKIgnoringMessageHandler this_arg_conv;
24727 this_arg_conv.inner = (void*)(this_arg & (~1));
24728 this_arg_conv.is_owned = false;
24729 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24730 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
24731 return (uint64_t)ret_ret;
24734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24735 LDKIgnoringMessageHandler this_arg_conv;
24736 this_arg_conv.inner = (void*)(this_arg & (~1));
24737 this_arg_conv.is_owned = false;
24738 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24739 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
24740 return (uint64_t)ret_ret;
24743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
24744 LDKIgnoringMessageHandler this_arg_conv;
24745 this_arg_conv.inner = (void*)(this_arg & (~1));
24746 this_arg_conv.is_owned = false;
24747 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
24748 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
24749 return (uint64_t)ret_ret;
24752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24753 LDKIgnoringMessageHandler this_arg_conv;
24754 this_arg_conv.inner = (void*)(this_arg & (~1));
24755 this_arg_conv.is_owned = false;
24756 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
24757 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
24758 return (uint64_t)ret_ret;
24761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24762 LDKErroringMessageHandler this_obj_conv;
24763 this_obj_conv.inner = (void*)(this_obj & (~1));
24764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24765 ErroringMessageHandler_free(this_obj_conv);
24768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
24769 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
24770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24772 uint64_t ret_ref = (uint64_t)ret_var.inner;
24773 if (ret_var.is_owned) {
24779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
24780 LDKErroringMessageHandler this_arg_conv;
24781 this_arg_conv.inner = (void*)(this_arg & (~1));
24782 this_arg_conv.is_owned = false;
24783 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24784 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
24785 return (uint64_t)ret_ret;
24788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24789 LDKErroringMessageHandler this_arg_conv;
24790 this_arg_conv.inner = (void*)(this_arg & (~1));
24791 this_arg_conv.is_owned = false;
24792 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
24793 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
24794 return (uint64_t)ret_ret;
24797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24798 LDKMessageHandler this_obj_conv;
24799 this_obj_conv.inner = (void*)(this_obj & (~1));
24800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24801 MessageHandler_free(this_obj_conv);
24804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
24805 LDKMessageHandler this_ptr_conv;
24806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24807 this_ptr_conv.is_owned = false;
24808 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
24812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24813 LDKMessageHandler this_ptr_conv;
24814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24815 this_ptr_conv.is_owned = false;
24816 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
24817 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
24818 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24819 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
24821 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
24824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
24825 LDKMessageHandler this_ptr_conv;
24826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24827 this_ptr_conv.is_owned = false;
24828 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
24832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24833 LDKMessageHandler this_ptr_conv;
24834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24835 this_ptr_conv.is_owned = false;
24836 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
24837 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
24838 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24839 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
24841 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
24844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg) {
24845 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
24846 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
24847 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24848 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
24850 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
24851 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
24852 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24853 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
24855 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
24856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24858 uint64_t ret_ref = (uint64_t)ret_var.inner;
24859 if (ret_var.is_owned) {
24865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24866 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
24867 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
24868 *ret_ret = SocketDescriptor_clone(orig_conv);
24869 return (uint64_t)ret_ret;
24872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24873 if ((this_ptr & 1) != 0) return;
24874 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
24875 FREE((void*)this_ptr);
24876 SocketDescriptor_free(this_ptr_conv);
24879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24880 LDKPeerHandleError this_obj_conv;
24881 this_obj_conv.inner = (void*)(this_obj & (~1));
24882 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24883 PeerHandleError_free(this_obj_conv);
24886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
24887 LDKPeerHandleError this_ptr_conv;
24888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24889 this_ptr_conv.is_owned = false;
24890 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
24894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24895 LDKPeerHandleError this_ptr_conv;
24896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24897 this_ptr_conv.is_owned = false;
24898 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
24901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
24902 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
24903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24905 uint64_t ret_ref = (uint64_t)ret_var.inner;
24906 if (ret_var.is_owned) {
24912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24913 LDKPeerHandleError orig_conv;
24914 orig_conv.inner = (void*)(orig & (~1));
24915 orig_conv.is_owned = false;
24916 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
24917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24919 uint64_t ret_ref = (uint64_t)ret_var.inner;
24920 if (ret_var.is_owned) {
24926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24927 LDKPeerManager this_obj_conv;
24928 this_obj_conv.inner = (void*)(this_obj & (~1));
24929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24930 PeerManager_free(this_obj_conv);
24933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
24934 LDKMessageHandler message_handler_conv;
24935 message_handler_conv.inner = (void*)(message_handler & (~1));
24936 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
24937 // Warning: we need a move here but no clone is available for LDKMessageHandler
24938 LDKSecretKey our_node_secret_ref;
24939 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
24940 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
24941 unsigned char ephemeral_random_data_arr[32];
24942 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
24943 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
24944 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
24945 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24946 if (logger_conv.free == LDKLogger_JCalls_free) {
24947 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24948 LDKLogger_JCalls_cloned(&logger_conv);
24950 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
24951 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
24952 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24953 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
24955 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
24956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24958 uint64_t ret_ref = (uint64_t)ret_var.inner;
24959 if (ret_var.is_owned) {
24965 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
24966 LDKPeerManager this_arg_conv;
24967 this_arg_conv.inner = (void*)(this_arg & (~1));
24968 this_arg_conv.is_owned = false;
24969 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
24970 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24972 for (size_t i = 0; i < ret_var.datalen; i++) {
24973 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
24974 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
24975 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24977 FREE(ret_var.data);
24981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) {
24982 LDKPeerManager this_arg_conv;
24983 this_arg_conv.inner = (void*)(this_arg & (~1));
24984 this_arg_conv.is_owned = false;
24985 LDKPublicKey their_node_id_ref;
24986 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
24987 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
24988 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24989 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24990 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24991 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24993 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24994 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
24995 return (uint64_t)ret_conv;
24998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24999 LDKPeerManager this_arg_conv;
25000 this_arg_conv.inner = (void*)(this_arg & (~1));
25001 this_arg_conv.is_owned = false;
25002 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
25003 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
25004 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25005 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
25007 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
25008 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
25009 return (uint64_t)ret_conv;
25012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
25013 LDKPeerManager this_arg_conv;
25014 this_arg_conv.inner = (void*)(this_arg & (~1));
25015 this_arg_conv.is_owned = false;
25016 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
25017 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
25018 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
25019 return (uint64_t)ret_conv;
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
25023 LDKPeerManager this_arg_conv;
25024 this_arg_conv.inner = (void*)(this_arg & (~1));
25025 this_arg_conv.is_owned = false;
25026 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
25027 LDKu8slice data_ref;
25028 data_ref.datalen = (*env)->GetArrayLength(env, data);
25029 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
25030 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
25031 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
25032 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
25033 return (uint64_t)ret_conv;
25036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25037 LDKPeerManager this_arg_conv;
25038 this_arg_conv.inner = (void*)(this_arg & (~1));
25039 this_arg_conv.is_owned = false;
25040 PeerManager_process_events(&this_arg_conv);
25043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
25044 LDKPeerManager this_arg_conv;
25045 this_arg_conv.inner = (void*)(this_arg & (~1));
25046 this_arg_conv.is_owned = false;
25047 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
25048 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
25051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
25052 LDKPeerManager this_arg_conv;
25053 this_arg_conv.inner = (void*)(this_arg & (~1));
25054 this_arg_conv.is_owned = false;
25055 LDKPublicKey node_id_ref;
25056 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25057 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25058 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
25061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
25062 LDKPeerManager this_arg_conv;
25063 this_arg_conv.inner = (void*)(this_arg & (~1));
25064 this_arg_conv.is_owned = false;
25065 PeerManager_timer_tick_occurred(&this_arg_conv);
25068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
25069 unsigned char commitment_seed_arr[32];
25070 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
25071 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
25072 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
25073 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25074 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
25078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
25079 LDKCVec_u8Z to_holder_script_ref;
25080 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
25081 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25082 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
25083 LDKCVec_u8Z to_counterparty_script_ref;
25084 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
25085 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25086 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
25087 LDKOutPoint funding_outpoint_conv;
25088 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25089 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25090 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25091 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
25092 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25093 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25094 Transaction_free(ret_var);
25098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
25099 LDKPublicKey per_commitment_point_ref;
25100 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25101 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25102 unsigned char base_secret_arr[32];
25103 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
25104 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
25105 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
25106 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
25107 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
25108 return (uint64_t)ret_conv;
25111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
25112 LDKPublicKey per_commitment_point_ref;
25113 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25114 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25115 LDKPublicKey base_point_ref;
25116 CHECK((*env)->GetArrayLength(env, base_point) == 33);
25117 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
25118 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25119 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
25120 return (uint64_t)ret_conv;
25123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
25124 unsigned char per_commitment_secret_arr[32];
25125 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
25126 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
25127 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
25128 unsigned char countersignatory_revocation_base_secret_arr[32];
25129 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
25130 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
25131 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
25132 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
25133 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
25134 return (uint64_t)ret_conv;
25137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
25138 LDKPublicKey per_commitment_point_ref;
25139 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25140 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25141 LDKPublicKey countersignatory_revocation_base_point_ref;
25142 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
25143 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
25144 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25145 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
25146 return (uint64_t)ret_conv;
25149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25150 LDKTxCreationKeys this_obj_conv;
25151 this_obj_conv.inner = (void*)(this_obj & (~1));
25152 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25153 TxCreationKeys_free(this_obj_conv);
25156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
25157 LDKTxCreationKeys this_ptr_conv;
25158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25159 this_ptr_conv.is_owned = false;
25160 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25161 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
25165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25166 LDKTxCreationKeys this_ptr_conv;
25167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25168 this_ptr_conv.is_owned = false;
25169 LDKPublicKey val_ref;
25170 CHECK((*env)->GetArrayLength(env, val) == 33);
25171 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25172 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
25175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25176 LDKTxCreationKeys this_ptr_conv;
25177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25178 this_ptr_conv.is_owned = false;
25179 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
25184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25185 LDKTxCreationKeys this_ptr_conv;
25186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25187 this_ptr_conv.is_owned = false;
25188 LDKPublicKey val_ref;
25189 CHECK((*env)->GetArrayLength(env, val) == 33);
25190 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25191 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
25194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25195 LDKTxCreationKeys this_ptr_conv;
25196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25197 this_ptr_conv.is_owned = false;
25198 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
25203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25204 LDKTxCreationKeys this_ptr_conv;
25205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25206 this_ptr_conv.is_owned = false;
25207 LDKPublicKey val_ref;
25208 CHECK((*env)->GetArrayLength(env, val) == 33);
25209 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25210 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
25213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25214 LDKTxCreationKeys this_ptr_conv;
25215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25216 this_ptr_conv.is_owned = false;
25217 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
25222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25223 LDKTxCreationKeys this_ptr_conv;
25224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25225 this_ptr_conv.is_owned = false;
25226 LDKPublicKey val_ref;
25227 CHECK((*env)->GetArrayLength(env, val) == 33);
25228 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25229 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
25232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25233 LDKTxCreationKeys this_ptr_conv;
25234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25235 this_ptr_conv.is_owned = false;
25236 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
25241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25242 LDKTxCreationKeys this_ptr_conv;
25243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25244 this_ptr_conv.is_owned = false;
25245 LDKPublicKey val_ref;
25246 CHECK((*env)->GetArrayLength(env, val) == 33);
25247 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25248 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
25251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
25252 LDKPublicKey per_commitment_point_arg_ref;
25253 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
25254 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
25255 LDKPublicKey revocation_key_arg_ref;
25256 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
25257 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
25258 LDKPublicKey broadcaster_htlc_key_arg_ref;
25259 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
25260 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
25261 LDKPublicKey countersignatory_htlc_key_arg_ref;
25262 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
25263 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
25264 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
25265 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
25266 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
25267 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
25268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25270 uint64_t ret_ref = (uint64_t)ret_var.inner;
25271 if (ret_var.is_owned) {
25277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25278 LDKTxCreationKeys orig_conv;
25279 orig_conv.inner = (void*)(orig & (~1));
25280 orig_conv.is_owned = false;
25281 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
25282 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25283 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25284 uint64_t ret_ref = (uint64_t)ret_var.inner;
25285 if (ret_var.is_owned) {
25291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
25292 LDKTxCreationKeys obj_conv;
25293 obj_conv.inner = (void*)(obj & (~1));
25294 obj_conv.is_owned = false;
25295 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
25296 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25297 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25298 CVec_u8Z_free(ret_var);
25302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25303 LDKu8slice ser_ref;
25304 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25305 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25306 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25307 *ret_conv = TxCreationKeys_read(ser_ref);
25308 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25309 return (uint64_t)ret_conv;
25312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25313 LDKChannelPublicKeys this_obj_conv;
25314 this_obj_conv.inner = (void*)(this_obj & (~1));
25315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25316 ChannelPublicKeys_free(this_obj_conv);
25319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25320 LDKChannelPublicKeys this_ptr_conv;
25321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25322 this_ptr_conv.is_owned = false;
25323 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
25328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25329 LDKChannelPublicKeys this_ptr_conv;
25330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25331 this_ptr_conv.is_owned = false;
25332 LDKPublicKey val_ref;
25333 CHECK((*env)->GetArrayLength(env, val) == 33);
25334 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25335 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
25338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25339 LDKChannelPublicKeys this_ptr_conv;
25340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25341 this_ptr_conv.is_owned = false;
25342 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
25347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25348 LDKChannelPublicKeys this_ptr_conv;
25349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25350 this_ptr_conv.is_owned = false;
25351 LDKPublicKey val_ref;
25352 CHECK((*env)->GetArrayLength(env, val) == 33);
25353 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25354 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
25357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
25358 LDKChannelPublicKeys this_ptr_conv;
25359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25360 this_ptr_conv.is_owned = false;
25361 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
25366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25367 LDKChannelPublicKeys this_ptr_conv;
25368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25369 this_ptr_conv.is_owned = false;
25370 LDKPublicKey val_ref;
25371 CHECK((*env)->GetArrayLength(env, val) == 33);
25372 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25373 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
25376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25377 LDKChannelPublicKeys this_ptr_conv;
25378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25379 this_ptr_conv.is_owned = false;
25380 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25381 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
25385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25386 LDKChannelPublicKeys this_ptr_conv;
25387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25388 this_ptr_conv.is_owned = false;
25389 LDKPublicKey val_ref;
25390 CHECK((*env)->GetArrayLength(env, val) == 33);
25391 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25392 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
25395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25396 LDKChannelPublicKeys this_ptr_conv;
25397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25398 this_ptr_conv.is_owned = false;
25399 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25400 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
25404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25405 LDKChannelPublicKeys this_ptr_conv;
25406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25407 this_ptr_conv.is_owned = false;
25408 LDKPublicKey val_ref;
25409 CHECK((*env)->GetArrayLength(env, val) == 33);
25410 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25411 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
25414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
25415 LDKPublicKey funding_pubkey_arg_ref;
25416 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
25417 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
25418 LDKPublicKey revocation_basepoint_arg_ref;
25419 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
25420 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
25421 LDKPublicKey payment_point_arg_ref;
25422 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
25423 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
25424 LDKPublicKey delayed_payment_basepoint_arg_ref;
25425 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
25426 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
25427 LDKPublicKey htlc_basepoint_arg_ref;
25428 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
25429 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
25430 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
25431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25433 uint64_t ret_ref = (uint64_t)ret_var.inner;
25434 if (ret_var.is_owned) {
25440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25441 LDKChannelPublicKeys orig_conv;
25442 orig_conv.inner = (void*)(orig & (~1));
25443 orig_conv.is_owned = false;
25444 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
25445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25447 uint64_t ret_ref = (uint64_t)ret_var.inner;
25448 if (ret_var.is_owned) {
25454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
25455 LDKChannelPublicKeys obj_conv;
25456 obj_conv.inner = (void*)(obj & (~1));
25457 obj_conv.is_owned = false;
25458 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
25459 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25460 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25461 CVec_u8Z_free(ret_var);
25465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25466 LDKu8slice ser_ref;
25467 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25468 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25469 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
25470 *ret_conv = ChannelPublicKeys_read(ser_ref);
25471 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25472 return (uint64_t)ret_conv;
25475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
25476 LDKPublicKey per_commitment_point_ref;
25477 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25478 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25479 LDKPublicKey broadcaster_delayed_payment_base_ref;
25480 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
25481 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
25482 LDKPublicKey broadcaster_htlc_base_ref;
25483 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
25484 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
25485 LDKPublicKey countersignatory_revocation_base_ref;
25486 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
25487 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
25488 LDKPublicKey countersignatory_htlc_base_ref;
25489 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
25490 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
25491 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
25492 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
25493 return (uint64_t)ret_conv;
25496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
25497 LDKPublicKey per_commitment_point_ref;
25498 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25499 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25500 LDKChannelPublicKeys broadcaster_keys_conv;
25501 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
25502 broadcaster_keys_conv.is_owned = false;
25503 LDKChannelPublicKeys countersignatory_keys_conv;
25504 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
25505 countersignatory_keys_conv.is_owned = false;
25506 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
25507 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
25508 return (uint64_t)ret_conv;
25511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
25512 LDKPublicKey revocation_key_ref;
25513 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
25514 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
25515 LDKPublicKey broadcaster_delayed_payment_key_ref;
25516 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
25517 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
25518 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
25519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25521 CVec_u8Z_free(ret_var);
25525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25526 LDKHTLCOutputInCommitment this_obj_conv;
25527 this_obj_conv.inner = (void*)(this_obj & (~1));
25528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25529 HTLCOutputInCommitment_free(this_obj_conv);
25532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
25533 LDKHTLCOutputInCommitment this_ptr_conv;
25534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25535 this_ptr_conv.is_owned = false;
25536 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
25540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25541 LDKHTLCOutputInCommitment this_ptr_conv;
25542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25543 this_ptr_conv.is_owned = false;
25544 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
25547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25548 LDKHTLCOutputInCommitment this_ptr_conv;
25549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25550 this_ptr_conv.is_owned = false;
25551 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
25555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25556 LDKHTLCOutputInCommitment this_ptr_conv;
25557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25558 this_ptr_conv.is_owned = false;
25559 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
25562 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
25563 LDKHTLCOutputInCommitment this_ptr_conv;
25564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25565 this_ptr_conv.is_owned = false;
25566 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
25570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25571 LDKHTLCOutputInCommitment this_ptr_conv;
25572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25573 this_ptr_conv.is_owned = false;
25574 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
25577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25578 LDKHTLCOutputInCommitment this_ptr_conv;
25579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25580 this_ptr_conv.is_owned = false;
25581 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25582 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
25586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25587 LDKHTLCOutputInCommitment this_ptr_conv;
25588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25589 this_ptr_conv.is_owned = false;
25590 LDKThirtyTwoBytes val_ref;
25591 CHECK((*env)->GetArrayLength(env, val) == 32);
25592 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25593 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
25596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
25597 LDKHTLCOutputInCommitment this_ptr_conv;
25598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25599 this_ptr_conv.is_owned = false;
25600 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25601 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
25602 uint64_t ret_ref = (uint64_t)ret_copy;
25606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25607 LDKHTLCOutputInCommitment this_ptr_conv;
25608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25609 this_ptr_conv.is_owned = false;
25610 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
25611 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
25612 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
25615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
25616 LDKThirtyTwoBytes payment_hash_arg_ref;
25617 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
25618 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
25619 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
25620 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
25621 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
25622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25624 uint64_t ret_ref = (uint64_t)ret_var.inner;
25625 if (ret_var.is_owned) {
25631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25632 LDKHTLCOutputInCommitment orig_conv;
25633 orig_conv.inner = (void*)(orig & (~1));
25634 orig_conv.is_owned = false;
25635 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
25636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25638 uint64_t ret_ref = (uint64_t)ret_var.inner;
25639 if (ret_var.is_owned) {
25645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
25646 LDKHTLCOutputInCommitment obj_conv;
25647 obj_conv.inner = (void*)(obj & (~1));
25648 obj_conv.is_owned = false;
25649 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
25650 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25651 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25652 CVec_u8Z_free(ret_var);
25656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25657 LDKu8slice ser_ref;
25658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25660 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
25661 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
25662 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25663 return (uint64_t)ret_conv;
25666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
25667 LDKHTLCOutputInCommitment htlc_conv;
25668 htlc_conv.inner = (void*)(htlc & (~1));
25669 htlc_conv.is_owned = false;
25670 LDKTxCreationKeys keys_conv;
25671 keys_conv.inner = (void*)(keys & (~1));
25672 keys_conv.is_owned = false;
25673 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
25674 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25675 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25676 CVec_u8Z_free(ret_var);
25680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
25681 LDKPublicKey broadcaster_ref;
25682 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
25683 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
25684 LDKPublicKey countersignatory_ref;
25685 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
25686 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
25687 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
25688 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25689 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25690 CVec_u8Z_free(ret_var);
25694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
25695 unsigned char commitment_txid_arr[32];
25696 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
25697 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
25698 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
25699 LDKHTLCOutputInCommitment htlc_conv;
25700 htlc_conv.inner = (void*)(htlc & (~1));
25701 htlc_conv.is_owned = false;
25702 LDKPublicKey broadcaster_delayed_payment_key_ref;
25703 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
25704 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
25705 LDKPublicKey revocation_key_ref;
25706 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
25707 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
25708 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
25709 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25710 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25711 Transaction_free(ret_var);
25715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25716 LDKChannelTransactionParameters this_obj_conv;
25717 this_obj_conv.inner = (void*)(this_obj & (~1));
25718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25719 ChannelTransactionParameters_free(this_obj_conv);
25722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25723 LDKChannelTransactionParameters this_ptr_conv;
25724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25725 this_ptr_conv.is_owned = false;
25726 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
25727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25729 uint64_t ret_ref = (uint64_t)ret_var.inner;
25730 if (ret_var.is_owned) {
25736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25737 LDKChannelTransactionParameters this_ptr_conv;
25738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25739 this_ptr_conv.is_owned = false;
25740 LDKChannelPublicKeys val_conv;
25741 val_conv.inner = (void*)(val & (~1));
25742 val_conv.is_owned = (val & 1) || (val == 0);
25743 val_conv = ChannelPublicKeys_clone(&val_conv);
25744 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
25747 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25748 LDKChannelTransactionParameters this_ptr_conv;
25749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25750 this_ptr_conv.is_owned = false;
25751 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
25755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25756 LDKChannelTransactionParameters this_ptr_conv;
25757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25758 this_ptr_conv.is_owned = false;
25759 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
25762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
25763 LDKChannelTransactionParameters this_ptr_conv;
25764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25765 this_ptr_conv.is_owned = false;
25766 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
25770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25771 LDKChannelTransactionParameters this_ptr_conv;
25772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25773 this_ptr_conv.is_owned = false;
25774 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
25777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
25778 LDKChannelTransactionParameters this_ptr_conv;
25779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25780 this_ptr_conv.is_owned = false;
25781 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
25782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25784 uint64_t ret_ref = (uint64_t)ret_var.inner;
25785 if (ret_var.is_owned) {
25791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25792 LDKChannelTransactionParameters this_ptr_conv;
25793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25794 this_ptr_conv.is_owned = false;
25795 LDKCounterpartyChannelTransactionParameters val_conv;
25796 val_conv.inner = (void*)(val & (~1));
25797 val_conv.is_owned = (val & 1) || (val == 0);
25798 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
25799 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
25802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25803 LDKChannelTransactionParameters this_ptr_conv;
25804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25805 this_ptr_conv.is_owned = false;
25806 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
25807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25809 uint64_t ret_ref = (uint64_t)ret_var.inner;
25810 if (ret_var.is_owned) {
25816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25817 LDKChannelTransactionParameters this_ptr_conv;
25818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25819 this_ptr_conv.is_owned = false;
25820 LDKOutPoint val_conv;
25821 val_conv.inner = (void*)(val & (~1));
25822 val_conv.is_owned = (val & 1) || (val == 0);
25823 val_conv = OutPoint_clone(&val_conv);
25824 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
25827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) {
25828 LDKChannelPublicKeys holder_pubkeys_arg_conv;
25829 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
25830 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
25831 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
25832 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
25833 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
25834 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
25835 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
25836 LDKOutPoint funding_outpoint_arg_conv;
25837 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
25838 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
25839 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
25840 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv);
25841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25843 uint64_t ret_ref = (uint64_t)ret_var.inner;
25844 if (ret_var.is_owned) {
25850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25851 LDKChannelTransactionParameters orig_conv;
25852 orig_conv.inner = (void*)(orig & (~1));
25853 orig_conv.is_owned = false;
25854 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
25855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25857 uint64_t ret_ref = (uint64_t)ret_var.inner;
25858 if (ret_var.is_owned) {
25864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25865 LDKCounterpartyChannelTransactionParameters this_obj_conv;
25866 this_obj_conv.inner = (void*)(this_obj & (~1));
25867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25868 CounterpartyChannelTransactionParameters_free(this_obj_conv);
25871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25872 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25874 this_ptr_conv.is_owned = false;
25875 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
25876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25878 uint64_t ret_ref = (uint64_t)ret_var.inner;
25879 if (ret_var.is_owned) {
25885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25886 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25888 this_ptr_conv.is_owned = false;
25889 LDKChannelPublicKeys val_conv;
25890 val_conv.inner = (void*)(val & (~1));
25891 val_conv.is_owned = (val & 1) || (val == 0);
25892 val_conv = ChannelPublicKeys_clone(&val_conv);
25893 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
25896 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25897 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25899 this_ptr_conv.is_owned = false;
25900 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
25904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25905 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25907 this_ptr_conv.is_owned = false;
25908 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
25911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
25912 LDKChannelPublicKeys pubkeys_arg_conv;
25913 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
25914 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
25915 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
25916 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
25917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25919 uint64_t ret_ref = (uint64_t)ret_var.inner;
25920 if (ret_var.is_owned) {
25926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25927 LDKCounterpartyChannelTransactionParameters orig_conv;
25928 orig_conv.inner = (void*)(orig & (~1));
25929 orig_conv.is_owned = false;
25930 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
25931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25933 uint64_t ret_ref = (uint64_t)ret_var.inner;
25934 if (ret_var.is_owned) {
25940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
25941 LDKChannelTransactionParameters this_arg_conv;
25942 this_arg_conv.inner = (void*)(this_arg & (~1));
25943 this_arg_conv.is_owned = false;
25944 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
25948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25949 LDKChannelTransactionParameters this_arg_conv;
25950 this_arg_conv.inner = (void*)(this_arg & (~1));
25951 this_arg_conv.is_owned = false;
25952 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
25953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25955 uint64_t ret_ref = (uint64_t)ret_var.inner;
25956 if (ret_var.is_owned) {
25962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25963 LDKChannelTransactionParameters this_arg_conv;
25964 this_arg_conv.inner = (void*)(this_arg & (~1));
25965 this_arg_conv.is_owned = false;
25966 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
25967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25969 uint64_t ret_ref = (uint64_t)ret_var.inner;
25970 if (ret_var.is_owned) {
25976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25977 LDKCounterpartyChannelTransactionParameters obj_conv;
25978 obj_conv.inner = (void*)(obj & (~1));
25979 obj_conv.is_owned = false;
25980 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
25981 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25982 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25983 CVec_u8Z_free(ret_var);
25987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25988 LDKu8slice ser_ref;
25989 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25990 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25991 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25992 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
25993 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25994 return (uint64_t)ret_conv;
25997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25998 LDKChannelTransactionParameters obj_conv;
25999 obj_conv.inner = (void*)(obj & (~1));
26000 obj_conv.is_owned = false;
26001 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
26002 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26003 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26004 CVec_u8Z_free(ret_var);
26008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26009 LDKu8slice ser_ref;
26010 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26011 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26012 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26013 *ret_conv = ChannelTransactionParameters_read(ser_ref);
26014 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26015 return (uint64_t)ret_conv;
26018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26019 LDKDirectedChannelTransactionParameters this_obj_conv;
26020 this_obj_conv.inner = (void*)(this_obj & (~1));
26021 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26022 DirectedChannelTransactionParameters_free(this_obj_conv);
26025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26026 LDKDirectedChannelTransactionParameters this_arg_conv;
26027 this_arg_conv.inner = (void*)(this_arg & (~1));
26028 this_arg_conv.is_owned = false;
26029 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
26030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26032 uint64_t ret_ref = (uint64_t)ret_var.inner;
26033 if (ret_var.is_owned) {
26039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26040 LDKDirectedChannelTransactionParameters this_arg_conv;
26041 this_arg_conv.inner = (void*)(this_arg & (~1));
26042 this_arg_conv.is_owned = false;
26043 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
26044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26046 uint64_t ret_ref = (uint64_t)ret_var.inner;
26047 if (ret_var.is_owned) {
26053 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
26054 LDKDirectedChannelTransactionParameters this_arg_conv;
26055 this_arg_conv.inner = (void*)(this_arg & (~1));
26056 this_arg_conv.is_owned = false;
26057 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
26061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
26062 LDKDirectedChannelTransactionParameters this_arg_conv;
26063 this_arg_conv.inner = (void*)(this_arg & (~1));
26064 this_arg_conv.is_owned = false;
26065 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
26069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
26070 LDKDirectedChannelTransactionParameters this_arg_conv;
26071 this_arg_conv.inner = (void*)(this_arg & (~1));
26072 this_arg_conv.is_owned = false;
26073 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
26074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26076 uint64_t ret_ref = (uint64_t)ret_var.inner;
26077 if (ret_var.is_owned) {
26083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26084 LDKHolderCommitmentTransaction this_obj_conv;
26085 this_obj_conv.inner = (void*)(this_obj & (~1));
26086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26087 HolderCommitmentTransaction_free(this_obj_conv);
26090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
26091 LDKHolderCommitmentTransaction this_ptr_conv;
26092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26093 this_ptr_conv.is_owned = false;
26094 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
26095 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
26099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26100 LDKHolderCommitmentTransaction this_ptr_conv;
26101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26102 this_ptr_conv.is_owned = false;
26103 LDKSignature val_ref;
26104 CHECK((*env)->GetArrayLength(env, val) == 64);
26105 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
26106 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
26109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
26110 LDKHolderCommitmentTransaction this_ptr_conv;
26111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26112 this_ptr_conv.is_owned = false;
26113 LDKCVec_SignatureZ val_constr;
26114 val_constr.datalen = (*env)->GetArrayLength(env, val);
26115 if (val_constr.datalen > 0)
26116 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
26118 val_constr.data = NULL;
26119 for (size_t i = 0; i < val_constr.datalen; i++) {
26120 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
26121 LDKSignature val_conv_8_ref;
26122 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
26123 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
26124 val_constr.data[i] = val_conv_8_ref;
26126 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
26129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26130 LDKHolderCommitmentTransaction orig_conv;
26131 orig_conv.inner = (void*)(orig & (~1));
26132 orig_conv.is_owned = false;
26133 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
26134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26136 uint64_t ret_ref = (uint64_t)ret_var.inner;
26137 if (ret_var.is_owned) {
26143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
26144 LDKHolderCommitmentTransaction obj_conv;
26145 obj_conv.inner = (void*)(obj & (~1));
26146 obj_conv.is_owned = false;
26147 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
26148 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26149 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26150 CVec_u8Z_free(ret_var);
26154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26155 LDKu8slice ser_ref;
26156 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26157 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26158 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26159 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
26160 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26161 return (uint64_t)ret_conv;
26164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv *env, jclass clz, int64_t commitment_tx, int8_tArray counterparty_sig, jobjectArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
26165 LDKCommitmentTransaction commitment_tx_conv;
26166 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
26167 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
26168 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
26169 LDKSignature counterparty_sig_ref;
26170 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
26171 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
26172 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
26173 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
26174 if (counterparty_htlc_sigs_constr.datalen > 0)
26175 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
26177 counterparty_htlc_sigs_constr.data = NULL;
26178 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
26179 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
26180 LDKSignature counterparty_htlc_sigs_conv_8_ref;
26181 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
26182 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
26183 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
26185 LDKPublicKey holder_funding_key_ref;
26186 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
26187 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
26188 LDKPublicKey counterparty_funding_key_ref;
26189 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
26190 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
26191 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
26192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26194 uint64_t ret_ref = (uint64_t)ret_var.inner;
26195 if (ret_var.is_owned) {
26201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26202 LDKBuiltCommitmentTransaction this_obj_conv;
26203 this_obj_conv.inner = (void*)(this_obj & (~1));
26204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26205 BuiltCommitmentTransaction_free(this_obj_conv);
26208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
26209 LDKBuiltCommitmentTransaction this_ptr_conv;
26210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26211 this_ptr_conv.is_owned = false;
26212 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
26213 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26214 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26215 Transaction_free(ret_var);
26219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26220 LDKBuiltCommitmentTransaction this_ptr_conv;
26221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26222 this_ptr_conv.is_owned = false;
26223 LDKTransaction val_ref;
26224 val_ref.datalen = (*env)->GetArrayLength(env, val);
26225 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
26226 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26227 val_ref.data_is_owned = true;
26228 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
26231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26232 LDKBuiltCommitmentTransaction this_ptr_conv;
26233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26234 this_ptr_conv.is_owned = false;
26235 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26236 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
26240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26241 LDKBuiltCommitmentTransaction this_ptr_conv;
26242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26243 this_ptr_conv.is_owned = false;
26244 LDKThirtyTwoBytes val_ref;
26245 CHECK((*env)->GetArrayLength(env, val) == 32);
26246 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26247 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
26250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
26251 LDKTransaction transaction_arg_ref;
26252 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
26253 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
26254 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
26255 transaction_arg_ref.data_is_owned = true;
26256 LDKThirtyTwoBytes txid_arg_ref;
26257 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26258 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26259 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
26260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26262 uint64_t ret_ref = (uint64_t)ret_var.inner;
26263 if (ret_var.is_owned) {
26269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26270 LDKBuiltCommitmentTransaction orig_conv;
26271 orig_conv.inner = (void*)(orig & (~1));
26272 orig_conv.is_owned = false;
26273 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
26274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26276 uint64_t ret_ref = (uint64_t)ret_var.inner;
26277 if (ret_var.is_owned) {
26283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
26284 LDKBuiltCommitmentTransaction obj_conv;
26285 obj_conv.inner = (void*)(obj & (~1));
26286 obj_conv.is_owned = false;
26287 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
26288 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26289 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26290 CVec_u8Z_free(ret_var);
26294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26295 LDKu8slice ser_ref;
26296 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26297 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26298 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26299 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
26300 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26301 return (uint64_t)ret_conv;
26304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
26305 LDKBuiltCommitmentTransaction this_arg_conv;
26306 this_arg_conv.inner = (void*)(this_arg & (~1));
26307 this_arg_conv.is_owned = false;
26308 LDKu8slice funding_redeemscript_ref;
26309 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26310 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26311 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
26313 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
26317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
26318 LDKBuiltCommitmentTransaction this_arg_conv;
26319 this_arg_conv.inner = (void*)(this_arg & (~1));
26320 this_arg_conv.is_owned = false;
26321 unsigned char funding_key_arr[32];
26322 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
26323 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
26324 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
26325 LDKu8slice funding_redeemscript_ref;
26326 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26327 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26328 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
26329 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
26330 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
26334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26335 LDKClosingTransaction this_obj_conv;
26336 this_obj_conv.inner = (void*)(this_obj & (~1));
26337 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26338 ClosingTransaction_free(this_obj_conv);
26341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
26342 LDKCVec_u8Z to_holder_script_ref;
26343 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
26344 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
26345 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
26346 LDKCVec_u8Z to_counterparty_script_ref;
26347 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
26348 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
26349 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
26350 LDKOutPoint funding_outpoint_conv;
26351 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
26352 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
26353 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
26354 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
26355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26357 uint64_t ret_ref = (uint64_t)ret_var.inner;
26358 if (ret_var.is_owned) {
26364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
26365 LDKClosingTransaction this_arg_conv;
26366 this_arg_conv.inner = (void*)(this_arg & (~1));
26367 this_arg_conv.is_owned = false;
26368 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
26369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26371 uint64_t ret_ref = (uint64_t)ret_var.inner;
26372 if (ret_var.is_owned) {
26378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
26379 LDKClosingTransaction this_arg_conv;
26380 this_arg_conv.inner = (void*)(this_arg & (~1));
26381 this_arg_conv.is_owned = false;
26382 LDKOutPoint funding_outpoint_conv;
26383 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
26384 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
26385 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
26386 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
26387 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
26388 return (uint64_t)ret_conv;
26391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
26392 LDKClosingTransaction this_arg_conv;
26393 this_arg_conv.inner = (void*)(this_arg & (~1));
26394 this_arg_conv.is_owned = false;
26395 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
26399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
26400 LDKClosingTransaction this_arg_conv;
26401 this_arg_conv.inner = (void*)(this_arg & (~1));
26402 this_arg_conv.is_owned = false;
26403 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
26407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
26408 LDKClosingTransaction this_arg_conv;
26409 this_arg_conv.inner = (void*)(this_arg & (~1));
26410 this_arg_conv.is_owned = false;
26411 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
26412 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26413 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
26418 LDKClosingTransaction this_arg_conv;
26419 this_arg_conv.inner = (void*)(this_arg & (~1));
26420 this_arg_conv.is_owned = false;
26421 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
26422 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26423 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26428 LDKTrustedClosingTransaction this_obj_conv;
26429 this_obj_conv.inner = (void*)(this_obj & (~1));
26430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26431 TrustedClosingTransaction_free(this_obj_conv);
26434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
26435 LDKTrustedClosingTransaction this_arg_conv;
26436 this_arg_conv.inner = (void*)(this_arg & (~1));
26437 this_arg_conv.is_owned = false;
26438 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
26439 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26440 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26441 Transaction_free(ret_var);
26445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
26446 LDKTrustedClosingTransaction this_arg_conv;
26447 this_arg_conv.inner = (void*)(this_arg & (~1));
26448 this_arg_conv.is_owned = false;
26449 LDKu8slice funding_redeemscript_ref;
26450 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26451 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26452 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
26454 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
26458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
26459 LDKTrustedClosingTransaction this_arg_conv;
26460 this_arg_conv.inner = (void*)(this_arg & (~1));
26461 this_arg_conv.is_owned = false;
26462 unsigned char funding_key_arr[32];
26463 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
26464 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
26465 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
26466 LDKu8slice funding_redeemscript_ref;
26467 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26468 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26469 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
26470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
26471 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
26475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26476 LDKCommitmentTransaction this_obj_conv;
26477 this_obj_conv.inner = (void*)(this_obj & (~1));
26478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26479 CommitmentTransaction_free(this_obj_conv);
26482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26483 LDKCommitmentTransaction orig_conv;
26484 orig_conv.inner = (void*)(orig & (~1));
26485 orig_conv.is_owned = false;
26486 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
26487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26489 uint64_t ret_ref = (uint64_t)ret_var.inner;
26490 if (ret_var.is_owned) {
26496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
26497 LDKCommitmentTransaction obj_conv;
26498 obj_conv.inner = (void*)(obj & (~1));
26499 obj_conv.is_owned = false;
26500 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
26501 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26502 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26503 CVec_u8Z_free(ret_var);
26507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26508 LDKu8slice ser_ref;
26509 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26510 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26511 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
26512 *ret_conv = CommitmentTransaction_read(ser_ref);
26513 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26514 return (uint64_t)ret_conv;
26517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
26518 LDKCommitmentTransaction this_arg_conv;
26519 this_arg_conv.inner = (void*)(this_arg & (~1));
26520 this_arg_conv.is_owned = false;
26521 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
26525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
26526 LDKCommitmentTransaction this_arg_conv;
26527 this_arg_conv.inner = (void*)(this_arg & (~1));
26528 this_arg_conv.is_owned = false;
26529 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
26533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
26534 LDKCommitmentTransaction this_arg_conv;
26535 this_arg_conv.inner = (void*)(this_arg & (~1));
26536 this_arg_conv.is_owned = false;
26537 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
26541 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
26542 LDKCommitmentTransaction this_arg_conv;
26543 this_arg_conv.inner = (void*)(this_arg & (~1));
26544 this_arg_conv.is_owned = false;
26545 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
26549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
26550 LDKCommitmentTransaction this_arg_conv;
26551 this_arg_conv.inner = (void*)(this_arg & (~1));
26552 this_arg_conv.is_owned = false;
26553 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
26554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26556 uint64_t ret_ref = (uint64_t)ret_var.inner;
26557 if (ret_var.is_owned) {
26563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
26564 LDKCommitmentTransaction this_arg_conv;
26565 this_arg_conv.inner = (void*)(this_arg & (~1));
26566 this_arg_conv.is_owned = false;
26567 LDKDirectedChannelTransactionParameters channel_parameters_conv;
26568 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
26569 channel_parameters_conv.is_owned = false;
26570 LDKChannelPublicKeys broadcaster_keys_conv;
26571 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
26572 broadcaster_keys_conv.is_owned = false;
26573 LDKChannelPublicKeys countersignatory_keys_conv;
26574 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
26575 countersignatory_keys_conv.is_owned = false;
26576 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
26577 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
26578 return (uint64_t)ret_conv;
26581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26582 LDKTrustedCommitmentTransaction this_obj_conv;
26583 this_obj_conv.inner = (void*)(this_obj & (~1));
26584 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26585 TrustedCommitmentTransaction_free(this_obj_conv);
26588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
26589 LDKTrustedCommitmentTransaction this_arg_conv;
26590 this_arg_conv.inner = (void*)(this_arg & (~1));
26591 this_arg_conv.is_owned = false;
26592 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26593 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
26597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
26598 LDKTrustedCommitmentTransaction this_arg_conv;
26599 this_arg_conv.inner = (void*)(this_arg & (~1));
26600 this_arg_conv.is_owned = false;
26601 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
26602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26604 uint64_t ret_ref = (uint64_t)ret_var.inner;
26605 if (ret_var.is_owned) {
26611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
26612 LDKTrustedCommitmentTransaction this_arg_conv;
26613 this_arg_conv.inner = (void*)(this_arg & (~1));
26614 this_arg_conv.is_owned = false;
26615 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
26616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26618 uint64_t ret_ref = (uint64_t)ret_var.inner;
26619 if (ret_var.is_owned) {
26625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) {
26626 LDKTrustedCommitmentTransaction this_arg_conv;
26627 this_arg_conv.inner = (void*)(this_arg & (~1));
26628 this_arg_conv.is_owned = false;
26629 unsigned char htlc_base_key_arr[32];
26630 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
26631 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
26632 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
26633 LDKDirectedChannelTransactionParameters channel_parameters_conv;
26634 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
26635 channel_parameters_conv.is_owned = false;
26636 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
26637 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
26638 return (uint64_t)ret_conv;
26641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv *env, jclass clz, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
26642 LDKPublicKey broadcaster_payment_basepoint_ref;
26643 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
26644 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
26645 LDKPublicKey countersignatory_payment_basepoint_ref;
26646 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
26647 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
26648 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
26652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26653 LDKInitFeatures a_conv;
26654 a_conv.inner = (void*)(a & (~1));
26655 a_conv.is_owned = false;
26656 LDKInitFeatures b_conv;
26657 b_conv.inner = (void*)(b & (~1));
26658 b_conv.is_owned = false;
26659 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
26663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26664 LDKNodeFeatures a_conv;
26665 a_conv.inner = (void*)(a & (~1));
26666 a_conv.is_owned = false;
26667 LDKNodeFeatures b_conv;
26668 b_conv.inner = (void*)(b & (~1));
26669 b_conv.is_owned = false;
26670 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
26674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26675 LDKChannelFeatures a_conv;
26676 a_conv.inner = (void*)(a & (~1));
26677 a_conv.is_owned = false;
26678 LDKChannelFeatures b_conv;
26679 b_conv.inner = (void*)(b & (~1));
26680 b_conv.is_owned = false;
26681 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
26685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26686 LDKInvoiceFeatures a_conv;
26687 a_conv.inner = (void*)(a & (~1));
26688 a_conv.is_owned = false;
26689 LDKInvoiceFeatures b_conv;
26690 b_conv.inner = (void*)(b & (~1));
26691 b_conv.is_owned = false;
26692 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
26696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26697 LDKInitFeatures orig_conv;
26698 orig_conv.inner = (void*)(orig & (~1));
26699 orig_conv.is_owned = false;
26700 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
26701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26703 uint64_t ret_ref = (uint64_t)ret_var.inner;
26704 if (ret_var.is_owned) {
26710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26711 LDKNodeFeatures orig_conv;
26712 orig_conv.inner = (void*)(orig & (~1));
26713 orig_conv.is_owned = false;
26714 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
26715 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26716 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26717 uint64_t ret_ref = (uint64_t)ret_var.inner;
26718 if (ret_var.is_owned) {
26724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26725 LDKChannelFeatures orig_conv;
26726 orig_conv.inner = (void*)(orig & (~1));
26727 orig_conv.is_owned = false;
26728 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
26729 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26730 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26731 uint64_t ret_ref = (uint64_t)ret_var.inner;
26732 if (ret_var.is_owned) {
26738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26739 LDKInvoiceFeatures orig_conv;
26740 orig_conv.inner = (void*)(orig & (~1));
26741 orig_conv.is_owned = false;
26742 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
26743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26745 uint64_t ret_ref = (uint64_t)ret_var.inner;
26746 if (ret_var.is_owned) {
26752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26753 LDKInitFeatures this_obj_conv;
26754 this_obj_conv.inner = (void*)(this_obj & (~1));
26755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26756 InitFeatures_free(this_obj_conv);
26759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26760 LDKNodeFeatures this_obj_conv;
26761 this_obj_conv.inner = (void*)(this_obj & (~1));
26762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26763 NodeFeatures_free(this_obj_conv);
26766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26767 LDKChannelFeatures this_obj_conv;
26768 this_obj_conv.inner = (void*)(this_obj & (~1));
26769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26770 ChannelFeatures_free(this_obj_conv);
26773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26774 LDKInvoiceFeatures this_obj_conv;
26775 this_obj_conv.inner = (void*)(this_obj & (~1));
26776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26777 InvoiceFeatures_free(this_obj_conv);
26780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
26781 LDKInitFeatures ret_var = InitFeatures_empty();
26782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26784 uint64_t ret_ref = (uint64_t)ret_var.inner;
26785 if (ret_var.is_owned) {
26791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
26792 LDKInitFeatures ret_var = InitFeatures_known();
26793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26795 uint64_t ret_ref = (uint64_t)ret_var.inner;
26796 if (ret_var.is_owned) {
26802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26803 LDKInitFeatures this_arg_conv;
26804 this_arg_conv.inner = (void*)(this_arg & (~1));
26805 this_arg_conv.is_owned = false;
26806 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
26810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
26811 LDKNodeFeatures ret_var = NodeFeatures_empty();
26812 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26813 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26814 uint64_t ret_ref = (uint64_t)ret_var.inner;
26815 if (ret_var.is_owned) {
26821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
26822 LDKNodeFeatures ret_var = NodeFeatures_known();
26823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26825 uint64_t ret_ref = (uint64_t)ret_var.inner;
26826 if (ret_var.is_owned) {
26832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26833 LDKNodeFeatures this_arg_conv;
26834 this_arg_conv.inner = (void*)(this_arg & (~1));
26835 this_arg_conv.is_owned = false;
26836 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
26840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
26841 LDKChannelFeatures ret_var = ChannelFeatures_empty();
26842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26844 uint64_t ret_ref = (uint64_t)ret_var.inner;
26845 if (ret_var.is_owned) {
26851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
26852 LDKChannelFeatures ret_var = ChannelFeatures_known();
26853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26855 uint64_t ret_ref = (uint64_t)ret_var.inner;
26856 if (ret_var.is_owned) {
26862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26863 LDKChannelFeatures this_arg_conv;
26864 this_arg_conv.inner = (void*)(this_arg & (~1));
26865 this_arg_conv.is_owned = false;
26866 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
26870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
26871 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
26872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26874 uint64_t ret_ref = (uint64_t)ret_var.inner;
26875 if (ret_var.is_owned) {
26881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
26882 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
26883 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26884 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26885 uint64_t ret_ref = (uint64_t)ret_var.inner;
26886 if (ret_var.is_owned) {
26892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26893 LDKInvoiceFeatures this_arg_conv;
26894 this_arg_conv.inner = (void*)(this_arg & (~1));
26895 this_arg_conv.is_owned = false;
26896 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
26900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26901 LDKInitFeatures this_arg_conv;
26902 this_arg_conv.inner = (void*)(this_arg & (~1));
26903 this_arg_conv.is_owned = false;
26904 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
26908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26909 LDKNodeFeatures this_arg_conv;
26910 this_arg_conv.inner = (void*)(this_arg & (~1));
26911 this_arg_conv.is_owned = false;
26912 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
26916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26917 LDKInvoiceFeatures this_arg_conv;
26918 this_arg_conv.inner = (void*)(this_arg & (~1));
26919 this_arg_conv.is_owned = false;
26920 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
26924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26925 LDKInitFeatures obj_conv;
26926 obj_conv.inner = (void*)(obj & (~1));
26927 obj_conv.is_owned = false;
26928 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
26929 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26930 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26931 CVec_u8Z_free(ret_var);
26935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26936 LDKNodeFeatures obj_conv;
26937 obj_conv.inner = (void*)(obj & (~1));
26938 obj_conv.is_owned = false;
26939 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
26940 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26941 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26942 CVec_u8Z_free(ret_var);
26946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26947 LDKChannelFeatures obj_conv;
26948 obj_conv.inner = (void*)(obj & (~1));
26949 obj_conv.is_owned = false;
26950 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
26951 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26952 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26953 CVec_u8Z_free(ret_var);
26957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26958 LDKInvoiceFeatures obj_conv;
26959 obj_conv.inner = (void*)(obj & (~1));
26960 obj_conv.is_owned = false;
26961 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
26962 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26963 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26964 CVec_u8Z_free(ret_var);
26968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26969 LDKu8slice ser_ref;
26970 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26971 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26972 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
26973 *ret_conv = InitFeatures_read(ser_ref);
26974 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26975 return (uint64_t)ret_conv;
26978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26979 LDKu8slice ser_ref;
26980 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26981 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26982 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
26983 *ret_conv = NodeFeatures_read(ser_ref);
26984 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26985 return (uint64_t)ret_conv;
26988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26989 LDKu8slice ser_ref;
26990 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26991 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26992 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
26993 *ret_conv = ChannelFeatures_read(ser_ref);
26994 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26995 return (uint64_t)ret_conv;
26998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26999 LDKu8slice ser_ref;
27000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27002 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
27003 *ret_conv = InvoiceFeatures_read(ser_ref);
27004 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27005 return (uint64_t)ret_conv;
27008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27009 LDKShutdownScript this_obj_conv;
27010 this_obj_conv.inner = (void*)(this_obj & (~1));
27011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27012 ShutdownScript_free(this_obj_conv);
27015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27016 LDKShutdownScript orig_conv;
27017 orig_conv.inner = (void*)(orig & (~1));
27018 orig_conv.is_owned = false;
27019 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
27020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27022 uint64_t ret_ref = (uint64_t)ret_var.inner;
27023 if (ret_var.is_owned) {
27029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27030 LDKInvalidShutdownScript this_obj_conv;
27031 this_obj_conv.inner = (void*)(this_obj & (~1));
27032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27033 InvalidShutdownScript_free(this_obj_conv);
27036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
27037 LDKInvalidShutdownScript this_ptr_conv;
27038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27039 this_ptr_conv.is_owned = false;
27040 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
27041 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27042 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27047 LDKInvalidShutdownScript this_ptr_conv;
27048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27049 this_ptr_conv.is_owned = false;
27050 LDKCVec_u8Z val_ref;
27051 val_ref.datalen = (*env)->GetArrayLength(env, val);
27052 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27053 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
27054 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
27057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
27058 LDKCVec_u8Z script_arg_ref;
27059 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
27060 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27061 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
27062 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
27063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27065 uint64_t ret_ref = (uint64_t)ret_var.inner;
27066 if (ret_var.is_owned) {
27072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
27073 LDKShutdownScript obj_conv;
27074 obj_conv.inner = (void*)(obj & (~1));
27075 obj_conv.is_owned = false;
27076 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
27077 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27078 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27079 CVec_u8Z_free(ret_var);
27083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27084 LDKu8slice ser_ref;
27085 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27086 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27087 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
27088 *ret_conv = ShutdownScript_read(ser_ref);
27089 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27090 return (uint64_t)ret_conv;
27093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
27094 unsigned char pubkey_hash_arr[20];
27095 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
27096 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
27097 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
27098 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
27099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27101 uint64_t ret_ref = (uint64_t)ret_var.inner;
27102 if (ret_var.is_owned) {
27108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
27109 unsigned char script_hash_arr[32];
27110 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
27111 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
27112 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
27113 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
27114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27116 uint64_t ret_ref = (uint64_t)ret_var.inner;
27117 if (ret_var.is_owned) {
27123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
27124 LDKu8slice program_ref;
27125 program_ref.datalen = (*env)->GetArrayLength(env, program);
27126 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
27127 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
27128 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
27129 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
27130 return (uint64_t)ret_conv;
27133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27134 LDKShutdownScript this_arg_conv;
27135 this_arg_conv.inner = (void*)(this_arg & (~1));
27136 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27137 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
27138 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
27139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27141 CVec_u8Z_free(ret_var);
27145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
27146 LDKShutdownScript this_arg_conv;
27147 this_arg_conv.inner = (void*)(this_arg & (~1));
27148 this_arg_conv.is_owned = false;
27149 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
27154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
27155 LDKShutdownScript this_arg_conv;
27156 this_arg_conv.inner = (void*)(this_arg & (~1));
27157 this_arg_conv.is_owned = false;
27158 LDKInitFeatures features_conv;
27159 features_conv.inner = (void*)(features & (~1));
27160 features_conv.is_owned = false;
27161 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
27165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27166 if ((this_ptr & 1) != 0) return;
27167 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
27168 FREE((void*)this_ptr);
27169 CustomMessageReader_free(this_ptr_conv);
27172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27173 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
27174 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
27175 *ret_ret = Type_clone(orig_conv);
27176 return (uint64_t)ret_ret;
27179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27180 if ((this_ptr & 1) != 0) return;
27181 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
27182 FREE((void*)this_ptr);
27183 Type_free(this_ptr_conv);
27186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27187 if ((this_ptr & 1) != 0) return;
27188 LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1);
27189 FREE((void*)this_ptr);
27190 Score_free(this_ptr_conv);
27193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27194 LDKNodeId this_obj_conv;
27195 this_obj_conv.inner = (void*)(this_obj & (~1));
27196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27197 NodeId_free(this_obj_conv);
27200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27201 LDKNodeId orig_conv;
27202 orig_conv.inner = (void*)(orig & (~1));
27203 orig_conv.is_owned = false;
27204 LDKNodeId ret_var = NodeId_clone(&orig_conv);
27205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27207 uint64_t ret_ref = (uint64_t)ret_var.inner;
27208 if (ret_var.is_owned) {
27214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
27215 LDKPublicKey pubkey_ref;
27216 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
27217 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
27218 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
27219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27221 uint64_t ret_ref = (uint64_t)ret_var.inner;
27222 if (ret_var.is_owned) {
27228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
27229 LDKNodeId this_arg_conv;
27230 this_arg_conv.inner = (void*)(this_arg & (~1));
27231 this_arg_conv.is_owned = false;
27232 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
27233 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27234 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
27240 o_conv.inner = (void*)(o & (~1));
27241 o_conv.is_owned = false;
27242 int64_t ret_val = NodeId_hash(&o_conv);
27246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
27247 LDKNodeId obj_conv;
27248 obj_conv.inner = (void*)(obj & (~1));
27249 obj_conv.is_owned = false;
27250 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
27251 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27252 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27253 CVec_u8Z_free(ret_var);
27257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27258 LDKu8slice ser_ref;
27259 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27260 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27261 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
27262 *ret_conv = NodeId_read(ser_ref);
27263 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27264 return (uint64_t)ret_conv;
27267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27268 LDKNetworkGraph this_obj_conv;
27269 this_obj_conv.inner = (void*)(this_obj & (~1));
27270 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27271 NetworkGraph_free(this_obj_conv);
27274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27275 LDKNetworkGraph orig_conv;
27276 orig_conv.inner = (void*)(orig & (~1));
27277 orig_conv.is_owned = false;
27278 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
27279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27281 uint64_t ret_ref = (uint64_t)ret_var.inner;
27282 if (ret_var.is_owned) {
27288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27289 LDKReadOnlyNetworkGraph this_obj_conv;
27290 this_obj_conv.inner = (void*)(this_obj & (~1));
27291 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27292 ReadOnlyNetworkGraph_free(this_obj_conv);
27295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27296 if ((this_ptr & 1) != 0) return;
27297 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
27298 FREE((void*)this_ptr);
27299 NetworkUpdate_free(this_ptr_conv);
27302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27303 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
27304 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27305 *ret_copy = NetworkUpdate_clone(orig_conv);
27306 uint64_t ret_ref = (uint64_t)ret_copy;
27310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
27311 LDKChannelUpdate msg_conv;
27312 msg_conv.inner = (void*)(msg & (~1));
27313 msg_conv.is_owned = (msg & 1) || (msg == 0);
27314 msg_conv = ChannelUpdate_clone(&msg_conv);
27315 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27316 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
27317 uint64_t ret_ref = (uint64_t)ret_copy;
27321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
27322 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27323 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
27324 uint64_t ret_ref = (uint64_t)ret_copy;
27328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
27329 LDKPublicKey node_id_ref;
27330 CHECK((*env)->GetArrayLength(env, node_id) == 33);
27331 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27332 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27333 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
27334 uint64_t ret_ref = (uint64_t)ret_copy;
27338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27339 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
27340 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
27341 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27342 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27343 CVec_u8Z_free(ret_var);
27347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27348 LDKNetGraphMsgHandler this_arg_conv;
27349 this_arg_conv.inner = (void*)(this_arg & (~1));
27350 this_arg_conv.is_owned = false;
27351 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
27352 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
27353 return (uint64_t)ret_ret;
27356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27357 LDKNetGraphMsgHandler this_obj_conv;
27358 this_obj_conv.inner = (void*)(this_obj & (~1));
27359 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27360 NetGraphMsgHandler_free(this_obj_conv);
27363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
27364 LDKNetGraphMsgHandler this_ptr_conv;
27365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27366 this_ptr_conv.is_owned = false;
27367 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
27368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27370 uint64_t ret_ref = (uint64_t)ret_var.inner;
27371 if (ret_var.is_owned) {
27377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27378 LDKNetGraphMsgHandler this_ptr_conv;
27379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27380 this_ptr_conv.is_owned = false;
27381 LDKNetworkGraph val_conv;
27382 val_conv.inner = (void*)(val & (~1));
27383 val_conv.is_owned = (val & 1) || (val == 0);
27384 val_conv = NetworkGraph_clone(&val_conv);
27385 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
27388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
27389 LDKNetworkGraph network_graph_conv;
27390 network_graph_conv.inner = (void*)(network_graph & (~1));
27391 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
27392 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
27393 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27394 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27395 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27396 // Manually implement clone for Java trait instances
27397 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27398 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27399 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27402 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27403 if (logger_conv.free == LDKLogger_JCalls_free) {
27404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27405 LDKLogger_JCalls_cloned(&logger_conv);
27407 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
27408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27410 uint64_t ret_ref = (uint64_t)ret_var.inner;
27411 if (ret_var.is_owned) {
27417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
27418 LDKNetGraphMsgHandler this_arg_conv;
27419 this_arg_conv.inner = (void*)(this_arg & (~1));
27420 this_arg_conv.is_owned = false;
27421 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27422 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27423 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27424 // Manually implement clone for Java trait instances
27425 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27427 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27430 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
27433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27434 LDKNetGraphMsgHandler this_arg_conv;
27435 this_arg_conv.inner = (void*)(this_arg & (~1));
27436 this_arg_conv.is_owned = false;
27437 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27438 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
27439 return (uint64_t)ret_ret;
27442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27443 LDKNetGraphMsgHandler this_arg_conv;
27444 this_arg_conv.inner = (void*)(this_arg & (~1));
27445 this_arg_conv.is_owned = false;
27446 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27447 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
27448 return (uint64_t)ret_ret;
27451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27452 LDKDirectionalChannelInfo this_obj_conv;
27453 this_obj_conv.inner = (void*)(this_obj & (~1));
27454 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27455 DirectionalChannelInfo_free(this_obj_conv);
27458 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27459 LDKDirectionalChannelInfo this_ptr_conv;
27460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27461 this_ptr_conv.is_owned = false;
27462 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
27466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27467 LDKDirectionalChannelInfo this_ptr_conv;
27468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27469 this_ptr_conv.is_owned = false;
27470 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
27473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
27474 LDKDirectionalChannelInfo this_ptr_conv;
27475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27476 this_ptr_conv.is_owned = false;
27477 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
27481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27482 LDKDirectionalChannelInfo this_ptr_conv;
27483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27484 this_ptr_conv.is_owned = false;
27485 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
27488 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27489 LDKDirectionalChannelInfo this_ptr_conv;
27490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27491 this_ptr_conv.is_owned = false;
27492 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
27496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27497 LDKDirectionalChannelInfo this_ptr_conv;
27498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27499 this_ptr_conv.is_owned = false;
27500 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27504 LDKDirectionalChannelInfo this_ptr_conv;
27505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27506 this_ptr_conv.is_owned = false;
27507 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
27511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27512 LDKDirectionalChannelInfo this_ptr_conv;
27513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27514 this_ptr_conv.is_owned = false;
27515 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
27518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27519 LDKDirectionalChannelInfo this_ptr_conv;
27520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27521 this_ptr_conv.is_owned = false;
27522 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27523 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
27524 uint64_t ret_ref = (uint64_t)ret_copy;
27528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27529 LDKDirectionalChannelInfo this_ptr_conv;
27530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27531 this_ptr_conv.is_owned = false;
27532 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27533 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27534 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
27537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27538 LDKDirectionalChannelInfo this_ptr_conv;
27539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27540 this_ptr_conv.is_owned = false;
27541 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
27542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27544 uint64_t ret_ref = (uint64_t)ret_var.inner;
27545 if (ret_var.is_owned) {
27551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27552 LDKDirectionalChannelInfo this_ptr_conv;
27553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27554 this_ptr_conv.is_owned = false;
27555 LDKRoutingFees val_conv;
27556 val_conv.inner = (void*)(val & (~1));
27557 val_conv.is_owned = (val & 1) || (val == 0);
27558 val_conv = RoutingFees_clone(&val_conv);
27559 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
27562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27563 LDKDirectionalChannelInfo this_ptr_conv;
27564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27565 this_ptr_conv.is_owned = false;
27566 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
27567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27569 uint64_t ret_ref = (uint64_t)ret_var.inner;
27570 if (ret_var.is_owned) {
27576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27577 LDKDirectionalChannelInfo this_ptr_conv;
27578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27579 this_ptr_conv.is_owned = false;
27580 LDKChannelUpdate val_conv;
27581 val_conv.inner = (void*)(val & (~1));
27582 val_conv.is_owned = (val & 1) || (val == 0);
27583 val_conv = ChannelUpdate_clone(&val_conv);
27584 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
27587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
27588 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
27589 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
27590 LDKRoutingFees fees_arg_conv;
27591 fees_arg_conv.inner = (void*)(fees_arg & (~1));
27592 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
27593 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
27594 LDKChannelUpdate last_update_message_arg_conv;
27595 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
27596 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
27597 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
27598 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
27599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27601 uint64_t ret_ref = (uint64_t)ret_var.inner;
27602 if (ret_var.is_owned) {
27608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27609 LDKDirectionalChannelInfo orig_conv;
27610 orig_conv.inner = (void*)(orig & (~1));
27611 orig_conv.is_owned = false;
27612 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
27613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27615 uint64_t ret_ref = (uint64_t)ret_var.inner;
27616 if (ret_var.is_owned) {
27622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27623 LDKDirectionalChannelInfo obj_conv;
27624 obj_conv.inner = (void*)(obj & (~1));
27625 obj_conv.is_owned = false;
27626 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
27627 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27628 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27629 CVec_u8Z_free(ret_var);
27633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27634 LDKu8slice ser_ref;
27635 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27636 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27637 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
27638 *ret_conv = DirectionalChannelInfo_read(ser_ref);
27639 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27640 return (uint64_t)ret_conv;
27643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27644 LDKChannelInfo this_obj_conv;
27645 this_obj_conv.inner = (void*)(this_obj & (~1));
27646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27647 ChannelInfo_free(this_obj_conv);
27650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27651 LDKChannelInfo this_ptr_conv;
27652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27653 this_ptr_conv.is_owned = false;
27654 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
27655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27657 uint64_t ret_ref = (uint64_t)ret_var.inner;
27658 if (ret_var.is_owned) {
27664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27665 LDKChannelInfo this_ptr_conv;
27666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27667 this_ptr_conv.is_owned = false;
27668 LDKChannelFeatures val_conv;
27669 val_conv.inner = (void*)(val & (~1));
27670 val_conv.is_owned = (val & 1) || (val == 0);
27671 val_conv = ChannelFeatures_clone(&val_conv);
27672 ChannelInfo_set_features(&this_ptr_conv, val_conv);
27675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27676 LDKChannelInfo this_ptr_conv;
27677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27678 this_ptr_conv.is_owned = false;
27679 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
27680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27682 uint64_t ret_ref = (uint64_t)ret_var.inner;
27683 if (ret_var.is_owned) {
27689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27690 LDKChannelInfo this_ptr_conv;
27691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27692 this_ptr_conv.is_owned = false;
27693 LDKNodeId val_conv;
27694 val_conv.inner = (void*)(val & (~1));
27695 val_conv.is_owned = (val & 1) || (val == 0);
27696 val_conv = NodeId_clone(&val_conv);
27697 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
27700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27701 LDKChannelInfo this_ptr_conv;
27702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27703 this_ptr_conv.is_owned = false;
27704 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
27705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27707 uint64_t ret_ref = (uint64_t)ret_var.inner;
27708 if (ret_var.is_owned) {
27714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27715 LDKChannelInfo this_ptr_conv;
27716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27717 this_ptr_conv.is_owned = false;
27718 LDKDirectionalChannelInfo val_conv;
27719 val_conv.inner = (void*)(val & (~1));
27720 val_conv.is_owned = (val & 1) || (val == 0);
27721 val_conv = DirectionalChannelInfo_clone(&val_conv);
27722 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
27725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27726 LDKChannelInfo this_ptr_conv;
27727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27728 this_ptr_conv.is_owned = false;
27729 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
27730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27732 uint64_t ret_ref = (uint64_t)ret_var.inner;
27733 if (ret_var.is_owned) {
27739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27740 LDKChannelInfo this_ptr_conv;
27741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27742 this_ptr_conv.is_owned = false;
27743 LDKNodeId val_conv;
27744 val_conv.inner = (void*)(val & (~1));
27745 val_conv.is_owned = (val & 1) || (val == 0);
27746 val_conv = NodeId_clone(&val_conv);
27747 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
27750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27751 LDKChannelInfo this_ptr_conv;
27752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27753 this_ptr_conv.is_owned = false;
27754 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
27755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27757 uint64_t ret_ref = (uint64_t)ret_var.inner;
27758 if (ret_var.is_owned) {
27764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27765 LDKChannelInfo this_ptr_conv;
27766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27767 this_ptr_conv.is_owned = false;
27768 LDKDirectionalChannelInfo val_conv;
27769 val_conv.inner = (void*)(val & (~1));
27770 val_conv.is_owned = (val & 1) || (val == 0);
27771 val_conv = DirectionalChannelInfo_clone(&val_conv);
27772 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
27775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
27776 LDKChannelInfo this_ptr_conv;
27777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27778 this_ptr_conv.is_owned = false;
27779 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27780 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
27781 uint64_t ret_ref = (uint64_t)ret_copy;
27785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27786 LDKChannelInfo this_ptr_conv;
27787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27788 this_ptr_conv.is_owned = false;
27789 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27790 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27791 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
27794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27795 LDKChannelInfo this_ptr_conv;
27796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27797 this_ptr_conv.is_owned = false;
27798 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
27799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27801 uint64_t ret_ref = (uint64_t)ret_var.inner;
27802 if (ret_var.is_owned) {
27808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27809 LDKChannelInfo this_ptr_conv;
27810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27811 this_ptr_conv.is_owned = false;
27812 LDKChannelAnnouncement val_conv;
27813 val_conv.inner = (void*)(val & (~1));
27814 val_conv.is_owned = (val & 1) || (val == 0);
27815 val_conv = ChannelAnnouncement_clone(&val_conv);
27816 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
27819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t node_one_arg, int64_t one_to_two_arg, int64_t node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
27820 LDKChannelFeatures features_arg_conv;
27821 features_arg_conv.inner = (void*)(features_arg & (~1));
27822 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27823 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
27824 LDKNodeId node_one_arg_conv;
27825 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
27826 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
27827 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
27828 LDKDirectionalChannelInfo one_to_two_arg_conv;
27829 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
27830 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
27831 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
27832 LDKNodeId node_two_arg_conv;
27833 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
27834 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
27835 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
27836 LDKDirectionalChannelInfo two_to_one_arg_conv;
27837 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
27838 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
27839 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
27840 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
27841 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
27842 LDKChannelAnnouncement announcement_message_arg_conv;
27843 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27844 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27845 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
27846 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
27847 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27848 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27849 uint64_t ret_ref = (uint64_t)ret_var.inner;
27850 if (ret_var.is_owned) {
27856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27857 LDKChannelInfo orig_conv;
27858 orig_conv.inner = (void*)(orig & (~1));
27859 orig_conv.is_owned = false;
27860 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
27861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27863 uint64_t ret_ref = (uint64_t)ret_var.inner;
27864 if (ret_var.is_owned) {
27870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27871 LDKChannelInfo obj_conv;
27872 obj_conv.inner = (void*)(obj & (~1));
27873 obj_conv.is_owned = false;
27874 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
27875 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27876 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27877 CVec_u8Z_free(ret_var);
27881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27882 LDKu8slice ser_ref;
27883 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27884 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27885 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
27886 *ret_conv = ChannelInfo_read(ser_ref);
27887 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27888 return (uint64_t)ret_conv;
27891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27892 LDKRoutingFees this_obj_conv;
27893 this_obj_conv.inner = (void*)(this_obj & (~1));
27894 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27895 RoutingFees_free(this_obj_conv);
27898 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27899 LDKRoutingFees this_ptr_conv;
27900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27901 this_ptr_conv.is_owned = false;
27902 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
27906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27907 LDKRoutingFees this_ptr_conv;
27908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27909 this_ptr_conv.is_owned = false;
27910 RoutingFees_set_base_msat(&this_ptr_conv, val);
27913 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27914 LDKRoutingFees this_ptr_conv;
27915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27916 this_ptr_conv.is_owned = false;
27917 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
27921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27922 LDKRoutingFees this_ptr_conv;
27923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27924 this_ptr_conv.is_owned = false;
27925 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
27928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
27929 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
27930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27932 uint64_t ret_ref = (uint64_t)ret_var.inner;
27933 if (ret_var.is_owned) {
27939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27940 LDKRoutingFees a_conv;
27941 a_conv.inner = (void*)(a & (~1));
27942 a_conv.is_owned = false;
27943 LDKRoutingFees b_conv;
27944 b_conv.inner = (void*)(b & (~1));
27945 b_conv.is_owned = false;
27946 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
27950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27951 LDKRoutingFees orig_conv;
27952 orig_conv.inner = (void*)(orig & (~1));
27953 orig_conv.is_owned = false;
27954 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
27955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27957 uint64_t ret_ref = (uint64_t)ret_var.inner;
27958 if (ret_var.is_owned) {
27964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
27965 LDKRoutingFees o_conv;
27966 o_conv.inner = (void*)(o & (~1));
27967 o_conv.is_owned = false;
27968 int64_t ret_val = RoutingFees_hash(&o_conv);
27972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
27973 LDKRoutingFees obj_conv;
27974 obj_conv.inner = (void*)(obj & (~1));
27975 obj_conv.is_owned = false;
27976 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
27977 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27978 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27979 CVec_u8Z_free(ret_var);
27983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27984 LDKu8slice ser_ref;
27985 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27986 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27987 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
27988 *ret_conv = RoutingFees_read(ser_ref);
27989 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27990 return (uint64_t)ret_conv;
27993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27994 LDKNodeAnnouncementInfo this_obj_conv;
27995 this_obj_conv.inner = (void*)(this_obj & (~1));
27996 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27997 NodeAnnouncementInfo_free(this_obj_conv);
28000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28001 LDKNodeAnnouncementInfo this_ptr_conv;
28002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28003 this_ptr_conv.is_owned = false;
28004 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
28005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28007 uint64_t ret_ref = (uint64_t)ret_var.inner;
28008 if (ret_var.is_owned) {
28014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28015 LDKNodeAnnouncementInfo this_ptr_conv;
28016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28017 this_ptr_conv.is_owned = false;
28018 LDKNodeFeatures val_conv;
28019 val_conv.inner = (void*)(val & (~1));
28020 val_conv.is_owned = (val & 1) || (val == 0);
28021 val_conv = NodeFeatures_clone(&val_conv);
28022 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
28025 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
28026 LDKNodeAnnouncementInfo this_ptr_conv;
28027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28028 this_ptr_conv.is_owned = false;
28029 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
28033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28034 LDKNodeAnnouncementInfo this_ptr_conv;
28035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28036 this_ptr_conv.is_owned = false;
28037 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
28040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
28041 LDKNodeAnnouncementInfo this_ptr_conv;
28042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28043 this_ptr_conv.is_owned = false;
28044 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
28045 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
28049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28050 LDKNodeAnnouncementInfo this_ptr_conv;
28051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28052 this_ptr_conv.is_owned = false;
28053 LDKThreeBytes val_ref;
28054 CHECK((*env)->GetArrayLength(env, val) == 3);
28055 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
28056 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
28059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28060 LDKNodeAnnouncementInfo this_ptr_conv;
28061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28062 this_ptr_conv.is_owned = false;
28063 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28064 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
28068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28069 LDKNodeAnnouncementInfo this_ptr_conv;
28070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28071 this_ptr_conv.is_owned = false;
28072 LDKThirtyTwoBytes val_ref;
28073 CHECK((*env)->GetArrayLength(env, val) == 32);
28074 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28075 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
28078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28079 LDKNodeAnnouncementInfo this_ptr_conv;
28080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28081 this_ptr_conv.is_owned = false;
28082 LDKCVec_NetAddressZ val_constr;
28083 val_constr.datalen = (*env)->GetArrayLength(env, val);
28084 if (val_constr.datalen > 0)
28085 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28087 val_constr.data = NULL;
28088 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28089 for (size_t m = 0; m < val_constr.datalen; m++) {
28090 int64_t val_conv_12 = val_vals[m];
28091 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
28092 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
28093 val_constr.data[m] = val_conv_12_conv;
28095 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28096 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
28099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
28100 LDKNodeAnnouncementInfo this_ptr_conv;
28101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28102 this_ptr_conv.is_owned = false;
28103 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
28104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28106 uint64_t ret_ref = (uint64_t)ret_var.inner;
28107 if (ret_var.is_owned) {
28113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28114 LDKNodeAnnouncementInfo this_ptr_conv;
28115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28116 this_ptr_conv.is_owned = false;
28117 LDKNodeAnnouncement val_conv;
28118 val_conv.inner = (void*)(val & (~1));
28119 val_conv.is_owned = (val & 1) || (val == 0);
28120 val_conv = NodeAnnouncement_clone(&val_conv);
28121 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
28124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
28125 LDKNodeFeatures features_arg_conv;
28126 features_arg_conv.inner = (void*)(features_arg & (~1));
28127 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28128 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
28129 LDKThreeBytes rgb_arg_ref;
28130 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
28131 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
28132 LDKThirtyTwoBytes alias_arg_ref;
28133 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
28134 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
28135 LDKCVec_NetAddressZ addresses_arg_constr;
28136 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
28137 if (addresses_arg_constr.datalen > 0)
28138 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28140 addresses_arg_constr.data = NULL;
28141 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
28142 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
28143 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
28144 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
28145 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
28147 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
28148 LDKNodeAnnouncement announcement_message_arg_conv;
28149 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
28150 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
28151 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
28152 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
28153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28155 uint64_t ret_ref = (uint64_t)ret_var.inner;
28156 if (ret_var.is_owned) {
28162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28163 LDKNodeAnnouncementInfo orig_conv;
28164 orig_conv.inner = (void*)(orig & (~1));
28165 orig_conv.is_owned = false;
28166 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
28167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28169 uint64_t ret_ref = (uint64_t)ret_var.inner;
28170 if (ret_var.is_owned) {
28176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28177 LDKNodeAnnouncementInfo obj_conv;
28178 obj_conv.inner = (void*)(obj & (~1));
28179 obj_conv.is_owned = false;
28180 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
28181 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28182 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28183 CVec_u8Z_free(ret_var);
28187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28188 LDKu8slice ser_ref;
28189 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28190 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28191 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28192 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
28193 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28194 return (uint64_t)ret_conv;
28197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28198 LDKNodeInfo this_obj_conv;
28199 this_obj_conv.inner = (void*)(this_obj & (~1));
28200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28201 NodeInfo_free(this_obj_conv);
28204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28205 LDKNodeInfo this_ptr_conv;
28206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28207 this_ptr_conv.is_owned = false;
28208 LDKCVec_u64Z val_constr;
28209 val_constr.datalen = (*env)->GetArrayLength(env, val);
28210 if (val_constr.datalen > 0)
28211 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28213 val_constr.data = NULL;
28214 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28215 for (size_t g = 0; g < val_constr.datalen; g++) {
28216 int64_t val_conv_6 = val_vals[g];
28217 val_constr.data[g] = val_conv_6;
28219 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28220 NodeInfo_set_channels(&this_ptr_conv, val_constr);
28223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
28224 LDKNodeInfo this_ptr_conv;
28225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28226 this_ptr_conv.is_owned = false;
28227 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
28228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28230 uint64_t ret_ref = (uint64_t)ret_var.inner;
28231 if (ret_var.is_owned) {
28237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28238 LDKNodeInfo this_ptr_conv;
28239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28240 this_ptr_conv.is_owned = false;
28241 LDKRoutingFees val_conv;
28242 val_conv.inner = (void*)(val & (~1));
28243 val_conv.is_owned = (val & 1) || (val == 0);
28244 val_conv = RoutingFees_clone(&val_conv);
28245 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
28248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28249 LDKNodeInfo this_ptr_conv;
28250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28251 this_ptr_conv.is_owned = false;
28252 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
28253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28255 uint64_t ret_ref = (uint64_t)ret_var.inner;
28256 if (ret_var.is_owned) {
28262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28263 LDKNodeInfo this_ptr_conv;
28264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28265 this_ptr_conv.is_owned = false;
28266 LDKNodeAnnouncementInfo val_conv;
28267 val_conv.inner = (void*)(val & (~1));
28268 val_conv.is_owned = (val & 1) || (val == 0);
28269 val_conv = NodeAnnouncementInfo_clone(&val_conv);
28270 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
28273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) {
28274 LDKCVec_u64Z channels_arg_constr;
28275 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28276 if (channels_arg_constr.datalen > 0)
28277 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28279 channels_arg_constr.data = NULL;
28280 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28281 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
28282 int64_t channels_arg_conv_6 = channels_arg_vals[g];
28283 channels_arg_constr.data[g] = channels_arg_conv_6;
28285 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28286 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
28287 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
28288 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
28289 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
28290 LDKNodeAnnouncementInfo announcement_info_arg_conv;
28291 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
28292 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
28293 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
28294 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
28295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28297 uint64_t ret_ref = (uint64_t)ret_var.inner;
28298 if (ret_var.is_owned) {
28304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28305 LDKNodeInfo orig_conv;
28306 orig_conv.inner = (void*)(orig & (~1));
28307 orig_conv.is_owned = false;
28308 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
28309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28311 uint64_t ret_ref = (uint64_t)ret_var.inner;
28312 if (ret_var.is_owned) {
28318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28319 LDKNodeInfo obj_conv;
28320 obj_conv.inner = (void*)(obj & (~1));
28321 obj_conv.is_owned = false;
28322 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
28323 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28324 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28325 CVec_u8Z_free(ret_var);
28329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28330 LDKu8slice ser_ref;
28331 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28332 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28333 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
28334 *ret_conv = NodeInfo_read(ser_ref);
28335 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28336 return (uint64_t)ret_conv;
28339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
28340 LDKNetworkGraph obj_conv;
28341 obj_conv.inner = (void*)(obj & (~1));
28342 obj_conv.is_owned = false;
28343 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
28344 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28345 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28346 CVec_u8Z_free(ret_var);
28350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28351 LDKu8slice ser_ref;
28352 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28353 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28354 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
28355 *ret_conv = NetworkGraph_read(ser_ref);
28356 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28357 return (uint64_t)ret_conv;
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
28361 LDKThirtyTwoBytes genesis_hash_ref;
28362 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
28363 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
28364 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
28365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28367 uint64_t ret_ref = (uint64_t)ret_var.inner;
28368 if (ret_var.is_owned) {
28374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
28375 LDKNetworkGraph this_arg_conv;
28376 this_arg_conv.inner = (void*)(this_arg & (~1));
28377 this_arg_conv.is_owned = false;
28378 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
28379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28381 uint64_t ret_ref = (uint64_t)ret_var.inner;
28382 if (ret_var.is_owned) {
28388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28389 LDKNetworkGraph this_arg_conv;
28390 this_arg_conv.inner = (void*)(this_arg & (~1));
28391 this_arg_conv.is_owned = false;
28392 LDKNodeAnnouncement msg_conv;
28393 msg_conv.inner = (void*)(msg & (~1));
28394 msg_conv.is_owned = false;
28395 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28396 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
28397 return (uint64_t)ret_conv;
28400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28401 LDKNetworkGraph this_arg_conv;
28402 this_arg_conv.inner = (void*)(this_arg & (~1));
28403 this_arg_conv.is_owned = false;
28404 LDKUnsignedNodeAnnouncement msg_conv;
28405 msg_conv.inner = (void*)(msg & (~1));
28406 msg_conv.is_owned = false;
28407 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28408 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
28409 return (uint64_t)ret_conv;
28412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
28413 LDKNetworkGraph this_arg_conv;
28414 this_arg_conv.inner = (void*)(this_arg & (~1));
28415 this_arg_conv.is_owned = false;
28416 LDKChannelAnnouncement msg_conv;
28417 msg_conv.inner = (void*)(msg & (~1));
28418 msg_conv.is_owned = false;
28419 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28420 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28421 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28422 // Manually implement clone for Java trait instances
28423 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28424 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28425 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28428 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28429 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28430 return (uint64_t)ret_conv;
28433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
28434 LDKNetworkGraph this_arg_conv;
28435 this_arg_conv.inner = (void*)(this_arg & (~1));
28436 this_arg_conv.is_owned = false;
28437 LDKUnsignedChannelAnnouncement msg_conv;
28438 msg_conv.inner = (void*)(msg & (~1));
28439 msg_conv.is_owned = false;
28440 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28441 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28442 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28443 // Manually implement clone for Java trait instances
28444 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28445 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28446 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28449 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28450 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28451 return (uint64_t)ret_conv;
28454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
28455 LDKNetworkGraph this_arg_conv;
28456 this_arg_conv.inner = (void*)(this_arg & (~1));
28457 this_arg_conv.is_owned = false;
28458 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
28461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
28462 LDKNetworkGraph this_arg_conv;
28463 this_arg_conv.inner = (void*)(this_arg & (~1));
28464 this_arg_conv.is_owned = false;
28465 LDKPublicKey _node_id_ref;
28466 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
28467 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
28468 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
28471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28472 LDKNetworkGraph this_arg_conv;
28473 this_arg_conv.inner = (void*)(this_arg & (~1));
28474 this_arg_conv.is_owned = false;
28475 LDKChannelUpdate msg_conv;
28476 msg_conv.inner = (void*)(msg & (~1));
28477 msg_conv.is_owned = false;
28478 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28479 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
28480 return (uint64_t)ret_conv;
28483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28484 LDKNetworkGraph this_arg_conv;
28485 this_arg_conv.inner = (void*)(this_arg & (~1));
28486 this_arg_conv.is_owned = false;
28487 LDKUnsignedChannelUpdate msg_conv;
28488 msg_conv.inner = (void*)(msg & (~1));
28489 msg_conv.is_owned = false;
28490 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28491 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
28492 return (uint64_t)ret_conv;
28495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
28496 LDKReadOnlyNetworkGraph this_arg_conv;
28497 this_arg_conv.inner = (void*)(this_arg & (~1));
28498 this_arg_conv.is_owned = false;
28499 LDKPublicKey pubkey_ref;
28500 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
28501 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
28502 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
28503 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
28504 uint64_t ret_ref = (uint64_t)ret_copy;
28508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28509 LDKRouteHop this_obj_conv;
28510 this_obj_conv.inner = (void*)(this_obj & (~1));
28511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28512 RouteHop_free(this_obj_conv);
28515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28516 LDKRouteHop this_ptr_conv;
28517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28518 this_ptr_conv.is_owned = false;
28519 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
28524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28525 LDKRouteHop this_ptr_conv;
28526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28527 this_ptr_conv.is_owned = false;
28528 LDKPublicKey val_ref;
28529 CHECK((*env)->GetArrayLength(env, val) == 33);
28530 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28531 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
28534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28535 LDKRouteHop this_ptr_conv;
28536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28537 this_ptr_conv.is_owned = false;
28538 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
28539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28541 uint64_t ret_ref = (uint64_t)ret_var.inner;
28542 if (ret_var.is_owned) {
28548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28549 LDKRouteHop this_ptr_conv;
28550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28551 this_ptr_conv.is_owned = false;
28552 LDKNodeFeatures val_conv;
28553 val_conv.inner = (void*)(val & (~1));
28554 val_conv.is_owned = (val & 1) || (val == 0);
28555 val_conv = NodeFeatures_clone(&val_conv);
28556 RouteHop_set_node_features(&this_ptr_conv, val_conv);
28559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28560 LDKRouteHop this_ptr_conv;
28561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28562 this_ptr_conv.is_owned = false;
28563 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
28567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28568 LDKRouteHop this_ptr_conv;
28569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28570 this_ptr_conv.is_owned = false;
28571 RouteHop_set_short_channel_id(&this_ptr_conv, val);
28574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28575 LDKRouteHop this_ptr_conv;
28576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28577 this_ptr_conv.is_owned = false;
28578 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
28579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28581 uint64_t ret_ref = (uint64_t)ret_var.inner;
28582 if (ret_var.is_owned) {
28588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28589 LDKRouteHop this_ptr_conv;
28590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28591 this_ptr_conv.is_owned = false;
28592 LDKChannelFeatures val_conv;
28593 val_conv.inner = (void*)(val & (~1));
28594 val_conv.is_owned = (val & 1) || (val == 0);
28595 val_conv = ChannelFeatures_clone(&val_conv);
28596 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
28599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28600 LDKRouteHop this_ptr_conv;
28601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28602 this_ptr_conv.is_owned = false;
28603 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
28607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28608 LDKRouteHop this_ptr_conv;
28609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28610 this_ptr_conv.is_owned = false;
28611 RouteHop_set_fee_msat(&this_ptr_conv, val);
28614 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28615 LDKRouteHop this_ptr_conv;
28616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28617 this_ptr_conv.is_owned = false;
28618 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
28622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28623 LDKRouteHop this_ptr_conv;
28624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28625 this_ptr_conv.is_owned = false;
28626 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
28629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
28630 LDKPublicKey pubkey_arg_ref;
28631 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
28632 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
28633 LDKNodeFeatures node_features_arg_conv;
28634 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
28635 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
28636 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
28637 LDKChannelFeatures channel_features_arg_conv;
28638 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
28639 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
28640 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
28641 LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
28642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28644 uint64_t ret_ref = (uint64_t)ret_var.inner;
28645 if (ret_var.is_owned) {
28651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28652 LDKRouteHop orig_conv;
28653 orig_conv.inner = (void*)(orig & (~1));
28654 orig_conv.is_owned = false;
28655 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
28656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28658 uint64_t ret_ref = (uint64_t)ret_var.inner;
28659 if (ret_var.is_owned) {
28665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
28666 LDKRouteHop o_conv;
28667 o_conv.inner = (void*)(o & (~1));
28668 o_conv.is_owned = false;
28669 int64_t ret_val = RouteHop_hash(&o_conv);
28673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28674 LDKRouteHop a_conv;
28675 a_conv.inner = (void*)(a & (~1));
28676 a_conv.is_owned = false;
28677 LDKRouteHop b_conv;
28678 b_conv.inner = (void*)(b & (~1));
28679 b_conv.is_owned = false;
28680 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
28684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
28685 LDKRouteHop obj_conv;
28686 obj_conv.inner = (void*)(obj & (~1));
28687 obj_conv.is_owned = false;
28688 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
28689 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28690 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28691 CVec_u8Z_free(ret_var);
28695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28696 LDKu8slice ser_ref;
28697 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28698 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28699 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
28700 *ret_conv = RouteHop_read(ser_ref);
28701 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28702 return (uint64_t)ret_conv;
28705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28706 LDKRoute this_obj_conv;
28707 this_obj_conv.inner = (void*)(this_obj & (~1));
28708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28709 Route_free(this_obj_conv);
28712 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28713 LDKRoute this_ptr_conv;
28714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28715 this_ptr_conv.is_owned = false;
28716 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
28717 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
28719 for (size_t m = 0; m < ret_var.datalen; m++) {
28720 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
28721 int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
28722 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
28723 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
28724 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
28725 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28726 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28727 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
28728 if (ret_conv_12_conv_10_var.is_owned) {
28729 ret_conv_12_conv_10_ref |= 1;
28731 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
28733 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
28734 FREE(ret_conv_12_var.data);
28735 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
28737 FREE(ret_var.data);
28741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
28742 LDKRoute this_ptr_conv;
28743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28744 this_ptr_conv.is_owned = false;
28745 LDKCVec_CVec_RouteHopZZ val_constr;
28746 val_constr.datalen = (*env)->GetArrayLength(env, val);
28747 if (val_constr.datalen > 0)
28748 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
28750 val_constr.data = NULL;
28751 for (size_t m = 0; m < val_constr.datalen; m++) {
28752 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
28753 LDKCVec_RouteHopZ val_conv_12_constr;
28754 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
28755 if (val_conv_12_constr.datalen > 0)
28756 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
28758 val_conv_12_constr.data = NULL;
28759 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
28760 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
28761 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
28762 LDKRouteHop val_conv_12_conv_10_conv;
28763 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
28764 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
28765 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
28766 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
28768 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
28769 val_constr.data[m] = val_conv_12_constr;
28771 Route_set_paths(&this_ptr_conv, val_constr);
28774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
28775 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
28776 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
28777 if (paths_arg_constr.datalen > 0)
28778 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
28780 paths_arg_constr.data = NULL;
28781 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
28782 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
28783 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
28784 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
28785 if (paths_arg_conv_12_constr.datalen > 0)
28786 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
28788 paths_arg_conv_12_constr.data = NULL;
28789 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
28790 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
28791 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
28792 LDKRouteHop paths_arg_conv_12_conv_10_conv;
28793 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
28794 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
28795 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
28796 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
28798 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
28799 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
28801 LDKRoute ret_var = Route_new(paths_arg_constr);
28802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28804 uint64_t ret_ref = (uint64_t)ret_var.inner;
28805 if (ret_var.is_owned) {
28811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28812 LDKRoute orig_conv;
28813 orig_conv.inner = (void*)(orig & (~1));
28814 orig_conv.is_owned = false;
28815 LDKRoute ret_var = Route_clone(&orig_conv);
28816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28818 uint64_t ret_ref = (uint64_t)ret_var.inner;
28819 if (ret_var.is_owned) {
28825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
28827 o_conv.inner = (void*)(o & (~1));
28828 o_conv.is_owned = false;
28829 int64_t ret_val = Route_hash(&o_conv);
28833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28835 a_conv.inner = (void*)(a & (~1));
28836 a_conv.is_owned = false;
28838 b_conv.inner = (void*)(b & (~1));
28839 b_conv.is_owned = false;
28840 jboolean ret_val = Route_eq(&a_conv, &b_conv);
28844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
28845 LDKRoute this_arg_conv;
28846 this_arg_conv.inner = (void*)(this_arg & (~1));
28847 this_arg_conv.is_owned = false;
28848 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
28852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
28853 LDKRoute this_arg_conv;
28854 this_arg_conv.inner = (void*)(this_arg & (~1));
28855 this_arg_conv.is_owned = false;
28856 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
28860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
28862 obj_conv.inner = (void*)(obj & (~1));
28863 obj_conv.is_owned = false;
28864 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
28865 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28866 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28867 CVec_u8Z_free(ret_var);
28871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28872 LDKu8slice ser_ref;
28873 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28874 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28875 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
28876 *ret_conv = Route_read(ser_ref);
28877 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28878 return (uint64_t)ret_conv;
28881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28882 LDKRouteHint this_obj_conv;
28883 this_obj_conv.inner = (void*)(this_obj & (~1));
28884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28885 RouteHint_free(this_obj_conv);
28888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28889 LDKRouteHint orig_conv;
28890 orig_conv.inner = (void*)(orig & (~1));
28891 orig_conv.is_owned = false;
28892 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
28893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28895 uint64_t ret_ref = (uint64_t)ret_var.inner;
28896 if (ret_var.is_owned) {
28902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
28903 LDKRouteHint o_conv;
28904 o_conv.inner = (void*)(o & (~1));
28905 o_conv.is_owned = false;
28906 int64_t ret_val = RouteHint_hash(&o_conv);
28910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28911 LDKRouteHint a_conv;
28912 a_conv.inner = (void*)(a & (~1));
28913 a_conv.is_owned = false;
28914 LDKRouteHint b_conv;
28915 b_conv.inner = (void*)(b & (~1));
28916 b_conv.is_owned = false;
28917 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
28921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28922 LDKRouteHintHop this_obj_conv;
28923 this_obj_conv.inner = (void*)(this_obj & (~1));
28924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28925 RouteHintHop_free(this_obj_conv);
28928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28929 LDKRouteHintHop this_ptr_conv;
28930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28931 this_ptr_conv.is_owned = false;
28932 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
28937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28938 LDKRouteHintHop this_ptr_conv;
28939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28940 this_ptr_conv.is_owned = false;
28941 LDKPublicKey val_ref;
28942 CHECK((*env)->GetArrayLength(env, val) == 33);
28943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28944 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
28947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28948 LDKRouteHintHop this_ptr_conv;
28949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28950 this_ptr_conv.is_owned = false;
28951 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
28955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28956 LDKRouteHintHop this_ptr_conv;
28957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28958 this_ptr_conv.is_owned = false;
28959 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
28962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
28963 LDKRouteHintHop this_ptr_conv;
28964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28965 this_ptr_conv.is_owned = false;
28966 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
28967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28969 uint64_t ret_ref = (uint64_t)ret_var.inner;
28970 if (ret_var.is_owned) {
28976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28977 LDKRouteHintHop this_ptr_conv;
28978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28979 this_ptr_conv.is_owned = false;
28980 LDKRoutingFees val_conv;
28981 val_conv.inner = (void*)(val & (~1));
28982 val_conv.is_owned = (val & 1) || (val == 0);
28983 val_conv = RoutingFees_clone(&val_conv);
28984 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
28987 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28988 LDKRouteHintHop this_ptr_conv;
28989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28990 this_ptr_conv.is_owned = false;
28991 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
28995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28996 LDKRouteHintHop this_ptr_conv;
28997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28998 this_ptr_conv.is_owned = false;
28999 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
29002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29003 LDKRouteHintHop this_ptr_conv;
29004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29005 this_ptr_conv.is_owned = false;
29006 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29007 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
29008 uint64_t ret_ref = (uint64_t)ret_copy;
29012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29013 LDKRouteHintHop this_ptr_conv;
29014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29015 this_ptr_conv.is_owned = false;
29016 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
29017 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
29018 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
29021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29022 LDKRouteHintHop this_ptr_conv;
29023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29024 this_ptr_conv.is_owned = false;
29025 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29026 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
29027 uint64_t ret_ref = (uint64_t)ret_copy;
29031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29032 LDKRouteHintHop this_ptr_conv;
29033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29034 this_ptr_conv.is_owned = false;
29035 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
29036 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
29037 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
29040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
29041 LDKPublicKey src_node_id_arg_ref;
29042 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
29043 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
29044 LDKRoutingFees fees_arg_conv;
29045 fees_arg_conv.inner = (void*)(fees_arg & (~1));
29046 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
29047 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
29048 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
29049 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
29050 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
29051 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
29052 LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
29053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29055 uint64_t ret_ref = (uint64_t)ret_var.inner;
29056 if (ret_var.is_owned) {
29062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29063 LDKRouteHintHop orig_conv;
29064 orig_conv.inner = (void*)(orig & (~1));
29065 orig_conv.is_owned = false;
29066 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
29067 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29068 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29069 uint64_t ret_ref = (uint64_t)ret_var.inner;
29070 if (ret_var.is_owned) {
29076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
29077 LDKRouteHintHop o_conv;
29078 o_conv.inner = (void*)(o & (~1));
29079 o_conv.is_owned = false;
29080 int64_t ret_val = RouteHintHop_hash(&o_conv);
29084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29085 LDKRouteHintHop a_conv;
29086 a_conv.inner = (void*)(a & (~1));
29087 a_conv.is_owned = false;
29088 LDKRouteHintHop b_conv;
29089 b_conv.inner = (void*)(b & (~1));
29090 b_conv.is_owned = false;
29091 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
29095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) {
29096 LDKPublicKey our_node_pubkey_ref;
29097 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
29098 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
29099 LDKNetworkGraph network_conv;
29100 network_conv.inner = (void*)(network & (~1));
29101 network_conv.is_owned = false;
29102 LDKPublicKey payee_ref;
29103 CHECK((*env)->GetArrayLength(env, payee) == 33);
29104 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
29105 LDKCVec_ChannelDetailsZ first_hops_constr;
29106 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
29107 if (first_hops != NULL) {
29108 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
29109 if (first_hops_constr.datalen > 0)
29110 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29112 first_hops_constr.data = NULL;
29113 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
29114 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
29115 int64_t first_hops_conv_16 = first_hops_vals[q];
29116 LDKChannelDetails first_hops_conv_16_conv;
29117 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
29118 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
29119 first_hops_constr.data[q] = first_hops_conv_16_conv;
29121 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
29122 first_hops_ptr = &first_hops_constr;
29124 LDKCVec_RouteHintZ last_hops_constr;
29125 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
29126 if (last_hops_constr.datalen > 0)
29127 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
29129 last_hops_constr.data = NULL;
29130 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
29131 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
29132 int64_t last_hops_conv_11 = last_hops_vals[l];
29133 LDKRouteHint last_hops_conv_11_conv;
29134 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
29135 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
29136 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
29137 last_hops_constr.data[l] = last_hops_conv_11_conv;
29139 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
29140 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
29141 if (logger_conv.free == LDKLogger_JCalls_free) {
29142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29143 LDKLogger_JCalls_cloned(&logger_conv);
29145 LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1);
29146 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
29147 *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
29148 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
29149 return (uint64_t)ret_conv;
29152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) {
29153 LDKPublicKey our_node_pubkey_ref;
29154 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
29155 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
29156 LDKNetworkGraph network_conv;
29157 network_conv.inner = (void*)(network & (~1));
29158 network_conv.is_owned = false;
29159 LDKPublicKey payee_ref;
29160 CHECK((*env)->GetArrayLength(env, payee) == 33);
29161 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
29162 LDKInvoiceFeatures payee_features_conv;
29163 payee_features_conv.inner = (void*)(payee_features & (~1));
29164 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
29165 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
29166 LDKCVec_ChannelDetailsZ first_hops_constr;
29167 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
29168 if (first_hops != NULL) {
29169 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
29170 if (first_hops_constr.datalen > 0)
29171 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29173 first_hops_constr.data = NULL;
29174 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
29175 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
29176 int64_t first_hops_conv_16 = first_hops_vals[q];
29177 LDKChannelDetails first_hops_conv_16_conv;
29178 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
29179 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
29180 first_hops_constr.data[q] = first_hops_conv_16_conv;
29182 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
29183 first_hops_ptr = &first_hops_constr;
29185 LDKCVec_RouteHintZ last_hops_constr;
29186 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
29187 if (last_hops_constr.datalen > 0)
29188 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
29190 last_hops_constr.data = NULL;
29191 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
29192 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
29193 int64_t last_hops_conv_11 = last_hops_vals[l];
29194 LDKRouteHint last_hops_conv_11_conv;
29195 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
29196 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
29197 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
29198 last_hops_constr.data[l] = last_hops_conv_11_conv;
29200 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
29201 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
29202 if (logger_conv.free == LDKLogger_JCalls_free) {
29203 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29204 LDKLogger_JCalls_cloned(&logger_conv);
29206 LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1);
29207 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
29208 *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv);
29209 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
29210 return (uint64_t)ret_conv;
29213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29214 LDKScorer this_obj_conv;
29215 this_obj_conv.inner = (void*)(this_obj & (~1));
29216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29217 Scorer_free(this_obj_conv);
29220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat) {
29221 LDKScorer ret_var = Scorer_new(base_penalty_msat);
29222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29224 uint64_t ret_ref = (uint64_t)ret_var.inner;
29225 if (ret_var.is_owned) {
29231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
29232 LDKScorer ret_var = Scorer_default();
29233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29235 uint64_t ret_ref = (uint64_t)ret_var.inner;
29236 if (ret_var.is_owned) {
29242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
29243 LDKScorer this_arg_conv;
29244 this_arg_conv.inner = (void*)(this_arg & (~1));
29245 this_arg_conv.is_owned = false;
29246 LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore");
29247 *ret_ret = Scorer_as_Score(&this_arg_conv);
29248 return (uint64_t)ret_ret;
29251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29252 LDKFilesystemPersister this_obj_conv;
29253 this_obj_conv.inner = (void*)(this_obj & (~1));
29254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29255 FilesystemPersister_free(this_obj_conv);
29258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
29259 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
29260 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
29261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29263 uint64_t ret_ref = (uint64_t)ret_var.inner;
29264 if (ret_var.is_owned) {
29270 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
29271 LDKFilesystemPersister this_arg_conv;
29272 this_arg_conv.inner = (void*)(this_arg & (~1));
29273 this_arg_conv.is_owned = false;
29274 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
29275 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
29281 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
29282 LDKChannelManager manager_conv;
29283 manager_conv.inner = (void*)(manager & (~1));
29284 manager_conv.is_owned = false;
29285 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
29286 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
29287 return (uint64_t)ret_conv;
29290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
29291 LDKFilesystemPersister this_arg_conv;
29292 this_arg_conv.inner = (void*)(this_arg & (~1));
29293 this_arg_conv.is_owned = false;
29294 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
29295 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29296 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29297 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29299 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
29300 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
29301 return (uint64_t)ret_conv;
29304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
29305 LDKFilesystemPersister this_arg_conv;
29306 this_arg_conv.inner = (void*)(this_arg & (~1));
29307 this_arg_conv.is_owned = false;
29308 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
29309 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
29310 return (uint64_t)ret_ret;
29313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29314 LDKBackgroundProcessor this_obj_conv;
29315 this_obj_conv.inner = (void*)(this_obj & (~1));
29316 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29317 BackgroundProcessor_free(this_obj_conv);
29320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29321 if ((this_ptr & 1) != 0) return;
29322 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
29323 FREE((void*)this_ptr);
29324 ChannelManagerPersister_free(this_ptr_conv);
29327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
29328 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
29329 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
29330 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29331 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
29333 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
29334 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
29335 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29336 LDKEventHandler_JCalls_cloned(&event_handler_conv);
29338 LDKChainMonitor chain_monitor_conv;
29339 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
29340 chain_monitor_conv.is_owned = false;
29341 LDKChannelManager channel_manager_conv;
29342 channel_manager_conv.inner = (void*)(channel_manager & (~1));
29343 channel_manager_conv.is_owned = false;
29344 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
29345 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
29346 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
29347 LDKPeerManager peer_manager_conv;
29348 peer_manager_conv.inner = (void*)(peer_manager & (~1));
29349 peer_manager_conv.is_owned = false;
29350 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
29351 if (logger_conv.free == LDKLogger_JCalls_free) {
29352 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29353 LDKLogger_JCalls_cloned(&logger_conv);
29355 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
29356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29358 uint64_t ret_ref = (uint64_t)ret_var.inner;
29359 if (ret_var.is_owned) {
29365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
29366 LDKBackgroundProcessor this_arg_conv;
29367 this_arg_conv.inner = (void*)(this_arg & (~1));
29368 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29369 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
29370 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
29371 *ret_conv = BackgroundProcessor_join(this_arg_conv);
29372 return (uint64_t)ret_conv;
29375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
29376 LDKBackgroundProcessor this_arg_conv;
29377 this_arg_conv.inner = (void*)(this_arg & (~1));
29378 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29379 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
29380 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
29381 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
29382 return (uint64_t)ret_conv;
29385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
29389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29390 LDKInvoice this_obj_conv;
29391 this_obj_conv.inner = (void*)(this_obj & (~1));
29392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29393 Invoice_free(this_obj_conv);
29396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29398 a_conv.inner = (void*)(a & (~1));
29399 a_conv.is_owned = false;
29401 b_conv.inner = (void*)(b & (~1));
29402 b_conv.is_owned = false;
29403 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
29407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29408 LDKInvoice orig_conv;
29409 orig_conv.inner = (void*)(orig & (~1));
29410 orig_conv.is_owned = false;
29411 LDKInvoice ret_var = Invoice_clone(&orig_conv);
29412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29414 uint64_t ret_ref = (uint64_t)ret_var.inner;
29415 if (ret_var.is_owned) {
29421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29422 LDKSignedRawInvoice this_obj_conv;
29423 this_obj_conv.inner = (void*)(this_obj & (~1));
29424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29425 SignedRawInvoice_free(this_obj_conv);
29428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29429 LDKSignedRawInvoice a_conv;
29430 a_conv.inner = (void*)(a & (~1));
29431 a_conv.is_owned = false;
29432 LDKSignedRawInvoice b_conv;
29433 b_conv.inner = (void*)(b & (~1));
29434 b_conv.is_owned = false;
29435 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
29439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29440 LDKSignedRawInvoice orig_conv;
29441 orig_conv.inner = (void*)(orig & (~1));
29442 orig_conv.is_owned = false;
29443 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
29444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29446 uint64_t ret_ref = (uint64_t)ret_var.inner;
29447 if (ret_var.is_owned) {
29453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29454 LDKRawInvoice this_obj_conv;
29455 this_obj_conv.inner = (void*)(this_obj & (~1));
29456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29457 RawInvoice_free(this_obj_conv);
29460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
29461 LDKRawInvoice this_ptr_conv;
29462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29463 this_ptr_conv.is_owned = false;
29464 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
29465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29467 uint64_t ret_ref = (uint64_t)ret_var.inner;
29468 if (ret_var.is_owned) {
29474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29475 LDKRawInvoice this_ptr_conv;
29476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29477 this_ptr_conv.is_owned = false;
29478 LDKRawDataPart val_conv;
29479 val_conv.inner = (void*)(val & (~1));
29480 val_conv.is_owned = (val & 1) || (val == 0);
29481 val_conv = RawDataPart_clone(&val_conv);
29482 RawInvoice_set_data(&this_ptr_conv, val_conv);
29485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29486 LDKRawInvoice a_conv;
29487 a_conv.inner = (void*)(a & (~1));
29488 a_conv.is_owned = false;
29489 LDKRawInvoice b_conv;
29490 b_conv.inner = (void*)(b & (~1));
29491 b_conv.is_owned = false;
29492 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
29496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29497 LDKRawInvoice orig_conv;
29498 orig_conv.inner = (void*)(orig & (~1));
29499 orig_conv.is_owned = false;
29500 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
29501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29503 uint64_t ret_ref = (uint64_t)ret_var.inner;
29504 if (ret_var.is_owned) {
29510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29511 LDKRawDataPart this_obj_conv;
29512 this_obj_conv.inner = (void*)(this_obj & (~1));
29513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29514 RawDataPart_free(this_obj_conv);
29517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
29518 LDKRawDataPart this_ptr_conv;
29519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29520 this_ptr_conv.is_owned = false;
29521 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
29522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29524 uint64_t ret_ref = (uint64_t)ret_var.inner;
29525 if (ret_var.is_owned) {
29531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29532 LDKRawDataPart this_ptr_conv;
29533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29534 this_ptr_conv.is_owned = false;
29535 LDKPositiveTimestamp val_conv;
29536 val_conv.inner = (void*)(val & (~1));
29537 val_conv.is_owned = (val & 1) || (val == 0);
29538 val_conv = PositiveTimestamp_clone(&val_conv);
29539 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
29542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29543 LDKRawDataPart a_conv;
29544 a_conv.inner = (void*)(a & (~1));
29545 a_conv.is_owned = false;
29546 LDKRawDataPart b_conv;
29547 b_conv.inner = (void*)(b & (~1));
29548 b_conv.is_owned = false;
29549 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
29553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29554 LDKRawDataPart orig_conv;
29555 orig_conv.inner = (void*)(orig & (~1));
29556 orig_conv.is_owned = false;
29557 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
29558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29560 uint64_t ret_ref = (uint64_t)ret_var.inner;
29561 if (ret_var.is_owned) {
29567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29568 LDKPositiveTimestamp this_obj_conv;
29569 this_obj_conv.inner = (void*)(this_obj & (~1));
29570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29571 PositiveTimestamp_free(this_obj_conv);
29574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29575 LDKPositiveTimestamp a_conv;
29576 a_conv.inner = (void*)(a & (~1));
29577 a_conv.is_owned = false;
29578 LDKPositiveTimestamp b_conv;
29579 b_conv.inner = (void*)(b & (~1));
29580 b_conv.is_owned = false;
29581 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
29585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29586 LDKPositiveTimestamp orig_conv;
29587 orig_conv.inner = (void*)(orig & (~1));
29588 orig_conv.is_owned = false;
29589 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
29590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29592 uint64_t ret_ref = (uint64_t)ret_var.inner;
29593 if (ret_var.is_owned) {
29599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29600 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
29601 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
29605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
29606 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
29610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
29611 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
29615 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
29616 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
29620 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
29621 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
29625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29626 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
29627 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
29628 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
29632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
29633 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
29634 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
29638 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29639 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
29640 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
29644 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
29645 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
29649 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
29650 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
29654 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
29655 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
29659 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
29660 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
29664 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
29665 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
29669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
29670 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
29671 int64_t ret_val = Currency_hash(o_conv);
29675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29676 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
29677 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
29678 jboolean ret_val = Currency_eq(a_conv, b_conv);
29682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29683 LDKSha256 this_obj_conv;
29684 this_obj_conv.inner = (void*)(this_obj & (~1));
29685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29686 Sha256_free(this_obj_conv);
29689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29690 LDKSha256 orig_conv;
29691 orig_conv.inner = (void*)(orig & (~1));
29692 orig_conv.is_owned = false;
29693 LDKSha256 ret_var = Sha256_clone(&orig_conv);
29694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29696 uint64_t ret_ref = (uint64_t)ret_var.inner;
29697 if (ret_var.is_owned) {
29703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
29705 o_conv.inner = (void*)(o & (~1));
29706 o_conv.is_owned = false;
29707 int64_t ret_val = Sha256_hash(&o_conv);
29711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29713 a_conv.inner = (void*)(a & (~1));
29714 a_conv.is_owned = false;
29716 b_conv.inner = (void*)(b & (~1));
29717 b_conv.is_owned = false;
29718 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
29722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29723 LDKDescription this_obj_conv;
29724 this_obj_conv.inner = (void*)(this_obj & (~1));
29725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29726 Description_free(this_obj_conv);
29729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29730 LDKDescription orig_conv;
29731 orig_conv.inner = (void*)(orig & (~1));
29732 orig_conv.is_owned = false;
29733 LDKDescription ret_var = Description_clone(&orig_conv);
29734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29736 uint64_t ret_ref = (uint64_t)ret_var.inner;
29737 if (ret_var.is_owned) {
29743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
29744 LDKDescription o_conv;
29745 o_conv.inner = (void*)(o & (~1));
29746 o_conv.is_owned = false;
29747 int64_t ret_val = Description_hash(&o_conv);
29751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29752 LDKDescription a_conv;
29753 a_conv.inner = (void*)(a & (~1));
29754 a_conv.is_owned = false;
29755 LDKDescription b_conv;
29756 b_conv.inner = (void*)(b & (~1));
29757 b_conv.is_owned = false;
29758 jboolean ret_val = Description_eq(&a_conv, &b_conv);
29762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29763 LDKPayeePubKey this_obj_conv;
29764 this_obj_conv.inner = (void*)(this_obj & (~1));
29765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29766 PayeePubKey_free(this_obj_conv);
29769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29770 LDKPayeePubKey orig_conv;
29771 orig_conv.inner = (void*)(orig & (~1));
29772 orig_conv.is_owned = false;
29773 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
29774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29776 uint64_t ret_ref = (uint64_t)ret_var.inner;
29777 if (ret_var.is_owned) {
29783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
29784 LDKPayeePubKey o_conv;
29785 o_conv.inner = (void*)(o & (~1));
29786 o_conv.is_owned = false;
29787 int64_t ret_val = PayeePubKey_hash(&o_conv);
29791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29792 LDKPayeePubKey a_conv;
29793 a_conv.inner = (void*)(a & (~1));
29794 a_conv.is_owned = false;
29795 LDKPayeePubKey b_conv;
29796 b_conv.inner = (void*)(b & (~1));
29797 b_conv.is_owned = false;
29798 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
29802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29803 LDKExpiryTime this_obj_conv;
29804 this_obj_conv.inner = (void*)(this_obj & (~1));
29805 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29806 ExpiryTime_free(this_obj_conv);
29809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29810 LDKExpiryTime orig_conv;
29811 orig_conv.inner = (void*)(orig & (~1));
29812 orig_conv.is_owned = false;
29813 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
29814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29816 uint64_t ret_ref = (uint64_t)ret_var.inner;
29817 if (ret_var.is_owned) {
29823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
29824 LDKExpiryTime o_conv;
29825 o_conv.inner = (void*)(o & (~1));
29826 o_conv.is_owned = false;
29827 int64_t ret_val = ExpiryTime_hash(&o_conv);
29831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29832 LDKExpiryTime a_conv;
29833 a_conv.inner = (void*)(a & (~1));
29834 a_conv.is_owned = false;
29835 LDKExpiryTime b_conv;
29836 b_conv.inner = (void*)(b & (~1));
29837 b_conv.is_owned = false;
29838 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
29842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29843 LDKMinFinalCltvExpiry this_obj_conv;
29844 this_obj_conv.inner = (void*)(this_obj & (~1));
29845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29846 MinFinalCltvExpiry_free(this_obj_conv);
29849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29850 LDKMinFinalCltvExpiry orig_conv;
29851 orig_conv.inner = (void*)(orig & (~1));
29852 orig_conv.is_owned = false;
29853 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
29854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29856 uint64_t ret_ref = (uint64_t)ret_var.inner;
29857 if (ret_var.is_owned) {
29863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
29864 LDKMinFinalCltvExpiry o_conv;
29865 o_conv.inner = (void*)(o & (~1));
29866 o_conv.is_owned = false;
29867 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
29871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29872 LDKMinFinalCltvExpiry a_conv;
29873 a_conv.inner = (void*)(a & (~1));
29874 a_conv.is_owned = false;
29875 LDKMinFinalCltvExpiry b_conv;
29876 b_conv.inner = (void*)(b & (~1));
29877 b_conv.is_owned = false;
29878 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
29882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29883 if ((this_ptr & 1) != 0) return;
29884 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
29885 FREE((void*)this_ptr);
29886 Fallback_free(this_ptr_conv);
29889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29890 LDKFallback* orig_conv = (LDKFallback*)orig;
29891 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29892 *ret_copy = Fallback_clone(orig_conv);
29893 uint64_t ret_ref = (uint64_t)ret_copy;
29897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
29899 LDKCVec_u8Z program_ref;
29900 program_ref.datalen = (*env)->GetArrayLength(env, program);
29901 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
29902 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
29903 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29904 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
29905 uint64_t ret_ref = (uint64_t)ret_copy;
29909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
29910 LDKTwentyBytes a_ref;
29911 CHECK((*env)->GetArrayLength(env, a) == 20);
29912 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
29913 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29914 *ret_copy = Fallback_pub_key_hash(a_ref);
29915 uint64_t ret_ref = (uint64_t)ret_copy;
29919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
29920 LDKTwentyBytes a_ref;
29921 CHECK((*env)->GetArrayLength(env, a) == 20);
29922 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
29923 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29924 *ret_copy = Fallback_script_hash(a_ref);
29925 uint64_t ret_ref = (uint64_t)ret_copy;
29929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
29930 LDKFallback* o_conv = (LDKFallback*)o;
29931 int64_t ret_val = Fallback_hash(o_conv);
29935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29936 LDKFallback* a_conv = (LDKFallback*)a;
29937 LDKFallback* b_conv = (LDKFallback*)b;
29938 jboolean ret_val = Fallback_eq(a_conv, b_conv);
29942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29943 LDKInvoiceSignature this_obj_conv;
29944 this_obj_conv.inner = (void*)(this_obj & (~1));
29945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29946 InvoiceSignature_free(this_obj_conv);
29949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29950 LDKInvoiceSignature orig_conv;
29951 orig_conv.inner = (void*)(orig & (~1));
29952 orig_conv.is_owned = false;
29953 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
29954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29956 uint64_t ret_ref = (uint64_t)ret_var.inner;
29957 if (ret_var.is_owned) {
29963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29964 LDKInvoiceSignature a_conv;
29965 a_conv.inner = (void*)(a & (~1));
29966 a_conv.is_owned = false;
29967 LDKInvoiceSignature b_conv;
29968 b_conv.inner = (void*)(b & (~1));
29969 b_conv.is_owned = false;
29970 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
29974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29975 LDKPrivateRoute this_obj_conv;
29976 this_obj_conv.inner = (void*)(this_obj & (~1));
29977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29978 PrivateRoute_free(this_obj_conv);
29981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29982 LDKPrivateRoute orig_conv;
29983 orig_conv.inner = (void*)(orig & (~1));
29984 orig_conv.is_owned = false;
29985 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
29986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29988 uint64_t ret_ref = (uint64_t)ret_var.inner;
29989 if (ret_var.is_owned) {
29995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
29996 LDKPrivateRoute o_conv;
29997 o_conv.inner = (void*)(o & (~1));
29998 o_conv.is_owned = false;
29999 int64_t ret_val = PrivateRoute_hash(&o_conv);
30003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30004 LDKPrivateRoute a_conv;
30005 a_conv.inner = (void*)(a & (~1));
30006 a_conv.is_owned = false;
30007 LDKPrivateRoute b_conv;
30008 b_conv.inner = (void*)(b & (~1));
30009 b_conv.is_owned = false;
30010 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
30014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
30015 LDKSignedRawInvoice this_arg_conv;
30016 this_arg_conv.inner = (void*)(this_arg & (~1));
30017 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30018 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
30019 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
30020 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
30021 return ((uint64_t)ret_conv);
30024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
30025 LDKSignedRawInvoice this_arg_conv;
30026 this_arg_conv.inner = (void*)(this_arg & (~1));
30027 this_arg_conv.is_owned = false;
30028 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
30029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30031 uint64_t ret_ref = (uint64_t)ret_var.inner;
30032 if (ret_var.is_owned) {
30038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30039 LDKSignedRawInvoice this_arg_conv;
30040 this_arg_conv.inner = (void*)(this_arg & (~1));
30041 this_arg_conv.is_owned = false;
30042 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30043 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
30047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
30048 LDKSignedRawInvoice this_arg_conv;
30049 this_arg_conv.inner = (void*)(this_arg & (~1));
30050 this_arg_conv.is_owned = false;
30051 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
30052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30054 uint64_t ret_ref = (uint64_t)ret_var.inner;
30055 if (ret_var.is_owned) {
30061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30062 LDKSignedRawInvoice this_arg_conv;
30063 this_arg_conv.inner = (void*)(this_arg & (~1));
30064 this_arg_conv.is_owned = false;
30065 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
30066 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
30067 return (uint64_t)ret_conv;
30070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
30071 LDKSignedRawInvoice this_arg_conv;
30072 this_arg_conv.inner = (void*)(this_arg & (~1));
30073 this_arg_conv.is_owned = false;
30074 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
30078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30079 LDKRawInvoice this_arg_conv;
30080 this_arg_conv.inner = (void*)(this_arg & (~1));
30081 this_arg_conv.is_owned = false;
30082 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
30087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30088 LDKRawInvoice this_arg_conv;
30089 this_arg_conv.inner = (void*)(this_arg & (~1));
30090 this_arg_conv.is_owned = false;
30091 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
30092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30094 uint64_t ret_ref = (uint64_t)ret_var.inner;
30095 if (ret_var.is_owned) {
30101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
30102 LDKRawInvoice this_arg_conv;
30103 this_arg_conv.inner = (void*)(this_arg & (~1));
30104 this_arg_conv.is_owned = false;
30105 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
30106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30108 uint64_t ret_ref = (uint64_t)ret_var.inner;
30109 if (ret_var.is_owned) {
30115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30116 LDKRawInvoice this_arg_conv;
30117 this_arg_conv.inner = (void*)(this_arg & (~1));
30118 this_arg_conv.is_owned = false;
30119 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
30120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30122 uint64_t ret_ref = (uint64_t)ret_var.inner;
30123 if (ret_var.is_owned) {
30129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30130 LDKRawInvoice this_arg_conv;
30131 this_arg_conv.inner = (void*)(this_arg & (~1));
30132 this_arg_conv.is_owned = false;
30133 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
30134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30136 uint64_t ret_ref = (uint64_t)ret_var.inner;
30137 if (ret_var.is_owned) {
30143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
30144 LDKRawInvoice this_arg_conv;
30145 this_arg_conv.inner = (void*)(this_arg & (~1));
30146 this_arg_conv.is_owned = false;
30147 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
30148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30150 uint64_t ret_ref = (uint64_t)ret_var.inner;
30151 if (ret_var.is_owned) {
30157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
30158 LDKRawInvoice this_arg_conv;
30159 this_arg_conv.inner = (void*)(this_arg & (~1));
30160 this_arg_conv.is_owned = false;
30161 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
30162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30164 uint64_t ret_ref = (uint64_t)ret_var.inner;
30165 if (ret_var.is_owned) {
30171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
30172 LDKRawInvoice this_arg_conv;
30173 this_arg_conv.inner = (void*)(this_arg & (~1));
30174 this_arg_conv.is_owned = false;
30175 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
30180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
30181 LDKRawInvoice this_arg_conv;
30182 this_arg_conv.inner = (void*)(this_arg & (~1));
30183 this_arg_conv.is_owned = false;
30184 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
30185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30187 uint64_t ret_ref = (uint64_t)ret_var.inner;
30188 if (ret_var.is_owned) {
30194 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
30195 LDKRawInvoice this_arg_conv;
30196 this_arg_conv.inner = (void*)(this_arg & (~1));
30197 this_arg_conv.is_owned = false;
30198 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
30199 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30200 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30201 for (size_t o = 0; o < ret_var.datalen; o++) {
30202 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
30203 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30204 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30205 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
30206 if (ret_conv_14_var.is_owned) {
30207 ret_conv_14_ref |= 1;
30209 ret_arr_ptr[o] = ret_conv_14_ref;
30211 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30212 FREE(ret_var.data);
30216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
30217 LDKRawInvoice this_arg_conv;
30218 this_arg_conv.inner = (void*)(this_arg & (~1));
30219 this_arg_conv.is_owned = false;
30220 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30221 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
30222 uint64_t ret_ref = (uint64_t)ret_copy;
30226 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
30227 LDKRawInvoice this_arg_conv;
30228 this_arg_conv.inner = (void*)(this_arg & (~1));
30229 this_arg_conv.is_owned = false;
30230 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
30234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
30235 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30236 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
30237 return (uint64_t)ret_conv;
30240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
30241 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30242 *ret_conv = PositiveTimestamp_from_system_time(time);
30243 return (uint64_t)ret_conv;
30246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
30247 LDKPositiveTimestamp this_arg_conv;
30248 this_arg_conv.inner = (void*)(this_arg & (~1));
30249 this_arg_conv.is_owned = false;
30250 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
30254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
30255 LDKPositiveTimestamp this_arg_conv;
30256 this_arg_conv.inner = (void*)(this_arg & (~1));
30257 this_arg_conv.is_owned = false;
30258 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
30262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
30263 LDKInvoice this_arg_conv;
30264 this_arg_conv.inner = (void*)(this_arg & (~1));
30265 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30266 this_arg_conv = Invoice_clone(&this_arg_conv);
30267 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
30268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30270 uint64_t ret_ref = (uint64_t)ret_var.inner;
30271 if (ret_var.is_owned) {
30277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
30278 LDKInvoice this_arg_conv;
30279 this_arg_conv.inner = (void*)(this_arg & (~1));
30280 this_arg_conv.is_owned = false;
30281 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
30282 *ret_conv = Invoice_check_signature(&this_arg_conv);
30283 return (uint64_t)ret_conv;
30286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
30287 LDKSignedRawInvoice signed_invoice_conv;
30288 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
30289 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
30290 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
30291 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
30292 *ret_conv = Invoice_from_signed(signed_invoice_conv);
30293 return (uint64_t)ret_conv;
30296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
30297 LDKInvoice this_arg_conv;
30298 this_arg_conv.inner = (void*)(this_arg & (~1));
30299 this_arg_conv.is_owned = false;
30300 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
30304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30305 LDKInvoice this_arg_conv;
30306 this_arg_conv.inner = (void*)(this_arg & (~1));
30307 this_arg_conv.is_owned = false;
30308 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30309 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
30313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30314 LDKInvoice this_arg_conv;
30315 this_arg_conv.inner = (void*)(this_arg & (~1));
30316 this_arg_conv.is_owned = false;
30317 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
30322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
30323 LDKInvoice this_arg_conv;
30324 this_arg_conv.inner = (void*)(this_arg & (~1));
30325 this_arg_conv.is_owned = false;
30326 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30327 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
30331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
30332 LDKInvoice this_arg_conv;
30333 this_arg_conv.inner = (void*)(this_arg & (~1));
30334 this_arg_conv.is_owned = false;
30335 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
30336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30338 uint64_t ret_ref = (uint64_t)ret_var.inner;
30339 if (ret_var.is_owned) {
30345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30346 LDKInvoice this_arg_conv;
30347 this_arg_conv.inner = (void*)(this_arg & (~1));
30348 this_arg_conv.is_owned = false;
30349 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
30354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
30355 LDKInvoice this_arg_conv;
30356 this_arg_conv.inner = (void*)(this_arg & (~1));
30357 this_arg_conv.is_owned = false;
30358 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
30362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
30363 LDKInvoice this_arg_conv;
30364 this_arg_conv.inner = (void*)(this_arg & (~1));
30365 this_arg_conv.is_owned = false;
30366 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
30370 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
30371 LDKInvoice this_arg_conv;
30372 this_arg_conv.inner = (void*)(this_arg & (~1));
30373 this_arg_conv.is_owned = false;
30374 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
30375 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30376 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30377 for (size_t o = 0; o < ret_var.datalen; o++) {
30378 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
30379 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30380 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30381 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
30382 if (ret_conv_14_var.is_owned) {
30383 ret_conv_14_ref |= 1;
30385 ret_arr_ptr[o] = ret_conv_14_ref;
30387 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30388 FREE(ret_var.data);
30392 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
30393 LDKInvoice this_arg_conv;
30394 this_arg_conv.inner = (void*)(this_arg & (~1));
30395 this_arg_conv.is_owned = false;
30396 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
30397 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30398 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30399 for (size_t l = 0; l < ret_var.datalen; l++) {
30400 LDKRouteHint ret_conv_11_var = ret_var.data[l];
30401 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30402 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30403 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
30404 if (ret_conv_11_var.is_owned) {
30405 ret_conv_11_ref |= 1;
30407 ret_arr_ptr[l] = ret_conv_11_ref;
30409 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30410 FREE(ret_var.data);
30414 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
30415 LDKInvoice this_arg_conv;
30416 this_arg_conv.inner = (void*)(this_arg & (~1));
30417 this_arg_conv.is_owned = false;
30418 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
30422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
30423 LDKInvoice this_arg_conv;
30424 this_arg_conv.inner = (void*)(this_arg & (~1));
30425 this_arg_conv.is_owned = false;
30426 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30427 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
30428 uint64_t ret_ref = (uint64_t)ret_copy;
30432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
30433 LDKStr description_conv = java_to_owned_str(env, description);
30434 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30435 *ret_conv = Description_new(description_conv);
30436 return (uint64_t)ret_conv;
30439 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
30440 LDKDescription this_arg_conv;
30441 this_arg_conv.inner = (void*)(this_arg & (~1));
30442 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30443 this_arg_conv = Description_clone(&this_arg_conv);
30444 LDKStr ret_str = Description_into_inner(this_arg_conv);
30445 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
30451 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
30452 *ret_conv = ExpiryTime_from_seconds(seconds);
30453 return (uint64_t)ret_conv;
30456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
30457 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
30458 *ret_conv = ExpiryTime_from_duration(duration);
30459 return (uint64_t)ret_conv;
30462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
30463 LDKExpiryTime this_arg_conv;
30464 this_arg_conv.inner = (void*)(this_arg & (~1));
30465 this_arg_conv.is_owned = false;
30466 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
30470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
30471 LDKExpiryTime this_arg_conv;
30472 this_arg_conv.inner = (void*)(this_arg & (~1));
30473 this_arg_conv.is_owned = false;
30474 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
30478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
30479 LDKRouteHint hops_conv;
30480 hops_conv.inner = (void*)(hops & (~1));
30481 hops_conv.is_owned = (hops & 1) || (hops == 0);
30482 hops_conv = RouteHint_clone(&hops_conv);
30483 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30484 *ret_conv = PrivateRoute_new(hops_conv);
30485 return (uint64_t)ret_conv;
30488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
30489 LDKPrivateRoute this_arg_conv;
30490 this_arg_conv.inner = (void*)(this_arg & (~1));
30491 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30492 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
30493 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
30494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30496 uint64_t ret_ref = (uint64_t)ret_var.inner;
30497 if (ret_var.is_owned) {
30503 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30504 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
30505 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
30509 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
30510 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
30514 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
30515 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
30519 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
30520 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
30524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
30525 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
30529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30530 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
30531 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
30532 jboolean ret_val = CreationError_eq(a_conv, b_conv);
30536 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30537 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
30538 LDKStr ret_str = CreationError_to_str(o_conv);
30539 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30544 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30545 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
30546 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
30550 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
30551 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
30555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
30556 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
30560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
30561 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
30565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
30566 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
30570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
30571 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
30575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
30576 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
30580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
30581 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
30585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
30586 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
30590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
30591 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
30595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
30596 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
30600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30601 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
30602 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
30603 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
30607 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30608 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
30609 LDKStr ret_str = SemanticError_to_str(o_conv);
30610 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30616 if ((this_ptr & 1) != 0) return;
30617 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
30618 FREE((void*)this_ptr);
30619 SignOrCreationError_free(this_ptr_conv);
30622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30623 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
30624 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30625 *ret_copy = SignOrCreationError_clone(orig_conv);
30626 uint64_t ret_ref = (uint64_t)ret_copy;
30630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
30631 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30632 *ret_copy = SignOrCreationError_sign_error();
30633 uint64_t ret_ref = (uint64_t)ret_copy;
30637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
30638 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
30639 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
30640 *ret_copy = SignOrCreationError_creation_error(a_conv);
30641 uint64_t ret_ref = (uint64_t)ret_copy;
30645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30646 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
30647 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
30648 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
30652 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30653 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
30654 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
30655 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) {
30661 LDKChannelManager channelmanager_conv;
30662 channelmanager_conv.inner = (void*)(channelmanager & (~1));
30663 channelmanager_conv.is_owned = false;
30664 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
30665 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30666 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30667 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30669 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
30670 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
30671 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
30672 LDKStr description_conv = java_to_owned_str(env, description);
30673 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
30674 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
30675 return (uint64_t)ret_conv;
30678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
30679 LDKStr s_conv = java_to_owned_str(env, s);
30680 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
30681 *ret_conv = SiPrefix_from_str(s_conv);
30682 return (uint64_t)ret_conv;
30685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
30686 LDKStr s_conv = java_to_owned_str(env, s);
30687 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
30688 *ret_conv = Invoice_from_str(s_conv);
30689 return (uint64_t)ret_conv;
30692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
30693 LDKStr s_conv = java_to_owned_str(env, s);
30694 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
30695 *ret_conv = SignedRawInvoice_from_str(s_conv);
30696 return (uint64_t)ret_conv;
30699 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30701 o_conv.inner = (void*)(o & (~1));
30702 o_conv.is_owned = false;
30703 LDKStr ret_str = Invoice_to_str(&o_conv);
30704 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30709 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30710 LDKSignedRawInvoice o_conv;
30711 o_conv.inner = (void*)(o & (~1));
30712 o_conv.is_owned = false;
30713 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
30714 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30719 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30720 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
30721 LDKStr ret_str = Currency_to_str(o_conv);
30722 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30727 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
30728 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
30729 LDKStr ret_str = SiPrefix_to_str(o_conv);
30730 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);