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 CHECK_ACCESS(p)
14 #define DO_ASSERT(a) (void)(a)
17 static jmethodID ordinal_meth = NULL;
18 static jmethodID slicedef_meth = NULL;
19 static jclass slicedef_cls = NULL;
20 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
21 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
22 CHECK(ordinal_meth != NULL);
23 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
24 CHECK(slicedef_meth != NULL);
25 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
26 CHECK(slicedef_cls != NULL);
29 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
32 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
35 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
38 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
39 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
40 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
43 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
44 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
45 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
46 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
49 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
50 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
51 vec->datalen = (*env)->GetArrayLength(env, bytes);
52 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
53 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
56 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
57 LDKTransaction *txdata = (LDKTransaction*)ptr;
59 slice.data = txdata->data;
60 slice.datalen = txdata->datalen;
61 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
63 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
64 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
65 txdata->datalen = (*env)->GetArrayLength(env, bytes);
66 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
67 txdata->data_is_owned = false;
68 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
69 return (uint64_t)txdata;
71 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
72 LDKTransaction *tx = (LDKTransaction*)ptr;
73 tx->data_is_owned = true;
74 Transaction_free(*tx);
77 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
78 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
82 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
83 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
84 return (uint64_t)vec->datalen;
86 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
87 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
91 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
92 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
98 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
99 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
100 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
101 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
103 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
104 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
105 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
107 typedef jlongArray int64_tArray;
108 typedef jbyteArray int8_tArray;
110 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
111 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
112 char* conv_buf = MALLOC(len + 1, "str conv buf");
113 memcpy(conv_buf, chars, len);
115 jstring ret = (*env)->NewStringUTF(env, conv_buf);
119 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
120 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
121 char* newchars = MALLOC(str_len + 1, "String chars");
122 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
123 memcpy(newchars, jchars, str_len);
124 newchars[str_len] = 0;
125 (*env)->ReleaseStringUTFChars(env, str, jchars);
129 .chars_is_owned = true
134 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
135 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
137 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
138 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
141 static jclass arr_of_B_clz = NULL;
142 static jclass arr_of_J_clz = NULL;
143 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
144 arr_of_B_clz = (*env)->FindClass(env, "[B");
145 CHECK(arr_of_B_clz != NULL);
146 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
147 arr_of_J_clz = (*env)->FindClass(env, "[J");
148 CHECK(arr_of_J_clz != NULL);
149 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
151 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
152 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
153 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
154 case 0: return LDKAccessError_UnknownChain;
155 case 1: return LDKAccessError_UnknownTx;
159 static jclass AccessError_class = NULL;
160 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
161 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
162 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
163 AccessError_class = (*env)->NewGlobalRef(env, clz);
164 CHECK(AccessError_class != NULL);
165 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
166 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
167 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
168 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
170 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
172 case LDKAccessError_UnknownChain:
173 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
174 case LDKAccessError_UnknownTx:
175 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
180 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
181 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
182 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
183 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
187 static jclass ChannelMonitorUpdateErr_class = NULL;
188 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
189 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
190 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
191 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
192 CHECK(ChannelMonitorUpdateErr_class != NULL);
193 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
194 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
195 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
196 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
198 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
200 case LDKChannelMonitorUpdateErr_TemporaryFailure:
201 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
202 case LDKChannelMonitorUpdateErr_PermanentFailure:
203 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
208 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
209 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
210 case 0: return LDKConfirmationTarget_Background;
211 case 1: return LDKConfirmationTarget_Normal;
212 case 2: return LDKConfirmationTarget_HighPriority;
216 static jclass ConfirmationTarget_class = NULL;
217 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
219 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
220 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
221 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
222 CHECK(ConfirmationTarget_class != NULL);
223 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
224 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
225 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
226 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
227 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
228 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
230 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
232 case LDKConfirmationTarget_Background:
233 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
234 case LDKConfirmationTarget_Normal:
235 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
236 case LDKConfirmationTarget_HighPriority:
237 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
242 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
243 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
244 case 0: return LDKCreationError_DescriptionTooLong;
245 case 1: return LDKCreationError_RouteTooLong;
246 case 2: return LDKCreationError_TimestampOutOfBounds;
247 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
251 static jclass CreationError_class = NULL;
252 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
253 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
254 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
255 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
256 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
257 CreationError_class = (*env)->NewGlobalRef(env, clz);
258 CHECK(CreationError_class != NULL);
259 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
260 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
261 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
262 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
263 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
264 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
265 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
266 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
268 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
270 case LDKCreationError_DescriptionTooLong:
271 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
272 case LDKCreationError_RouteTooLong:
273 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
274 case LDKCreationError_TimestampOutOfBounds:
275 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
276 case LDKCreationError_ExpiryTimeOutOfBounds:
277 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
282 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
283 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
284 case 0: return LDKCurrency_Bitcoin;
285 case 1: return LDKCurrency_BitcoinTestnet;
286 case 2: return LDKCurrency_Regtest;
287 case 3: return LDKCurrency_Simnet;
288 case 4: return LDKCurrency_Signet;
292 static jclass Currency_class = NULL;
293 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
294 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
295 static jfieldID Currency_LDKCurrency_Regtest = NULL;
296 static jfieldID Currency_LDKCurrency_Simnet = NULL;
297 static jfieldID Currency_LDKCurrency_Signet = NULL;
298 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
299 Currency_class = (*env)->NewGlobalRef(env, clz);
300 CHECK(Currency_class != NULL);
301 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
302 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
303 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
304 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
305 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
306 CHECK(Currency_LDKCurrency_Regtest != NULL);
307 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
308 CHECK(Currency_LDKCurrency_Simnet != NULL);
309 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
310 CHECK(Currency_LDKCurrency_Signet != NULL);
312 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
314 case LDKCurrency_Bitcoin:
315 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
316 case LDKCurrency_BitcoinTestnet:
317 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
318 case LDKCurrency_Regtest:
319 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
320 case LDKCurrency_Simnet:
321 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
322 case LDKCurrency_Signet:
323 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
328 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
329 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
330 case 0: return LDKIOError_NotFound;
331 case 1: return LDKIOError_PermissionDenied;
332 case 2: return LDKIOError_ConnectionRefused;
333 case 3: return LDKIOError_ConnectionReset;
334 case 4: return LDKIOError_ConnectionAborted;
335 case 5: return LDKIOError_NotConnected;
336 case 6: return LDKIOError_AddrInUse;
337 case 7: return LDKIOError_AddrNotAvailable;
338 case 8: return LDKIOError_BrokenPipe;
339 case 9: return LDKIOError_AlreadyExists;
340 case 10: return LDKIOError_WouldBlock;
341 case 11: return LDKIOError_InvalidInput;
342 case 12: return LDKIOError_InvalidData;
343 case 13: return LDKIOError_TimedOut;
344 case 14: return LDKIOError_WriteZero;
345 case 15: return LDKIOError_Interrupted;
346 case 16: return LDKIOError_Other;
347 case 17: return LDKIOError_UnexpectedEof;
351 static jclass IOError_class = NULL;
352 static jfieldID IOError_LDKIOError_NotFound = NULL;
353 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
354 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
356 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
357 static jfieldID IOError_LDKIOError_NotConnected = NULL;
358 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
359 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
360 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
361 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
362 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
363 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
364 static jfieldID IOError_LDKIOError_InvalidData = NULL;
365 static jfieldID IOError_LDKIOError_TimedOut = NULL;
366 static jfieldID IOError_LDKIOError_WriteZero = NULL;
367 static jfieldID IOError_LDKIOError_Interrupted = NULL;
368 static jfieldID IOError_LDKIOError_Other = NULL;
369 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
370 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
371 IOError_class = (*env)->NewGlobalRef(env, clz);
372 CHECK(IOError_class != NULL);
373 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
374 CHECK(IOError_LDKIOError_NotFound != NULL);
375 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
376 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
377 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
378 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
379 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
380 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
381 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
382 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
383 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
384 CHECK(IOError_LDKIOError_NotConnected != NULL);
385 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
386 CHECK(IOError_LDKIOError_AddrInUse != NULL);
387 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
388 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
389 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
390 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
391 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
392 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
393 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
394 CHECK(IOError_LDKIOError_WouldBlock != NULL);
395 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
396 CHECK(IOError_LDKIOError_InvalidInput != NULL);
397 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
398 CHECK(IOError_LDKIOError_InvalidData != NULL);
399 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
400 CHECK(IOError_LDKIOError_TimedOut != NULL);
401 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
402 CHECK(IOError_LDKIOError_WriteZero != NULL);
403 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
404 CHECK(IOError_LDKIOError_Interrupted != NULL);
405 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
406 CHECK(IOError_LDKIOError_Other != NULL);
407 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
408 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
410 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
412 case LDKIOError_NotFound:
413 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
414 case LDKIOError_PermissionDenied:
415 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
416 case LDKIOError_ConnectionRefused:
417 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
418 case LDKIOError_ConnectionReset:
419 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
420 case LDKIOError_ConnectionAborted:
421 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
422 case LDKIOError_NotConnected:
423 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
424 case LDKIOError_AddrInUse:
425 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
426 case LDKIOError_AddrNotAvailable:
427 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
428 case LDKIOError_BrokenPipe:
429 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
430 case LDKIOError_AlreadyExists:
431 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
432 case LDKIOError_WouldBlock:
433 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
434 case LDKIOError_InvalidInput:
435 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
436 case LDKIOError_InvalidData:
437 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
438 case LDKIOError_TimedOut:
439 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
440 case LDKIOError_WriteZero:
441 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
442 case LDKIOError_Interrupted:
443 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
444 case LDKIOError_Other:
445 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
446 case LDKIOError_UnexpectedEof:
447 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
452 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
453 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
454 case 0: return LDKLevel_Trace;
455 case 1: return LDKLevel_Debug;
456 case 2: return LDKLevel_Info;
457 case 3: return LDKLevel_Warn;
458 case 4: return LDKLevel_Error;
462 static jclass Level_class = NULL;
463 static jfieldID Level_LDKLevel_Trace = NULL;
464 static jfieldID Level_LDKLevel_Debug = NULL;
465 static jfieldID Level_LDKLevel_Info = NULL;
466 static jfieldID Level_LDKLevel_Warn = NULL;
467 static jfieldID Level_LDKLevel_Error = NULL;
468 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
469 Level_class = (*env)->NewGlobalRef(env, clz);
470 CHECK(Level_class != NULL);
471 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
472 CHECK(Level_LDKLevel_Trace != NULL);
473 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
474 CHECK(Level_LDKLevel_Debug != NULL);
475 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
476 CHECK(Level_LDKLevel_Info != NULL);
477 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
478 CHECK(Level_LDKLevel_Warn != NULL);
479 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
480 CHECK(Level_LDKLevel_Error != NULL);
482 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
485 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
487 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
489 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
491 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
493 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
498 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
499 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
500 case 0: return LDKNetwork_Bitcoin;
501 case 1: return LDKNetwork_Testnet;
502 case 2: return LDKNetwork_Regtest;
503 case 3: return LDKNetwork_Signet;
507 static jclass Network_class = NULL;
508 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
509 static jfieldID Network_LDKNetwork_Testnet = NULL;
510 static jfieldID Network_LDKNetwork_Regtest = NULL;
511 static jfieldID Network_LDKNetwork_Signet = NULL;
512 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
513 Network_class = (*env)->NewGlobalRef(env, clz);
514 CHECK(Network_class != NULL);
515 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
516 CHECK(Network_LDKNetwork_Bitcoin != NULL);
517 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
518 CHECK(Network_LDKNetwork_Testnet != NULL);
519 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
520 CHECK(Network_LDKNetwork_Regtest != NULL);
521 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
522 CHECK(Network_LDKNetwork_Signet != NULL);
524 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
526 case LDKNetwork_Bitcoin:
527 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
528 case LDKNetwork_Testnet:
529 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
530 case LDKNetwork_Regtest:
531 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
532 case LDKNetwork_Signet:
533 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
538 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
539 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
540 case 0: return LDKSecp256k1Error_IncorrectSignature;
541 case 1: return LDKSecp256k1Error_InvalidMessage;
542 case 2: return LDKSecp256k1Error_InvalidPublicKey;
543 case 3: return LDKSecp256k1Error_InvalidSignature;
544 case 4: return LDKSecp256k1Error_InvalidSecretKey;
545 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
546 case 6: return LDKSecp256k1Error_InvalidTweak;
547 case 7: return LDKSecp256k1Error_TweakCheckFailed;
548 case 8: return LDKSecp256k1Error_NotEnoughMemory;
552 static jclass Secp256k1Error_class = NULL;
553 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
554 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
562 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
563 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
564 CHECK(Secp256k1Error_class != NULL);
565 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
566 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
567 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
568 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
569 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
570 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
571 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
572 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
573 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
574 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
575 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
576 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
577 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
578 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
579 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
580 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
581 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
582 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
584 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
586 case LDKSecp256k1Error_IncorrectSignature:
587 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
588 case LDKSecp256k1Error_InvalidMessage:
589 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
590 case LDKSecp256k1Error_InvalidPublicKey:
591 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
592 case LDKSecp256k1Error_InvalidSignature:
593 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
594 case LDKSecp256k1Error_InvalidSecretKey:
595 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
596 case LDKSecp256k1Error_InvalidRecoveryId:
597 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
598 case LDKSecp256k1Error_InvalidTweak:
599 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
600 case LDKSecp256k1Error_TweakCheckFailed:
601 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
602 case LDKSecp256k1Error_NotEnoughMemory:
603 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
608 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
609 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
610 case 0: return LDKSemanticError_NoPaymentHash;
611 case 1: return LDKSemanticError_MultiplePaymentHashes;
612 case 2: return LDKSemanticError_NoDescription;
613 case 3: return LDKSemanticError_MultipleDescriptions;
614 case 4: return LDKSemanticError_NoPaymentSecret;
615 case 5: return LDKSemanticError_MultiplePaymentSecrets;
616 case 6: return LDKSemanticError_InvalidFeatures;
617 case 7: return LDKSemanticError_InvalidRecoveryId;
618 case 8: return LDKSemanticError_InvalidSignature;
619 case 9: return LDKSemanticError_ImpreciseAmount;
623 static jclass SemanticError_class = NULL;
624 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
625 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
626 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
627 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
628 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
629 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
630 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
632 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
633 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
634 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
635 SemanticError_class = (*env)->NewGlobalRef(env, clz);
636 CHECK(SemanticError_class != NULL);
637 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
638 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
639 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
640 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
641 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
642 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
643 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
644 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
645 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
646 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
647 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
648 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
649 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
650 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
651 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
652 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
653 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
654 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
655 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
656 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
658 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
660 case LDKSemanticError_NoPaymentHash:
661 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
662 case LDKSemanticError_MultiplePaymentHashes:
663 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
664 case LDKSemanticError_NoDescription:
665 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
666 case LDKSemanticError_MultipleDescriptions:
667 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
668 case LDKSemanticError_NoPaymentSecret:
669 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
670 case LDKSemanticError_MultiplePaymentSecrets:
671 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
672 case LDKSemanticError_InvalidFeatures:
673 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
674 case LDKSemanticError_InvalidRecoveryId:
675 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
676 case LDKSemanticError_InvalidSignature:
677 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
678 case LDKSemanticError_ImpreciseAmount:
679 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
684 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
685 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
686 case 0: return LDKSiPrefix_Milli;
687 case 1: return LDKSiPrefix_Micro;
688 case 2: return LDKSiPrefix_Nano;
689 case 3: return LDKSiPrefix_Pico;
693 static jclass SiPrefix_class = NULL;
694 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
695 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
696 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
697 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
698 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
699 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
700 CHECK(SiPrefix_class != NULL);
701 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
702 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
703 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
704 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
705 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
706 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
707 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
708 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
710 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
712 case LDKSiPrefix_Milli:
713 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
714 case LDKSiPrefix_Micro:
715 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
716 case LDKSiPrefix_Nano:
717 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
718 case LDKSiPrefix_Pico:
719 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
725 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
726 ret->datalen = (*env)->GetArrayLength(env, elems);
727 if (ret->datalen == 0) {
730 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
731 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
732 for (size_t i = 0; i < ret->datalen; i++) {
733 ret->data[i] = java_elems[i];
735 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
737 return (uint64_t)ret;
739 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
740 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
741 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
744 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) {
745 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
746 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
747 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
748 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
749 CVec_u8Z_free(ret_var);
753 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) {
754 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
755 int64_t ret_val = TxOut_get_value(thing_conv);
759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
760 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
763 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
764 CHECK(val->result_ok);
765 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
766 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
770 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
771 CHECK(!val->result_ok);
772 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
776 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
779 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
780 CHECK(val->result_ok);
781 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
782 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
786 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
787 CHECK(!val->result_ok);
788 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
792 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
795 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
796 CHECK(val->result_ok);
797 LDKTxCreationKeys res_var = (*val->contents.result);
798 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
800 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
804 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
805 CHECK(!val->result_ok);
806 LDKDecodeError err_var = (*val->contents.err);
807 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
808 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
809 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
813 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
816 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
817 CHECK(val->result_ok);
818 LDKChannelPublicKeys res_var = (*val->contents.result);
819 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
820 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
821 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
825 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
826 CHECK(!val->result_ok);
827 LDKDecodeError err_var = (*val->contents.err);
828 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
829 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
830 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
834 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
837 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
838 CHECK(val->result_ok);
839 LDKTxCreationKeys res_var = (*val->contents.result);
840 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
846 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
847 CHECK(!val->result_ok);
848 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
851 static jclass LDKCOption_u32Z_Some_class = NULL;
852 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
853 static jclass LDKCOption_u32Z_None_class = NULL;
854 static jmethodID LDKCOption_u32Z_None_meth = NULL;
855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
856 LDKCOption_u32Z_Some_class =
857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
858 CHECK(LDKCOption_u32Z_Some_class != NULL);
859 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
860 CHECK(LDKCOption_u32Z_Some_meth != NULL);
861 LDKCOption_u32Z_None_class =
862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
863 CHECK(LDKCOption_u32Z_None_class != NULL);
864 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
865 CHECK(LDKCOption_u32Z_None_meth != NULL);
867 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
868 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
870 case LDKCOption_u32Z_Some: {
871 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
873 case LDKCOption_u32Z_None: {
874 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
880 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
883 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
884 CHECK(val->result_ok);
885 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
886 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
887 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
888 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
892 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
893 CHECK(!val->result_ok);
894 LDKDecodeError err_var = (*val->contents.err);
895 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
896 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
897 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
901 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
904 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
905 CHECK(val->result_ok);
906 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
907 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
908 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
909 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
913 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
914 CHECK(!val->result_ok);
915 LDKDecodeError err_var = (*val->contents.err);
916 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
917 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
918 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
922 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
925 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
926 CHECK(val->result_ok);
927 LDKChannelTransactionParameters res_var = (*val->contents.result);
928 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
934 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
935 CHECK(!val->result_ok);
936 LDKDecodeError err_var = (*val->contents.err);
937 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
943 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
946 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
947 CHECK(val->result_ok);
948 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
949 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
955 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
956 CHECK(!val->result_ok);
957 LDKDecodeError err_var = (*val->contents.err);
958 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
959 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
960 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
964 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
967 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
968 CHECK(val->result_ok);
969 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
970 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
976 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
977 CHECK(!val->result_ok);
978 LDKDecodeError err_var = (*val->contents.err);
979 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
980 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
981 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
985 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
988 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
989 CHECK(val->result_ok);
990 LDKTrustedClosingTransaction res_var = (*val->contents.result);
991 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
992 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
993 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
997 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
998 CHECK(!val->result_ok);
999 return *val->contents.err;
1001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1002 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1006 CHECK(val->result_ok);
1007 LDKCommitmentTransaction res_var = (*val->contents.result);
1008 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1009 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1010 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1014 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1015 CHECK(!val->result_ok);
1016 LDKDecodeError err_var = (*val->contents.err);
1017 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1018 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1019 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1023 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1026 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1027 CHECK(val->result_ok);
1028 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1029 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1030 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1031 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1035 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1036 CHECK(!val->result_ok);
1037 return *val->contents.err;
1039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1040 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1042 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1044 CHECK(val->result_ok);
1045 LDKCVec_SignatureZ res_var = (*val->contents.result);
1046 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1048 for (size_t i = 0; i < res_var.datalen; i++) {
1049 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1050 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1051 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1056 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1057 CHECK(!val->result_ok);
1058 return *val->contents.err;
1060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1061 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1064 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1065 CHECK(val->result_ok);
1066 LDKShutdownScript res_var = (*val->contents.result);
1067 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1068 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1069 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1073 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1074 CHECK(!val->result_ok);
1075 LDKDecodeError err_var = (*val->contents.err);
1076 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1077 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1078 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1082 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1085 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1086 CHECK(val->result_ok);
1087 LDKShutdownScript res_var = (*val->contents.result);
1088 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1089 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1090 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1094 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1095 CHECK(!val->result_ok);
1096 LDKInvalidShutdownScript err_var = (*val->contents.err);
1097 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1098 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1099 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1103 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1106 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1107 CHECK(val->result_ok);
1108 return *val->contents.result;
1110 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1111 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1112 CHECK(!val->result_ok);
1113 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1117 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1120 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1121 CHECK(val->result_ok);
1122 LDKRouteHop res_var = (*val->contents.result);
1123 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1124 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1125 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1129 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1130 CHECK(!val->result_ok);
1131 LDKDecodeError err_var = (*val->contents.err);
1132 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1133 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1138 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1139 ret->datalen = (*env)->GetArrayLength(env, elems);
1140 if (ret->datalen == 0) {
1143 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1144 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1145 for (size_t i = 0; i < ret->datalen; i++) {
1146 int64_t arr_elem = java_elems[i];
1147 LDKRouteHop arr_elem_conv;
1148 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1149 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1150 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1151 ret->data[i] = arr_elem_conv;
1153 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1155 return (uint64_t)ret;
1157 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1158 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1159 for (size_t i = 0; i < ret.datalen; i++) {
1160 ret.data[i] = RouteHop_clone(&orig->data[i]);
1164 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1165 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1166 for (size_t i = 0; i < ret.datalen; i++) {
1167 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1172 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1175 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1176 CHECK(val->result_ok);
1177 LDKRoute res_var = (*val->contents.result);
1178 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1179 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1180 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1184 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1185 CHECK(!val->result_ok);
1186 LDKDecodeError err_var = (*val->contents.err);
1187 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1188 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1189 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1192 static jclass LDKCOption_u64Z_Some_class = NULL;
1193 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1194 static jclass LDKCOption_u64Z_None_class = NULL;
1195 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1197 LDKCOption_u64Z_Some_class =
1198 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1199 CHECK(LDKCOption_u64Z_Some_class != NULL);
1200 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1201 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1202 LDKCOption_u64Z_None_class =
1203 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1204 CHECK(LDKCOption_u64Z_None_class != NULL);
1205 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1206 CHECK(LDKCOption_u64Z_None_meth != NULL);
1208 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1209 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1211 case LDKCOption_u64Z_Some: {
1212 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1214 case LDKCOption_u64Z_None: {
1215 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1221 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1222 ret->datalen = (*env)->GetArrayLength(env, elems);
1223 if (ret->datalen == 0) {
1226 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1227 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1228 for (size_t i = 0; i < ret->datalen; i++) {
1229 int64_t arr_elem = java_elems[i];
1230 LDKChannelDetails arr_elem_conv;
1231 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1232 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1233 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1234 ret->data[i] = arr_elem_conv;
1236 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1238 return (uint64_t)ret;
1240 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1241 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1242 for (size_t i = 0; i < ret.datalen; i++) {
1243 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1248 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1249 ret->datalen = (*env)->GetArrayLength(env, elems);
1250 if (ret->datalen == 0) {
1253 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1254 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1255 for (size_t i = 0; i < ret->datalen; i++) {
1256 int64_t arr_elem = java_elems[i];
1257 LDKRouteHint arr_elem_conv;
1258 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1259 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1260 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1261 ret->data[i] = arr_elem_conv;
1263 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1265 return (uint64_t)ret;
1267 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1268 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1269 for (size_t i = 0; i < ret.datalen; i++) {
1270 ret.data[i] = RouteHint_clone(&orig->data[i]);
1274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1275 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1278 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1279 CHECK(val->result_ok);
1280 LDKRoute res_var = (*val->contents.result);
1281 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1282 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1283 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1287 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1288 CHECK(!val->result_ok);
1289 LDKLightningError err_var = (*val->contents.err);
1290 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1291 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1292 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1296 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1299 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1300 CHECK(val->result_ok);
1301 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1302 return (uint64_t)res_ref;
1304 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1305 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1306 CHECK(!val->result_ok);
1307 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1310 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
1314 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1315 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1319 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
1323 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1324 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1325 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1326 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1327 Transaction_free(ret_var);
1331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1332 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1333 ret->datalen = (*env)->GetArrayLength(env, elems);
1334 if (ret->datalen == 0) {
1337 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1338 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1339 for (size_t i = 0; i < ret->datalen; i++) {
1340 int64_t arr_elem = java_elems[i];
1341 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1342 CHECK_ACCESS(arr_elem_ptr);
1343 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(arr_elem_ptr);
1344 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1345 ret->data[i] = arr_elem_conv;
1347 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1349 return (uint64_t)ret;
1351 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1352 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1353 for (size_t i = 0; i < ret.datalen; i++) {
1354 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1358 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1359 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1360 for (size_t i = 0; i < ret.datalen; i++) {
1361 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1366 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1369 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1370 CHECK(val->result_ok);
1371 return *val->contents.result;
1373 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1374 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1375 CHECK(!val->result_ok);
1376 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1379 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1380 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1381 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1382 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1384 LDKMonitorEvent_HTLCEvent_class =
1385 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1386 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1387 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1388 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1389 LDKMonitorEvent_CommitmentTxConfirmed_class =
1390 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1391 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1392 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1393 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1395 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1396 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1398 case LDKMonitorEvent_HTLCEvent: {
1399 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1400 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1401 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1402 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1403 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1405 case LDKMonitorEvent_CommitmentTxConfirmed: {
1406 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1407 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1410 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1416 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1417 ret->datalen = (*env)->GetArrayLength(env, elems);
1418 if (ret->datalen == 0) {
1421 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1422 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1423 for (size_t i = 0; i < ret->datalen; i++) {
1424 int64_t arr_elem = java_elems[i];
1425 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1426 CHECK_ACCESS(arr_elem_ptr);
1427 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(arr_elem_ptr);
1428 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1429 ret->data[i] = arr_elem_conv;
1431 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1433 return (uint64_t)ret;
1435 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1436 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1437 for (size_t i = 0; i < ret.datalen; i++) {
1438 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1442 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1443 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1444 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1445 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1447 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1448 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1449 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1450 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1451 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1452 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1453 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1454 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1455 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1456 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1458 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1459 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1461 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1462 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1463 *some_conv = obj->some;
1464 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1465 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uint64_t)some_conv));
1467 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1468 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1473 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1474 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1475 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1476 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1477 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1478 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1480 LDKNetworkUpdate_ChannelUpdateMessage_class =
1481 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1482 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1483 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1484 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1485 LDKNetworkUpdate_ChannelClosed_class =
1486 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1487 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1488 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1489 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1490 LDKNetworkUpdate_NodeFailure_class =
1491 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1492 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1493 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1494 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1496 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1497 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1499 case LDKNetworkUpdate_ChannelUpdateMessage: {
1500 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1501 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1502 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1503 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1504 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1506 case LDKNetworkUpdate_ChannelClosed: {
1507 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1509 case LDKNetworkUpdate_NodeFailure: {
1510 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1511 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1512 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1517 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1518 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1519 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1520 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1522 LDKCOption_NetworkUpdateZ_Some_class =
1523 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1524 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1525 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1526 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1527 LDKCOption_NetworkUpdateZ_None_class =
1528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1529 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1530 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1531 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1533 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1534 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1536 case LDKCOption_NetworkUpdateZ_Some: {
1537 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1538 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1540 case LDKCOption_NetworkUpdateZ_None: {
1541 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1546 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1547 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1548 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1549 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1550 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1551 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1553 LDKSpendableOutputDescriptor_StaticOutput_class =
1554 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1555 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1556 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1557 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1558 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1559 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1560 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1561 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1562 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1563 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1564 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1565 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1566 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1567 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1569 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1570 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1572 case LDKSpendableOutputDescriptor_StaticOutput: {
1573 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1574 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1575 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1576 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1577 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1578 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1580 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1581 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1582 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1583 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1584 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1585 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1587 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1588 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1589 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1590 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1591 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1592 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1598 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1599 ret->datalen = (*env)->GetArrayLength(env, elems);
1600 if (ret->datalen == 0) {
1603 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1604 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1605 for (size_t i = 0; i < ret->datalen; i++) {
1606 int64_t arr_elem = java_elems[i];
1607 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1608 CHECK_ACCESS(arr_elem_ptr);
1609 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(arr_elem_ptr);
1610 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1611 ret->data[i] = arr_elem_conv;
1613 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1615 return (uint64_t)ret;
1617 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1618 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1619 for (size_t i = 0; i < ret.datalen; i++) {
1620 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1624 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1625 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1626 static jclass LDKErrorAction_IgnoreError_class = NULL;
1627 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1628 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1629 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1630 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1631 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1633 LDKErrorAction_DisconnectPeer_class =
1634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1635 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1636 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1637 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1638 LDKErrorAction_IgnoreError_class =
1639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1640 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1641 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1642 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1643 LDKErrorAction_IgnoreAndLog_class =
1644 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1645 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1646 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1647 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1648 LDKErrorAction_SendErrorMessage_class =
1649 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1650 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1651 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1652 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1654 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1655 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1657 case LDKErrorAction_DisconnectPeer: {
1658 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1659 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1660 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1661 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1662 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1664 case LDKErrorAction_IgnoreError: {
1665 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1667 case LDKErrorAction_IgnoreAndLog: {
1668 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1669 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1671 case LDKErrorAction_SendErrorMessage: {
1672 LDKErrorMessage msg_var = obj->send_error_message.msg;
1673 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1674 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1675 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1676 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1681 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1682 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1683 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1684 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1685 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1686 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1687 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1688 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1689 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1690 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1691 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1692 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1693 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1694 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1695 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1696 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1697 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1698 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1699 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1700 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1701 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1702 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1703 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1704 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1705 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1706 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1707 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1708 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1709 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1710 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1711 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1712 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1713 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1714 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1715 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1716 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1717 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1718 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1720 LDKMessageSendEvent_SendAcceptChannel_class =
1721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1722 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1723 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1724 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1725 LDKMessageSendEvent_SendOpenChannel_class =
1726 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1727 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1728 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1729 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1730 LDKMessageSendEvent_SendFundingCreated_class =
1731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1732 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1733 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1734 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1735 LDKMessageSendEvent_SendFundingSigned_class =
1736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1737 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1738 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1739 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1740 LDKMessageSendEvent_SendFundingLocked_class =
1741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1742 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1743 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1744 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1745 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1747 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1748 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1749 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1750 LDKMessageSendEvent_UpdateHTLCs_class =
1751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1752 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1753 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1754 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1755 LDKMessageSendEvent_SendRevokeAndACK_class =
1756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1757 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1758 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1759 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1760 LDKMessageSendEvent_SendClosingSigned_class =
1761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1762 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1763 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1764 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1765 LDKMessageSendEvent_SendShutdown_class =
1766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1767 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1768 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1769 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1770 LDKMessageSendEvent_SendChannelReestablish_class =
1771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1772 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1773 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1774 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1775 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1777 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1778 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1779 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1780 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1782 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1783 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1784 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1785 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1787 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1788 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1789 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1790 LDKMessageSendEvent_SendChannelUpdate_class =
1791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1792 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1793 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1794 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1795 LDKMessageSendEvent_HandleError_class =
1796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1797 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1798 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1799 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1800 LDKMessageSendEvent_SendChannelRangeQuery_class =
1801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1802 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1803 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1804 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1805 LDKMessageSendEvent_SendShortIdsQuery_class =
1806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1807 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1808 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1809 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1810 LDKMessageSendEvent_SendReplyChannelRange_class =
1811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1812 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1813 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1814 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1816 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1817 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1819 case LDKMessageSendEvent_SendAcceptChannel: {
1820 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1821 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1822 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1823 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1824 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1825 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1826 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1828 case LDKMessageSendEvent_SendOpenChannel: {
1829 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1830 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1831 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1832 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1833 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1834 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1835 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1837 case LDKMessageSendEvent_SendFundingCreated: {
1838 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1839 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1840 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1841 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1842 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1843 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1844 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1846 case LDKMessageSendEvent_SendFundingSigned: {
1847 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1848 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1849 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1850 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1851 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1852 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1853 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1855 case LDKMessageSendEvent_SendFundingLocked: {
1856 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1857 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1858 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1859 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1860 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1861 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1862 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1864 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1865 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1866 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1867 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1868 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1869 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1870 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1871 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1873 case LDKMessageSendEvent_UpdateHTLCs: {
1874 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1875 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1876 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1877 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1878 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1879 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1880 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1882 case LDKMessageSendEvent_SendRevokeAndACK: {
1883 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1884 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1885 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1886 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1887 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1888 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1889 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1891 case LDKMessageSendEvent_SendClosingSigned: {
1892 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1893 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1894 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1895 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1898 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1900 case LDKMessageSendEvent_SendShutdown: {
1901 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1902 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1903 LDKShutdown msg_var = obj->send_shutdown.msg;
1904 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1905 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1906 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1907 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1909 case LDKMessageSendEvent_SendChannelReestablish: {
1910 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1911 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1912 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1913 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1914 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1915 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1916 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1918 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1919 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1920 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1921 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1922 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1923 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1924 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1925 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1926 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1927 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1929 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1930 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1931 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1932 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1933 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1934 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1936 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1937 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1938 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1939 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1940 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1941 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1943 case LDKMessageSendEvent_SendChannelUpdate: {
1944 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1945 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1946 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1947 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1948 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1949 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1950 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1952 case LDKMessageSendEvent_HandleError: {
1953 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1954 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1955 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1956 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1958 case LDKMessageSendEvent_SendChannelRangeQuery: {
1959 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1960 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1961 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1962 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1963 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1964 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1965 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1967 case LDKMessageSendEvent_SendShortIdsQuery: {
1968 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1969 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1970 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1971 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1972 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1973 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1974 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1976 case LDKMessageSendEvent_SendReplyChannelRange: {
1977 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1978 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1979 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1980 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1981 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1982 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1983 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1989 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1990 ret->datalen = (*env)->GetArrayLength(env, elems);
1991 if (ret->datalen == 0) {
1994 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1995 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1996 for (size_t i = 0; i < ret->datalen; i++) {
1997 int64_t arr_elem = java_elems[i];
1998 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1999 CHECK_ACCESS(arr_elem_ptr);
2000 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(arr_elem_ptr);
2001 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
2002 ret->data[i] = arr_elem_conv;
2004 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2006 return (uint64_t)ret;
2008 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2009 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2010 for (size_t i = 0; i < ret.datalen; i++) {
2011 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2016 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2019 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2020 CHECK(val->result_ok);
2021 LDKInitFeatures res_var = (*val->contents.result);
2022 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2023 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2024 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2028 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2029 CHECK(!val->result_ok);
2030 LDKDecodeError err_var = (*val->contents.err);
2031 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2032 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2033 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2037 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2040 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2041 CHECK(val->result_ok);
2042 LDKNodeFeatures res_var = (*val->contents.result);
2043 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2044 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2045 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2049 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2050 CHECK(!val->result_ok);
2051 LDKDecodeError err_var = (*val->contents.err);
2052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2058 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2061 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2062 CHECK(val->result_ok);
2063 LDKChannelFeatures res_var = (*val->contents.result);
2064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2070 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2071 CHECK(!val->result_ok);
2072 LDKDecodeError err_var = (*val->contents.err);
2073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2079 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2082 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2083 CHECK(val->result_ok);
2084 LDKInvoiceFeatures res_var = (*val->contents.result);
2085 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2086 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2087 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2091 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2092 CHECK(!val->result_ok);
2093 LDKDecodeError err_var = (*val->contents.err);
2094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2100 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2103 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2104 CHECK(val->result_ok);
2105 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2106 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2107 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2108 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2112 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2113 CHECK(!val->result_ok);
2114 LDKDecodeError err_var = (*val->contents.err);
2115 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2116 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2117 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2121 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2124 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2125 CHECK(val->result_ok);
2126 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2127 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2128 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2129 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2133 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2134 CHECK(!val->result_ok);
2135 LDKDecodeError err_var = (*val->contents.err);
2136 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2137 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2138 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2142 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2145 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2146 CHECK(val->result_ok);
2147 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2151 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2152 CHECK(!val->result_ok);
2153 LDKDecodeError err_var = (*val->contents.err);
2154 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2155 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2156 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2160 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2163 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2164 CHECK(val->result_ok);
2165 return *val->contents.result;
2167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2168 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2169 CHECK(!val->result_ok);
2170 return *val->contents.err;
2172 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
2176 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2177 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form);
2182 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2185 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
2186 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2187 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
2188 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2190 for (size_t i = 0; i < ret_var.datalen; i++) {
2191 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2192 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2193 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2200 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2203 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2204 CHECK(val->result_ok);
2205 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2206 *res_conv = (*val->contents.result);
2207 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
2208 return ((uint64_t)res_conv);
2210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2211 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2212 CHECK(!val->result_ok);
2213 return *val->contents.err;
2215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2216 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2219 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2220 CHECK(val->result_ok);
2221 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2222 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2226 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2227 CHECK(!val->result_ok);
2228 return *val->contents.err;
2230 typedef struct LDKBaseSign_JCalls {
2231 atomic_size_t refcnt;
2234 jmethodID get_per_commitment_point_meth;
2235 jmethodID release_commitment_secret_meth;
2236 jmethodID validate_holder_commitment_meth;
2237 jmethodID channel_keys_id_meth;
2238 jmethodID sign_counterparty_commitment_meth;
2239 jmethodID validate_counterparty_revocation_meth;
2240 jmethodID sign_holder_commitment_and_htlcs_meth;
2241 jmethodID sign_justice_revoked_output_meth;
2242 jmethodID sign_justice_revoked_htlc_meth;
2243 jmethodID sign_counterparty_htlc_transaction_meth;
2244 jmethodID sign_closing_transaction_meth;
2245 jmethodID sign_channel_announcement_meth;
2246 jmethodID ready_channel_meth;
2247 } LDKBaseSign_JCalls;
2248 static void LDKBaseSign_JCalls_free(void* this_arg) {
2249 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2250 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2252 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2253 if (get_jenv_res == JNI_EDETACHED) {
2254 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2256 DO_ASSERT(get_jenv_res == JNI_OK);
2258 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2259 if (get_jenv_res == JNI_EDETACHED) {
2260 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2265 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2266 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2268 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2269 if (get_jenv_res == JNI_EDETACHED) {
2270 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2272 DO_ASSERT(get_jenv_res == JNI_OK);
2274 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2276 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2277 if ((*env)->ExceptionCheck(env)) {
2278 (*env)->ExceptionDescribe(env);
2279 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2281 LDKPublicKey ret_ref;
2282 CHECK((*env)->GetArrayLength(env, ret) == 33);
2283 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2284 if (get_jenv_res == JNI_EDETACHED) {
2285 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2289 LDKThirtyTwoBytes release_commitment_secret_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->release_commitment_secret_meth, idx);
2301 if ((*env)->ExceptionCheck(env)) {
2302 (*env)->ExceptionDescribe(env);
2303 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2305 LDKThirtyTwoBytes ret_ref;
2306 CHECK((*env)->GetArrayLength(env, ret) == 32);
2307 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2308 if (get_jenv_res == JNI_EDETACHED) {
2309 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2313 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
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 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2323 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2324 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
2327 if (holder_tx_var.is_owned) {
2330 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2332 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2333 if ((*env)->ExceptionCheck(env)) {
2334 (*env)->ExceptionDescribe(env);
2335 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2337 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2338 CHECK_ACCESS(ret_ptr);
2339 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2340 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2341 if (get_jenv_res == JNI_EDETACHED) {
2342 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2346 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2347 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2349 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2350 if (get_jenv_res == JNI_EDETACHED) {
2351 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2353 DO_ASSERT(get_jenv_res == JNI_OK);
2355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2357 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2358 if ((*env)->ExceptionCheck(env)) {
2359 (*env)->ExceptionDescribe(env);
2360 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2362 LDKThirtyTwoBytes ret_ref;
2363 CHECK((*env)->GetArrayLength(env, ret) == 32);
2364 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2365 if (get_jenv_res == JNI_EDETACHED) {
2366 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2370 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2371 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2373 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2374 if (get_jenv_res == JNI_EDETACHED) {
2375 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2377 DO_ASSERT(get_jenv_res == JNI_OK);
2379 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2380 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2381 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2382 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2383 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2384 if (commitment_tx_var.is_owned) {
2385 commitment_tx_ref |= 1;
2387 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2389 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2390 if ((*env)->ExceptionCheck(env)) {
2391 (*env)->ExceptionDescribe(env);
2392 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2394 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2395 CHECK_ACCESS(ret_ptr);
2396 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2397 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2398 if (get_jenv_res == JNI_EDETACHED) {
2399 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2403 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2404 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2406 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2407 if (get_jenv_res == JNI_EDETACHED) {
2408 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2410 DO_ASSERT(get_jenv_res == JNI_OK);
2412 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2413 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2414 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2416 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2417 if ((*env)->ExceptionCheck(env)) {
2418 (*env)->ExceptionDescribe(env);
2419 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2421 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2422 CHECK_ACCESS(ret_ptr);
2423 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2424 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2425 if (get_jenv_res == JNI_EDETACHED) {
2426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2430 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2431 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2433 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2434 if (get_jenv_res == JNI_EDETACHED) {
2435 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2437 DO_ASSERT(get_jenv_res == JNI_OK);
2439 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2440 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2441 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2442 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2443 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2444 if (commitment_tx_var.is_owned) {
2445 commitment_tx_ref |= 1;
2447 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2449 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2450 if ((*env)->ExceptionCheck(env)) {
2451 (*env)->ExceptionDescribe(env);
2452 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2454 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2455 CHECK_ACCESS(ret_ptr);
2456 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2457 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2458 if (get_jenv_res == JNI_EDETACHED) {
2459 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2463 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]) {
2464 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2466 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2467 if (get_jenv_res == JNI_EDETACHED) {
2468 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2470 DO_ASSERT(get_jenv_res == JNI_OK);
2472 LDKTransaction justice_tx_var = justice_tx;
2473 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2474 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2475 Transaction_free(justice_tx_var);
2476 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2477 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2478 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2480 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2481 if ((*env)->ExceptionCheck(env)) {
2482 (*env)->ExceptionDescribe(env);
2483 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2485 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2486 CHECK_ACCESS(ret_ptr);
2487 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2488 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2489 if (get_jenv_res == JNI_EDETACHED) {
2490 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2494 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) {
2495 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2497 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2498 if (get_jenv_res == JNI_EDETACHED) {
2499 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2501 DO_ASSERT(get_jenv_res == JNI_OK);
2503 LDKTransaction justice_tx_var = justice_tx;
2504 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2505 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2506 Transaction_free(justice_tx_var);
2507 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2508 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2509 LDKHTLCOutputInCommitment htlc_var = *htlc;
2510 htlc_var = HTLCOutputInCommitment_clone(htlc);
2511 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2512 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2513 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2514 if (htlc_var.is_owned) {
2517 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2519 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);
2520 if ((*env)->ExceptionCheck(env)) {
2521 (*env)->ExceptionDescribe(env);
2522 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2524 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2525 CHECK_ACCESS(ret_ptr);
2526 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2527 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2528 if (get_jenv_res == JNI_EDETACHED) {
2529 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2533 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) {
2534 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2536 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2537 if (get_jenv_res == JNI_EDETACHED) {
2538 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2540 DO_ASSERT(get_jenv_res == JNI_OK);
2542 LDKTransaction htlc_tx_var = htlc_tx;
2543 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2544 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2545 Transaction_free(htlc_tx_var);
2546 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2547 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2548 LDKHTLCOutputInCommitment htlc_var = *htlc;
2549 htlc_var = HTLCOutputInCommitment_clone(htlc);
2550 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2551 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2552 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2553 if (htlc_var.is_owned) {
2556 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2558 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);
2559 if ((*env)->ExceptionCheck(env)) {
2560 (*env)->ExceptionDescribe(env);
2561 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2563 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2564 CHECK_ACCESS(ret_ptr);
2565 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2566 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2567 if (get_jenv_res == JNI_EDETACHED) {
2568 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2572 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2573 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2576 if (get_jenv_res == JNI_EDETACHED) {
2577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2579 DO_ASSERT(get_jenv_res == JNI_OK);
2581 LDKClosingTransaction closing_tx_var = *closing_tx;
2582 closing_tx_var = ClosingTransaction_clone(closing_tx);
2583 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2584 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2585 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
2586 if (closing_tx_var.is_owned) {
2587 closing_tx_ref |= 1;
2589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2591 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2592 if ((*env)->ExceptionCheck(env)) {
2593 (*env)->ExceptionDescribe(env);
2594 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2596 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2597 CHECK_ACCESS(ret_ptr);
2598 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2599 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2600 if (get_jenv_res == JNI_EDETACHED) {
2601 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2605 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2606 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2608 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2609 if (get_jenv_res == JNI_EDETACHED) {
2610 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2612 DO_ASSERT(get_jenv_res == JNI_OK);
2614 LDKUnsignedChannelAnnouncement msg_var = *msg;
2615 msg_var = UnsignedChannelAnnouncement_clone(msg);
2616 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2617 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2618 uint64_t msg_ref = (uint64_t)msg_var.inner;
2619 if (msg_var.is_owned) {
2622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2624 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2625 if ((*env)->ExceptionCheck(env)) {
2626 (*env)->ExceptionDescribe(env);
2627 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2629 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2630 CHECK_ACCESS(ret_ptr);
2631 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2632 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2633 if (get_jenv_res == JNI_EDETACHED) {
2634 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2638 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2639 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2641 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2642 if (get_jenv_res == JNI_EDETACHED) {
2643 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2645 DO_ASSERT(get_jenv_res == JNI_OK);
2647 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2648 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2649 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2650 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2651 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2652 if (channel_parameters_var.is_owned) {
2653 channel_parameters_ref |= 1;
2655 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2657 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2658 if ((*env)->ExceptionCheck(env)) {
2659 (*env)->ExceptionDescribe(env);
2660 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2662 if (get_jenv_res == JNI_EDETACHED) {
2663 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2666 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2667 jclass c = (*env)->GetObjectClass(env, o);
2669 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2670 atomic_init(&calls->refcnt, 1);
2671 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2672 calls->o = (*env)->NewWeakGlobalRef(env, o);
2673 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2674 CHECK(calls->get_per_commitment_point_meth != NULL);
2675 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2676 CHECK(calls->release_commitment_secret_meth != NULL);
2677 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2678 CHECK(calls->validate_holder_commitment_meth != NULL);
2679 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2680 CHECK(calls->channel_keys_id_meth != NULL);
2681 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2682 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2683 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2684 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2685 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2686 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2687 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2688 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2689 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2690 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2691 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2692 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2693 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2694 CHECK(calls->sign_closing_transaction_meth != NULL);
2695 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2696 CHECK(calls->sign_channel_announcement_meth != NULL);
2697 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2698 CHECK(calls->ready_channel_meth != NULL);
2700 LDKChannelPublicKeys pubkeys_conv;
2701 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2702 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2703 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2706 .this_arg = (void*) calls,
2707 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2708 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2709 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2710 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2711 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2712 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2713 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2714 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2715 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2716 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2717 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2718 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2719 .ready_channel = ready_channel_LDKBaseSign_jcall,
2720 .free = LDKBaseSign_JCalls_free,
2721 .pubkeys = pubkeys_conv,
2722 .set_pubkeys = NULL,
2726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2727 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2728 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2729 return (uint64_t)res_ptr;
2731 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) {
2732 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2733 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2734 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2735 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2741 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2742 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2743 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2744 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2745 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2749 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) {
2750 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2751 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2752 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
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 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2764 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2765 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2770 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) {
2771 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2772 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2773 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2774 LDKCommitmentTransaction commitment_tx_conv;
2775 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2776 commitment_tx_conv.is_owned = false;
2777 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2778 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2779 return (uint64_t)ret_conv;
2782 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) {
2783 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2784 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2785 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2786 unsigned char secret_arr[32];
2787 CHECK((*env)->GetArrayLength(env, secret) == 32);
2788 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2789 unsigned char (*secret_ref)[32] = &secret_arr;
2790 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2791 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2792 return (uint64_t)ret_conv;
2795 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) {
2796 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2797 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2798 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2799 LDKHolderCommitmentTransaction commitment_tx_conv;
2800 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2801 commitment_tx_conv.is_owned = false;
2802 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2803 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2804 return (uint64_t)ret_conv;
2807 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) {
2808 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2809 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2810 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2811 LDKTransaction justice_tx_ref;
2812 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2813 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2814 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2815 justice_tx_ref.data_is_owned = true;
2816 unsigned char per_commitment_key_arr[32];
2817 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2818 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2819 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2820 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2821 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2822 return (uint64_t)ret_conv;
2825 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) {
2826 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2827 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2828 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2829 LDKTransaction justice_tx_ref;
2830 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2831 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2832 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2833 justice_tx_ref.data_is_owned = true;
2834 unsigned char per_commitment_key_arr[32];
2835 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2836 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2837 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2838 LDKHTLCOutputInCommitment htlc_conv;
2839 htlc_conv.inner = (void*)(htlc & (~1));
2840 htlc_conv.is_owned = false;
2841 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2842 *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);
2843 return (uint64_t)ret_conv;
2846 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) {
2847 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2848 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2849 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2850 LDKTransaction htlc_tx_ref;
2851 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2852 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2853 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2854 htlc_tx_ref.data_is_owned = true;
2855 LDKPublicKey per_commitment_point_ref;
2856 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2857 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2858 LDKHTLCOutputInCommitment htlc_conv;
2859 htlc_conv.inner = (void*)(htlc & (~1));
2860 htlc_conv.is_owned = false;
2861 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2862 *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);
2863 return (uint64_t)ret_conv;
2866 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) {
2867 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2868 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2869 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2870 LDKClosingTransaction closing_tx_conv;
2871 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2872 closing_tx_conv.is_owned = false;
2873 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2874 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2875 return (uint64_t)ret_conv;
2878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2879 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2880 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2881 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2882 LDKUnsignedChannelAnnouncement msg_conv;
2883 msg_conv.inner = (void*)(msg & (~1));
2884 msg_conv.is_owned = false;
2885 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2886 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2887 return (uint64_t)ret_conv;
2890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2891 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2892 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2893 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2894 LDKChannelTransactionParameters channel_parameters_conv;
2895 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2896 channel_parameters_conv.is_owned = false;
2897 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2900 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2901 if (this_arg->set_pubkeys != NULL)
2902 this_arg->set_pubkeys(this_arg);
2903 return this_arg->pubkeys;
2905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2906 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2907 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2908 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2909 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2912 uint64_t ret_ref = (uint64_t)ret_var.inner;
2913 if (ret_var.is_owned) {
2919 typedef struct LDKSign_JCalls {
2920 atomic_size_t refcnt;
2923 LDKBaseSign_JCalls* BaseSign;
2924 jmethodID write_meth;
2926 static void LDKSign_JCalls_free(void* this_arg) {
2927 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2928 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2930 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2931 if (get_jenv_res == JNI_EDETACHED) {
2932 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2934 DO_ASSERT(get_jenv_res == JNI_OK);
2936 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2937 if (get_jenv_res == JNI_EDETACHED) {
2938 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2943 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2944 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2946 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2947 if (get_jenv_res == JNI_EDETACHED) {
2948 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2950 DO_ASSERT(get_jenv_res == JNI_OK);
2952 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2954 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2955 if ((*env)->ExceptionCheck(env)) {
2956 (*env)->ExceptionDescribe(env);
2957 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2959 LDKCVec_u8Z ret_ref;
2960 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2961 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2962 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2963 if (get_jenv_res == JNI_EDETACHED) {
2964 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2968 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2969 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2970 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2971 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2973 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2974 jclass c = (*env)->GetObjectClass(env, o);
2976 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2977 atomic_init(&calls->refcnt, 1);
2978 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2979 calls->o = (*env)->NewWeakGlobalRef(env, o);
2980 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2981 CHECK(calls->write_meth != NULL);
2983 LDKChannelPublicKeys pubkeys_conv;
2984 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2985 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2986 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2989 .this_arg = (void*) calls,
2990 .write = write_LDKSign_jcall,
2991 .cloned = LDKSign_JCalls_cloned,
2992 .free = LDKSign_JCalls_free,
2993 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2995 calls->BaseSign = ret.BaseSign.this_arg;
2998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2999 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
3000 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
3001 return (uint64_t)res_ptr;
3003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
3004 LDKSign *inp = (LDKSign *)(arg & ~1);
3005 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
3006 DO_ASSERT((res_ptr & 1) == 0);
3007 return (int64_t)(res_ptr | 1);
3009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3010 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3011 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3012 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
3013 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3014 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3015 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3016 CVec_u8Z_free(ret_var);
3020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3021 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3024 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3025 CHECK(val->result_ok);
3026 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
3027 *res_ret = Sign_clone(&(*val->contents.result));
3028 return (uint64_t)res_ret;
3030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3031 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3032 CHECK(!val->result_ok);
3033 LDKDecodeError err_var = (*val->contents.err);
3034 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3035 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3036 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3040 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
3042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3043 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3044 CHECK(val->result_ok);
3045 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3046 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3050 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3051 CHECK(!val->result_ok);
3052 return *val->contents.err;
3054 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3055 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3056 for (size_t i = 0; i < ret.datalen; i++) {
3057 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3062 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3064 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3065 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3066 CHECK(val->result_ok);
3067 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3068 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3070 for (size_t i = 0; i < res_var.datalen; i++) {
3071 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3072 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3073 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3074 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3079 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3080 CHECK(!val->result_ok);
3081 return *val->contents.err;
3083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3084 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3087 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3088 CHECK(val->result_ok);
3089 LDKInMemorySigner res_var = (*val->contents.result);
3090 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3091 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3092 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3096 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3097 CHECK(!val->result_ok);
3098 LDKDecodeError err_var = (*val->contents.err);
3099 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3100 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3101 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3105 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3106 ret->datalen = (*env)->GetArrayLength(env, elems);
3107 if (ret->datalen == 0) {
3110 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3111 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3112 for (size_t i = 0; i < ret->datalen; i++) {
3113 int64_t arr_elem = java_elems[i];
3114 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3115 CHECK_ACCESS(arr_elem_ptr);
3116 LDKTxOut arr_elem_conv = *(LDKTxOut*)(arr_elem_ptr);
3117 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3118 ret->data[i] = arr_elem_conv;
3120 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3122 return (uint64_t)ret;
3124 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3125 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3126 for (size_t i = 0; i < ret.datalen; i++) {
3127 ret.data[i] = TxOut_clone(&orig->data[i]);
3131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3132 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3135 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3136 CHECK(val->result_ok);
3137 LDKTransaction res_var = (*val->contents.result);
3138 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3139 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3143 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3144 CHECK(!val->result_ok);
3145 return *val->contents.err;
3147 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3148 return ThirtyTwoBytes_clone(&tuple->a);
3150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3151 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3152 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3153 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data);
3157 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3158 return ChannelMonitor_clone(&tuple->b);
3160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3161 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3162 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
3163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3165 uint64_t ret_ref = (uint64_t)ret_var.inner;
3166 if (ret_var.is_owned) {
3172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3173 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3174 ret->datalen = (*env)->GetArrayLength(env, elems);
3175 if (ret->datalen == 0) {
3178 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3179 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3180 for (size_t i = 0; i < ret->datalen; i++) {
3181 int64_t arr_elem = java_elems[i];
3182 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3183 CHECK_ACCESS(arr_elem_ptr);
3184 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(arr_elem_ptr);
3185 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
3186 ret->data[i] = arr_elem_conv;
3188 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3190 return (uint64_t)ret;
3192 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
3193 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
3194 for (size_t i = 0; i < ret.datalen; i++) {
3195 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
3199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3200 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3202 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(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 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3206 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3207 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3208 for (size_t j = 0; j < res_var.datalen; j++) {
3209 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3210 *res_conv_35_conv = res_var.data[j];
3211 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
3212 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
3214 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3218 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3219 CHECK(!val->result_ok);
3220 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3224 return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok;
3226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3227 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
3228 CHECK(val->result_ok);
3229 LDKPaymentId res_var = (*val->contents.result);
3230 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3231 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3232 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3236 LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1);
3237 CHECK(!val->result_ok);
3238 LDKDecodeError err_var = (*val->contents.err);
3239 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3240 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3241 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3244 static jclass LDKCOption_u16Z_Some_class = NULL;
3245 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3246 static jclass LDKCOption_u16Z_None_class = NULL;
3247 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3249 LDKCOption_u16Z_Some_class =
3250 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3251 CHECK(LDKCOption_u16Z_Some_class != NULL);
3252 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3253 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3254 LDKCOption_u16Z_None_class =
3255 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3256 CHECK(LDKCOption_u16Z_None_class != NULL);
3257 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3258 CHECK(LDKCOption_u16Z_None_meth != NULL);
3260 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3261 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3263 case LDKCOption_u16Z_Some: {
3264 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3266 case LDKCOption_u16Z_None: {
3267 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3272 static jclass LDKAPIError_APIMisuseError_class = NULL;
3273 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3274 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3275 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3276 static jclass LDKAPIError_RouteError_class = NULL;
3277 static jmethodID LDKAPIError_RouteError_meth = NULL;
3278 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3279 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3280 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3281 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3282 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3283 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3285 LDKAPIError_APIMisuseError_class =
3286 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3287 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3288 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3289 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3290 LDKAPIError_FeeRateTooHigh_class =
3291 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3292 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3293 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3294 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3295 LDKAPIError_RouteError_class =
3296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3297 CHECK(LDKAPIError_RouteError_class != NULL);
3298 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3299 CHECK(LDKAPIError_RouteError_meth != NULL);
3300 LDKAPIError_ChannelUnavailable_class =
3301 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3302 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3303 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3304 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3305 LDKAPIError_MonitorUpdateFailed_class =
3306 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3307 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3308 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3309 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3310 LDKAPIError_IncompatibleShutdownScript_class =
3311 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3312 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3313 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3314 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3316 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3317 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3319 case LDKAPIError_APIMisuseError: {
3320 LDKStr err_str = obj->api_misuse_error.err;
3321 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3322 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3324 case LDKAPIError_FeeRateTooHigh: {
3325 LDKStr err_str = obj->fee_rate_too_high.err;
3326 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3327 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3329 case LDKAPIError_RouteError: {
3330 LDKStr err_str = obj->route_error.err;
3331 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3332 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3334 case LDKAPIError_ChannelUnavailable: {
3335 LDKStr err_str = obj->channel_unavailable.err;
3336 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3337 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3339 case LDKAPIError_MonitorUpdateFailed: {
3340 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3342 case LDKAPIError_IncompatibleShutdownScript: {
3343 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3344 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3345 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3346 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3347 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3353 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3356 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3357 CHECK(val->result_ok);
3358 return *val->contents.result;
3360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3361 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3362 CHECK(!val->result_ok);
3363 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3367 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3368 ret->datalen = (*env)->GetArrayLength(env, elems);
3369 if (ret->datalen == 0) {
3372 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3373 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3374 for (size_t i = 0; i < ret->datalen; i++) {
3375 int64_t arr_elem = java_elems[i];
3376 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3377 CHECK_ACCESS(arr_elem_ptr);
3378 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(arr_elem_ptr);
3379 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3380 ret->data[i] = arr_elem_conv;
3382 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3384 return (uint64_t)ret;
3386 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3387 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3388 for (size_t i = 0; i < ret.datalen; i++) {
3389 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3394 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3395 ret->datalen = (*env)->GetArrayLength(env, elems);
3396 if (ret->datalen == 0) {
3399 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3400 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3401 for (size_t i = 0; i < ret->datalen; i++) {
3402 int64_t arr_elem = java_elems[i];
3403 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3404 CHECK_ACCESS(arr_elem_ptr);
3405 LDKAPIError arr_elem_conv = *(LDKAPIError*)(arr_elem_ptr);
3406 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3407 ret->data[i] = arr_elem_conv;
3409 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3411 return (uint64_t)ret;
3413 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3414 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3415 for (size_t i = 0; i < ret.datalen; i++) {
3416 ret.data[i] = APIError_clone(&orig->data[i]);
3420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3421 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
3423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3424 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3425 CHECK(val->result_ok);
3426 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3427 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3431 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3432 CHECK(!val->result_ok);
3433 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3436 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3437 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3438 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3439 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3440 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3441 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3442 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3443 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3445 LDKPaymentSendFailure_ParameterError_class =
3446 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3447 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3448 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3449 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3450 LDKPaymentSendFailure_PathParameterError_class =
3451 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3452 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3453 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3454 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3455 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3456 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3457 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3458 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3459 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3460 LDKPaymentSendFailure_PartialFailure_class =
3461 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3462 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3463 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3464 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3466 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3467 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3469 case LDKPaymentSendFailure_ParameterError: {
3470 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3471 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3473 case LDKPaymentSendFailure_PathParameterError: {
3474 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3475 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3476 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3477 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3478 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3479 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3480 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3481 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3483 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3484 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3486 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3487 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3488 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3489 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3490 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3491 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3492 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3494 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3495 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3497 case LDKPaymentSendFailure_PartialFailure: {
3498 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3499 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3500 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3501 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3502 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3503 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3504 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3505 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3507 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3508 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3514 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
3516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3517 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3518 CHECK(val->result_ok);
3519 LDKPaymentId res_var = (*val->contents.result);
3520 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3521 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3522 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3526 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3527 CHECK(!val->result_ok);
3528 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3532 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3535 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3536 CHECK(val->result_ok);
3537 return *val->contents.result;
3539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3540 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3541 CHECK(!val->result_ok);
3542 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3545 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3546 return ThirtyTwoBytes_clone(&tuple->a);
3548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3549 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data);
3555 static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3556 return PaymentId_clone(&tuple->b);
3558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3559 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3560 LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv);
3561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3563 uint64_t ret_ref = (uint64_t)ret_var.inner;
3564 if (ret_var.is_owned) {
3570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3571 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
3573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3574 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3575 CHECK(val->result_ok);
3576 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3577 *res_conv = (*val->contents.result);
3578 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
3579 return ((uint64_t)res_conv);
3581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3582 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3583 CHECK(!val->result_ok);
3584 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3587 static jclass LDKNetAddress_IPv4_class = NULL;
3588 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3589 static jclass LDKNetAddress_IPv6_class = NULL;
3590 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3591 static jclass LDKNetAddress_OnionV2_class = NULL;
3592 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3593 static jclass LDKNetAddress_OnionV3_class = NULL;
3594 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3596 LDKNetAddress_IPv4_class =
3597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3598 CHECK(LDKNetAddress_IPv4_class != NULL);
3599 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3600 CHECK(LDKNetAddress_IPv4_meth != NULL);
3601 LDKNetAddress_IPv6_class =
3602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3603 CHECK(LDKNetAddress_IPv6_class != NULL);
3604 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3605 CHECK(LDKNetAddress_IPv6_meth != NULL);
3606 LDKNetAddress_OnionV2_class =
3607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3608 CHECK(LDKNetAddress_OnionV2_class != NULL);
3609 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3610 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3611 LDKNetAddress_OnionV3_class =
3612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3613 CHECK(LDKNetAddress_OnionV3_class != NULL);
3614 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3615 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3617 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3618 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3620 case LDKNetAddress_IPv4: {
3621 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3622 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3623 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3625 case LDKNetAddress_IPv6: {
3626 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3627 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3628 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3630 case LDKNetAddress_OnionV2: {
3631 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3632 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3633 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3635 case LDKNetAddress_OnionV3: {
3636 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3637 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3638 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);
3643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3644 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3645 ret->datalen = (*env)->GetArrayLength(env, elems);
3646 if (ret->datalen == 0) {
3649 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3650 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3651 for (size_t i = 0; i < ret->datalen; i++) {
3652 int64_t arr_elem = java_elems[i];
3653 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3654 CHECK_ACCESS(arr_elem_ptr);
3655 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(arr_elem_ptr);
3656 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3657 ret->data[i] = arr_elem_conv;
3659 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3661 return (uint64_t)ret;
3663 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3664 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3665 for (size_t i = 0; i < ret.datalen; i++) {
3666 ret.data[i] = NetAddress_clone(&orig->data[i]);
3670 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3671 return ThirtyTwoBytes_clone(&tuple->a);
3673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3674 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3675 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3676 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data);
3680 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3681 return ThirtyTwoBytes_clone(&tuple->b);
3683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3684 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data);
3690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3691 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3694 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3695 CHECK(val->result_ok);
3696 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3697 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3701 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3702 CHECK(!val->result_ok);
3703 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3707 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3708 ret->datalen = (*env)->GetArrayLength(env, elems);
3709 if (ret->datalen == 0) {
3712 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3713 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3714 for (size_t i = 0; i < ret->datalen; i++) {
3715 int64_t arr_elem = java_elems[i];
3716 LDKChannelMonitor arr_elem_conv;
3717 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3718 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3719 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3720 ret->data[i] = arr_elem_conv;
3722 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3724 return (uint64_t)ret;
3726 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3727 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3728 for (size_t i = 0; i < ret.datalen; i++) {
3729 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3733 typedef struct LDKWatch_JCalls {
3734 atomic_size_t refcnt;
3737 jmethodID watch_channel_meth;
3738 jmethodID update_channel_meth;
3739 jmethodID release_pending_monitor_events_meth;
3741 static void LDKWatch_JCalls_free(void* this_arg) {
3742 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3743 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3745 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3746 if (get_jenv_res == JNI_EDETACHED) {
3747 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3749 DO_ASSERT(get_jenv_res == JNI_OK);
3751 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3752 if (get_jenv_res == JNI_EDETACHED) {
3753 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3758 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3759 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3762 if (get_jenv_res == JNI_EDETACHED) {
3763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3765 DO_ASSERT(get_jenv_res == JNI_OK);
3767 LDKOutPoint funding_txo_var = funding_txo;
3768 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3769 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3770 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3771 if (funding_txo_var.is_owned) {
3772 funding_txo_ref |= 1;
3774 LDKChannelMonitor monitor_var = monitor;
3775 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3776 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3777 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3778 if (monitor_var.is_owned) {
3781 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3783 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3784 if ((*env)->ExceptionCheck(env)) {
3785 (*env)->ExceptionDescribe(env);
3786 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3788 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3789 CHECK_ACCESS(ret_ptr);
3790 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
3791 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3792 if (get_jenv_res == JNI_EDETACHED) {
3793 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3797 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3798 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3800 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3801 if (get_jenv_res == JNI_EDETACHED) {
3802 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3804 DO_ASSERT(get_jenv_res == JNI_OK);
3806 LDKOutPoint funding_txo_var = funding_txo;
3807 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3808 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3809 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3810 if (funding_txo_var.is_owned) {
3811 funding_txo_ref |= 1;
3813 LDKChannelMonitorUpdate update_var = update;
3814 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3815 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3816 uint64_t update_ref = (uint64_t)update_var.inner;
3817 if (update_var.is_owned) {
3820 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3822 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3823 if ((*env)->ExceptionCheck(env)) {
3824 (*env)->ExceptionDescribe(env);
3825 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3827 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3828 CHECK_ACCESS(ret_ptr);
3829 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
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 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
3862 CHECK_ACCESS(ret_conv_14_ptr);
3863 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
3864 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3865 ret_constr.data[o] = ret_conv_14_conv;
3867 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3868 if (get_jenv_res == JNI_EDETACHED) {
3869 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3873 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3874 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3875 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3877 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3878 jclass c = (*env)->GetObjectClass(env, o);
3880 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3881 atomic_init(&calls->refcnt, 1);
3882 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3883 calls->o = (*env)->NewWeakGlobalRef(env, o);
3884 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3885 CHECK(calls->watch_channel_meth != NULL);
3886 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3887 CHECK(calls->update_channel_meth != NULL);
3888 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3889 CHECK(calls->release_pending_monitor_events_meth != NULL);
3892 .this_arg = (void*) calls,
3893 .watch_channel = watch_channel_LDKWatch_jcall,
3894 .update_channel = update_channel_LDKWatch_jcall,
3895 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3896 .free = LDKWatch_JCalls_free,
3900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3901 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3902 *res_ptr = LDKWatch_init(env, clz, o);
3903 return (uint64_t)res_ptr;
3905 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) {
3906 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3907 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3908 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3909 LDKOutPoint funding_txo_conv;
3910 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3911 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3912 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3913 LDKChannelMonitor monitor_conv;
3914 monitor_conv.inner = (void*)(monitor & (~1));
3915 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3916 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3917 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3918 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3919 return (uint64_t)ret_conv;
3922 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) {
3923 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3924 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3925 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3926 LDKOutPoint funding_txo_conv;
3927 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3928 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3929 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3930 LDKChannelMonitorUpdate update_conv;
3931 update_conv.inner = (void*)(update & (~1));
3932 update_conv.is_owned = (update & 1) || (update == 0);
3933 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3934 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3935 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3936 return (uint64_t)ret_conv;
3939 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3940 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3941 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3942 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
3943 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3944 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3945 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3946 for (size_t o = 0; o < ret_var.datalen; o++) {
3947 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3948 *ret_conv_14_copy = ret_var.data[o];
3949 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3950 ret_arr_ptr[o] = ret_conv_14_ref;
3952 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3957 typedef struct LDKBroadcasterInterface_JCalls {
3958 atomic_size_t refcnt;
3961 jmethodID broadcast_transaction_meth;
3962 } LDKBroadcasterInterface_JCalls;
3963 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3964 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3965 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3967 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3968 if (get_jenv_res == JNI_EDETACHED) {
3969 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3971 DO_ASSERT(get_jenv_res == JNI_OK);
3973 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3974 if (get_jenv_res == JNI_EDETACHED) {
3975 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3980 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3981 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3983 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3984 if (get_jenv_res == JNI_EDETACHED) {
3985 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3987 DO_ASSERT(get_jenv_res == JNI_OK);
3989 LDKTransaction tx_var = tx;
3990 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3991 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3992 Transaction_free(tx_var);
3993 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3995 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3996 if ((*env)->ExceptionCheck(env)) {
3997 (*env)->ExceptionDescribe(env);
3998 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
4000 if (get_jenv_res == JNI_EDETACHED) {
4001 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4004 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4005 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4006 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4008 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
4009 jclass c = (*env)->GetObjectClass(env, o);
4011 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4012 atomic_init(&calls->refcnt, 1);
4013 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4014 calls->o = (*env)->NewWeakGlobalRef(env, o);
4015 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
4016 CHECK(calls->broadcast_transaction_meth != NULL);
4018 LDKBroadcasterInterface ret = {
4019 .this_arg = (void*) calls,
4020 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4021 .free = LDKBroadcasterInterface_JCalls_free,
4025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4026 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4027 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
4028 return (uint64_t)res_ptr;
4030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
4031 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4032 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4033 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4034 LDKTransaction tx_ref;
4035 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
4036 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4037 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
4038 tx_ref.data_is_owned = true;
4039 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4042 typedef struct LDKKeysInterface_JCalls {
4043 atomic_size_t refcnt;
4046 jmethodID get_node_secret_meth;
4047 jmethodID get_destination_script_meth;
4048 jmethodID get_shutdown_scriptpubkey_meth;
4049 jmethodID get_channel_signer_meth;
4050 jmethodID get_secure_random_bytes_meth;
4051 jmethodID read_chan_signer_meth;
4052 jmethodID sign_invoice_meth;
4053 } LDKKeysInterface_JCalls;
4054 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4055 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4056 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4059 if (get_jenv_res == JNI_EDETACHED) {
4060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4062 DO_ASSERT(get_jenv_res == JNI_OK);
4064 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4065 if (get_jenv_res == JNI_EDETACHED) {
4066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4071 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
4072 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4075 if (get_jenv_res == JNI_EDETACHED) {
4076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4078 DO_ASSERT(get_jenv_res == JNI_OK);
4080 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4082 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
4083 if ((*env)->ExceptionCheck(env)) {
4084 (*env)->ExceptionDescribe(env);
4085 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
4087 LDKSecretKey ret_ref;
4088 CHECK((*env)->GetArrayLength(env, ret) == 32);
4089 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
4090 if (get_jenv_res == JNI_EDETACHED) {
4091 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4095 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4096 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4098 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4099 if (get_jenv_res == JNI_EDETACHED) {
4100 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4102 DO_ASSERT(get_jenv_res == JNI_OK);
4104 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4106 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
4107 if ((*env)->ExceptionCheck(env)) {
4108 (*env)->ExceptionDescribe(env);
4109 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
4111 LDKCVec_u8Z ret_ref;
4112 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4113 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4114 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4115 if (get_jenv_res == JNI_EDETACHED) {
4116 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4120 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4121 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4123 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4124 if (get_jenv_res == JNI_EDETACHED) {
4125 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4127 DO_ASSERT(get_jenv_res == JNI_OK);
4129 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4131 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
4132 if ((*env)->ExceptionCheck(env)) {
4133 (*env)->ExceptionDescribe(env);
4134 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
4136 LDKShutdownScript ret_conv;
4137 ret_conv.inner = (void*)(ret & (~1));
4138 ret_conv.is_owned = (ret & 1) || (ret == 0);
4139 ret_conv = ShutdownScript_clone(&ret_conv);
4140 if (get_jenv_res == JNI_EDETACHED) {
4141 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4145 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4146 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4148 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4149 if (get_jenv_res == JNI_EDETACHED) {
4150 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4152 DO_ASSERT(get_jenv_res == JNI_OK);
4154 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4156 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4157 if ((*env)->ExceptionCheck(env)) {
4158 (*env)->ExceptionDescribe(env);
4159 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4161 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4162 CHECK_ACCESS(ret_ptr);
4163 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4164 ret_conv = Sign_clone(&ret_conv);
4165 if (get_jenv_res == JNI_EDETACHED) {
4166 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4170 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4171 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4173 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4174 if (get_jenv_res == JNI_EDETACHED) {
4175 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4177 DO_ASSERT(get_jenv_res == JNI_OK);
4179 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4181 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4182 if ((*env)->ExceptionCheck(env)) {
4183 (*env)->ExceptionDescribe(env);
4184 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4186 LDKThirtyTwoBytes ret_ref;
4187 CHECK((*env)->GetArrayLength(env, ret) == 32);
4188 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4189 if (get_jenv_res == JNI_EDETACHED) {
4190 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4194 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4195 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4197 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4198 if (get_jenv_res == JNI_EDETACHED) {
4199 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4201 DO_ASSERT(get_jenv_res == JNI_OK);
4203 LDKu8slice reader_var = reader;
4204 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4205 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4206 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4208 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4209 if ((*env)->ExceptionCheck(env)) {
4210 (*env)->ExceptionDescribe(env);
4211 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4213 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4214 CHECK_ACCESS(ret_ptr);
4215 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4216 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4217 if (get_jenv_res == JNI_EDETACHED) {
4218 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4222 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4223 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4225 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4226 if (get_jenv_res == JNI_EDETACHED) {
4227 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4229 DO_ASSERT(get_jenv_res == JNI_OK);
4231 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4232 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4233 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4234 CVec_u8Z_free(invoice_preimage_var);
4235 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4237 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4238 if ((*env)->ExceptionCheck(env)) {
4239 (*env)->ExceptionDescribe(env);
4240 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4242 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4243 CHECK_ACCESS(ret_ptr);
4244 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
4245 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4246 if (get_jenv_res == JNI_EDETACHED) {
4247 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4251 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4252 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4253 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4255 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4256 jclass c = (*env)->GetObjectClass(env, o);
4258 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4259 atomic_init(&calls->refcnt, 1);
4260 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4261 calls->o = (*env)->NewWeakGlobalRef(env, o);
4262 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4263 CHECK(calls->get_node_secret_meth != NULL);
4264 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4265 CHECK(calls->get_destination_script_meth != NULL);
4266 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4267 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4268 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4269 CHECK(calls->get_channel_signer_meth != NULL);
4270 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4271 CHECK(calls->get_secure_random_bytes_meth != NULL);
4272 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4273 CHECK(calls->read_chan_signer_meth != NULL);
4274 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4275 CHECK(calls->sign_invoice_meth != NULL);
4277 LDKKeysInterface ret = {
4278 .this_arg = (void*) calls,
4279 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4280 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4281 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4282 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4283 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4284 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4285 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4286 .free = LDKKeysInterface_JCalls_free,
4290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4291 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4292 *res_ptr = LDKKeysInterface_init(env, clz, o);
4293 return (uint64_t)res_ptr;
4295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4296 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4297 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4298 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4299 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4305 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4306 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4307 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4308 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4311 CVec_u8Z_free(ret_var);
4315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4316 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4317 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4318 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4319 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4322 uint64_t ret_ref = (uint64_t)ret_var.inner;
4323 if (ret_var.is_owned) {
4329 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) {
4330 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4331 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4332 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4333 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
4334 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4335 return (uint64_t)ret_ret;
4338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4339 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4340 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4341 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4342 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4348 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4349 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4350 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4351 LDKu8slice reader_ref;
4352 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4353 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4354 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4355 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4356 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4357 return (uint64_t)ret_conv;
4360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4361 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4362 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4363 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4364 LDKCVec_u8Z invoice_preimage_ref;
4365 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4366 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4367 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4368 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4369 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4370 return (uint64_t)ret_conv;
4373 typedef struct LDKFeeEstimator_JCalls {
4374 atomic_size_t refcnt;
4377 jmethodID get_est_sat_per_1000_weight_meth;
4378 } LDKFeeEstimator_JCalls;
4379 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4380 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4381 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4383 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4384 if (get_jenv_res == JNI_EDETACHED) {
4385 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4387 DO_ASSERT(get_jenv_res == JNI_OK);
4389 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4390 if (get_jenv_res == JNI_EDETACHED) {
4391 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4396 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4397 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4399 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4400 if (get_jenv_res == JNI_EDETACHED) {
4401 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4403 DO_ASSERT(get_jenv_res == JNI_OK);
4405 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4406 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4408 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4409 if ((*env)->ExceptionCheck(env)) {
4410 (*env)->ExceptionDescribe(env);
4411 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4413 if (get_jenv_res == JNI_EDETACHED) {
4414 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4418 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4419 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4420 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4422 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4423 jclass c = (*env)->GetObjectClass(env, o);
4425 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4426 atomic_init(&calls->refcnt, 1);
4427 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4428 calls->o = (*env)->NewWeakGlobalRef(env, o);
4429 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4430 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4432 LDKFeeEstimator ret = {
4433 .this_arg = (void*) calls,
4434 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4435 .free = LDKFeeEstimator_JCalls_free,
4439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4440 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4441 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4442 return (uint64_t)res_ptr;
4444 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) {
4445 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4446 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4447 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
4448 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4449 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4453 typedef struct LDKLogger_JCalls {
4454 atomic_size_t refcnt;
4459 static void LDKLogger_JCalls_free(void* this_arg) {
4460 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4461 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4463 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4464 if (get_jenv_res == JNI_EDETACHED) {
4465 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4467 DO_ASSERT(get_jenv_res == JNI_OK);
4469 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4470 if (get_jenv_res == JNI_EDETACHED) {
4471 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4476 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4477 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4479 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4480 if (get_jenv_res == JNI_EDETACHED) {
4481 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4483 DO_ASSERT(get_jenv_res == JNI_OK);
4485 const char* record_str = record;
4486 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4489 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4490 if ((*env)->ExceptionCheck(env)) {
4491 (*env)->ExceptionDescribe(env);
4492 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4494 if (get_jenv_res == JNI_EDETACHED) {
4495 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4498 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4499 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4500 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4502 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4503 jclass c = (*env)->GetObjectClass(env, o);
4505 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4506 atomic_init(&calls->refcnt, 1);
4507 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4508 calls->o = (*env)->NewWeakGlobalRef(env, o);
4509 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4510 CHECK(calls->log_meth != NULL);
4513 .this_arg = (void*) calls,
4514 .log = log_LDKLogger_jcall,
4515 .free = LDKLogger_JCalls_free,
4519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4520 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4521 *res_ptr = LDKLogger_init(env, clz, o);
4522 return (uint64_t)res_ptr;
4524 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4525 return ThirtyTwoBytes_clone(&tuple->a);
4527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4528 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4529 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4530 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data);
4534 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4538 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4539 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
4540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4542 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
4546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4547 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4550 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4551 CHECK(val->result_ok);
4552 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
4553 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
4554 return ((uint64_t)res_conv) | 1;
4556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4557 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4558 CHECK(!val->result_ok);
4559 LDKDecodeError err_var = (*val->contents.err);
4560 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4561 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4562 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4566 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4569 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4570 CHECK(val->result_ok);
4571 LDKChannelConfig res_var = (*val->contents.result);
4572 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4573 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4574 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4578 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4579 CHECK(!val->result_ok);
4580 LDKDecodeError err_var = (*val->contents.err);
4581 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4582 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4583 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4587 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4590 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4591 CHECK(val->result_ok);
4592 LDKOutPoint res_var = (*val->contents.result);
4593 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4594 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4595 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4599 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4600 CHECK(!val->result_ok);
4601 LDKDecodeError err_var = (*val->contents.err);
4602 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4603 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4604 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4607 typedef struct LDKType_JCalls {
4608 atomic_size_t refcnt;
4611 jmethodID type_id_meth;
4612 jmethodID debug_str_meth;
4613 jmethodID write_meth;
4615 static void LDKType_JCalls_free(void* this_arg) {
4616 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4617 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4619 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4620 if (get_jenv_res == JNI_EDETACHED) {
4621 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4623 DO_ASSERT(get_jenv_res == JNI_OK);
4625 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4626 if (get_jenv_res == JNI_EDETACHED) {
4627 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4632 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4633 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4635 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4636 if (get_jenv_res == JNI_EDETACHED) {
4637 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4639 DO_ASSERT(get_jenv_res == JNI_OK);
4641 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4643 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4644 if ((*env)->ExceptionCheck(env)) {
4645 (*env)->ExceptionDescribe(env);
4646 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4648 if (get_jenv_res == JNI_EDETACHED) {
4649 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4653 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4654 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4656 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4657 if (get_jenv_res == JNI_EDETACHED) {
4658 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4660 DO_ASSERT(get_jenv_res == JNI_OK);
4662 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4664 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4665 if ((*env)->ExceptionCheck(env)) {
4666 (*env)->ExceptionDescribe(env);
4667 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4669 LDKStr ret_conv = java_to_owned_str(env, ret);
4670 if (get_jenv_res == JNI_EDETACHED) {
4671 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4675 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4676 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4678 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4679 if (get_jenv_res == JNI_EDETACHED) {
4680 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4682 DO_ASSERT(get_jenv_res == JNI_OK);
4684 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4686 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4687 if ((*env)->ExceptionCheck(env)) {
4688 (*env)->ExceptionDescribe(env);
4689 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4691 LDKCVec_u8Z ret_ref;
4692 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4693 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4694 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4695 if (get_jenv_res == JNI_EDETACHED) {
4696 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4700 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4701 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4702 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4704 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4705 jclass c = (*env)->GetObjectClass(env, o);
4707 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4708 atomic_init(&calls->refcnt, 1);
4709 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4710 calls->o = (*env)->NewWeakGlobalRef(env, o);
4711 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4712 CHECK(calls->type_id_meth != NULL);
4713 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4714 CHECK(calls->debug_str_meth != NULL);
4715 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4716 CHECK(calls->write_meth != NULL);
4719 .this_arg = (void*) calls,
4720 .type_id = type_id_LDKType_jcall,
4721 .debug_str = debug_str_LDKType_jcall,
4722 .write = write_LDKType_jcall,
4723 .cloned = LDKType_JCalls_cloned,
4724 .free = LDKType_JCalls_free,
4728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
4729 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4730 *res_ptr = LDKType_init(env, clz, o);
4731 return (uint64_t)res_ptr;
4733 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4734 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4735 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4736 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4737 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4741 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
4742 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4743 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4744 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4745 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4746 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
4751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4752 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4753 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4754 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4755 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4756 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4757 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4758 CVec_u8Z_free(ret_var);
4762 static jclass LDKCOption_TypeZ_Some_class = NULL;
4763 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
4764 static jclass LDKCOption_TypeZ_None_class = NULL;
4765 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
4766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
4767 LDKCOption_TypeZ_Some_class =
4768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
4769 CHECK(LDKCOption_TypeZ_Some_class != NULL);
4770 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
4771 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
4772 LDKCOption_TypeZ_None_class =
4773 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
4774 CHECK(LDKCOption_TypeZ_None_class != NULL);
4775 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
4776 CHECK(LDKCOption_TypeZ_None_meth != NULL);
4778 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4779 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
4781 case LDKCOption_TypeZ_Some: {
4782 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
4783 *some_ret = Type_clone(&obj->some);
4784 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
4786 case LDKCOption_TypeZ_None: {
4787 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
4792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4793 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
4795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4796 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4797 CHECK(val->result_ok);
4798 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4802 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4803 CHECK(!val->result_ok);
4804 LDKDecodeError err_var = (*val->contents.err);
4805 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4806 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4807 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4811 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4813 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4814 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4815 CHECK(val->result_ok);
4816 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4820 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4821 CHECK(!val->result_ok);
4822 return *val->contents.err;
4824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4825 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4828 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4829 CHECK(val->result_ok);
4830 LDKInvoice res_var = (*val->contents.result);
4831 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4832 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4833 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4837 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4838 CHECK(!val->result_ok);
4839 return *val->contents.err;
4841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4842 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4845 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4846 CHECK(val->result_ok);
4847 LDKSignedRawInvoice res_var = (*val->contents.result);
4848 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4849 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4850 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4854 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4855 CHECK(!val->result_ok);
4856 return *val->contents.err;
4858 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4859 return RawInvoice_clone(&tuple->a);
4861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4862 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4863 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
4864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4866 uint64_t ret_ref = (uint64_t)ret_var.inner;
4867 if (ret_var.is_owned) {
4873 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4874 return ThirtyTwoBytes_clone(&tuple->b);
4876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4877 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4878 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data);
4883 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4884 return InvoiceSignature_clone(&tuple->c);
4886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
4887 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4888 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
4889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4891 uint64_t ret_ref = (uint64_t)ret_var.inner;
4892 if (ret_var.is_owned) {
4898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4899 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4902 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4903 CHECK(val->result_ok);
4904 LDKPayeePubKey res_var = (*val->contents.result);
4905 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4906 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4907 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4910 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4911 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4912 CHECK(!val->result_ok);
4913 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4917 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4918 ret->datalen = (*env)->GetArrayLength(env, elems);
4919 if (ret->datalen == 0) {
4922 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4923 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4924 for (size_t i = 0; i < ret->datalen; i++) {
4925 int64_t arr_elem = java_elems[i];
4926 LDKPrivateRoute arr_elem_conv;
4927 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4928 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4929 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4930 ret->data[i] = arr_elem_conv;
4932 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4934 return (uint64_t)ret;
4936 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4937 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4938 for (size_t i = 0; i < ret.datalen; i++) {
4939 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4944 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4947 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4948 CHECK(val->result_ok);
4949 LDKPositiveTimestamp res_var = (*val->contents.result);
4950 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4951 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4952 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4955 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4956 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4957 CHECK(!val->result_ok);
4958 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4962 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4965 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4966 CHECK(val->result_ok);
4967 return *val->contents.result;
4969 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4970 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4971 CHECK(!val->result_ok);
4972 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4976 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4979 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4980 CHECK(val->result_ok);
4981 LDKInvoice res_var = (*val->contents.result);
4982 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4983 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4984 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4987 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4988 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4989 CHECK(!val->result_ok);
4990 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4994 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4997 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4998 CHECK(val->result_ok);
4999 LDKDescription res_var = (*val->contents.result);
5000 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5001 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5002 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5005 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5006 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5007 CHECK(!val->result_ok);
5008 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5012 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
5014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5015 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5016 CHECK(val->result_ok);
5017 LDKExpiryTime res_var = (*val->contents.result);
5018 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5019 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5020 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5023 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5024 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5025 CHECK(!val->result_ok);
5026 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5030 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
5032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5033 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5034 CHECK(val->result_ok);
5035 LDKPrivateRoute res_var = (*val->contents.result);
5036 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5037 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5038 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5041 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5042 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5043 CHECK(!val->result_ok);
5044 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5048 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
5050 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5051 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5052 CHECK(val->result_ok);
5053 LDKStr res_str = (*val->contents.result);
5054 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
5057 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5058 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5059 CHECK(!val->result_ok);
5060 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5064 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
5066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5067 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5068 CHECK(val->result_ok);
5069 LDKChannelMonitorUpdate res_var = (*val->contents.result);
5070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5076 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5077 CHECK(!val->result_ok);
5078 LDKDecodeError err_var = (*val->contents.err);
5079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5085 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
5087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5088 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5089 CHECK(val->result_ok);
5090 LDKHTLCUpdate res_var = (*val->contents.result);
5091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5097 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5098 CHECK(!val->result_ok);
5099 LDKDecodeError err_var = (*val->contents.err);
5100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5106 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
5108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5109 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5110 CHECK(val->result_ok);
5111 return *val->contents.result;
5113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5114 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5115 CHECK(!val->result_ok);
5116 LDKMonitorUpdateError err_var = (*val->contents.err);
5117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5122 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5123 return OutPoint_clone(&tuple->a);
5125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5126 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5127 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
5128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5130 uint64_t ret_ref = (uint64_t)ret_var.inner;
5131 if (ret_var.is_owned) {
5137 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5138 return CVec_u8Z_clone(&tuple->b);
5140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5141 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5142 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
5143 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5144 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5145 CVec_u8Z_free(ret_var);
5149 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5152 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5153 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5154 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
5158 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5159 return CVec_u8Z_clone(&tuple->b);
5161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5162 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5163 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
5164 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5165 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5166 CVec_u8Z_free(ret_var);
5170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5171 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
5172 ret->datalen = (*env)->GetArrayLength(env, elems);
5173 if (ret->datalen == 0) {
5176 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5178 for (size_t i = 0; i < ret->datalen; i++) {
5179 int64_t arr_elem = java_elems[i];
5180 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5181 CHECK_ACCESS(arr_elem_ptr);
5182 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(arr_elem_ptr);
5183 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5184 ret->data[i] = arr_elem_conv;
5186 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5188 return (uint64_t)ret;
5190 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5191 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5192 for (size_t i = 0; i < ret.datalen; i++) {
5193 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5197 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5198 return ThirtyTwoBytes_clone(&tuple->a);
5200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5201 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5202 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5203 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data);
5207 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5208 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
5210 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5211 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5212 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
5213 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5214 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5215 for (size_t v = 0; v < ret_var.datalen; v++) {
5216 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5217 *ret_conv_21_conv = ret_var.data[v];
5218 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
5220 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5226 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5227 ret->datalen = (*env)->GetArrayLength(env, elems);
5228 if (ret->datalen == 0) {
5231 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5232 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5233 for (size_t i = 0; i < ret->datalen; i++) {
5234 int64_t arr_elem = java_elems[i];
5235 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5236 CHECK_ACCESS(arr_elem_ptr);
5237 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arr_elem_ptr);
5238 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5239 ret->data[i] = arr_elem_conv;
5241 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5243 return (uint64_t)ret;
5245 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5246 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 };
5247 for (size_t i = 0; i < ret.datalen; i++) {
5248 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5252 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5253 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5254 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5255 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5257 LDKPaymentPurpose_InvoicePayment_class =
5258 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5259 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5260 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5261 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5262 LDKPaymentPurpose_SpontaneousPayment_class =
5263 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5264 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5265 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5266 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5268 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5269 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5271 case LDKPaymentPurpose_InvoicePayment: {
5272 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5273 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5274 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5275 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5276 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5278 case LDKPaymentPurpose_SpontaneousPayment: {
5279 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5280 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5281 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5286 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5287 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5288 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5289 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5290 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5291 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5292 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5293 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5294 static jclass LDKClosureReason_ProcessingError_class = NULL;
5295 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5296 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5297 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5298 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5299 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5301 LDKClosureReason_CounterpartyForceClosed_class =
5302 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5303 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5304 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5305 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5306 LDKClosureReason_HolderForceClosed_class =
5307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5308 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5309 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5310 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5311 LDKClosureReason_CooperativeClosure_class =
5312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5313 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5314 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5315 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5316 LDKClosureReason_CommitmentTxConfirmed_class =
5317 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5318 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5319 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5320 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5321 LDKClosureReason_ProcessingError_class =
5322 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5323 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5324 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5325 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5326 LDKClosureReason_DisconnectedPeer_class =
5327 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5328 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5329 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5330 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5331 LDKClosureReason_OutdatedChannelManager_class =
5332 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5333 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5334 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5335 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5337 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5338 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5340 case LDKClosureReason_CounterpartyForceClosed: {
5341 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5342 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5343 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5345 case LDKClosureReason_HolderForceClosed: {
5346 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5348 case LDKClosureReason_CooperativeClosure: {
5349 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5351 case LDKClosureReason_CommitmentTxConfirmed: {
5352 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5354 case LDKClosureReason_ProcessingError: {
5355 LDKStr err_str = obj->processing_error.err;
5356 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5357 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5359 case LDKClosureReason_DisconnectedPeer: {
5360 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5362 case LDKClosureReason_OutdatedChannelManager: {
5363 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5368 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5369 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5370 static jclass LDKEvent_PaymentReceived_class = NULL;
5371 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5372 static jclass LDKEvent_PaymentSent_class = NULL;
5373 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5374 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5375 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5376 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5377 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5378 static jclass LDKEvent_SpendableOutputs_class = NULL;
5379 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5380 static jclass LDKEvent_PaymentForwarded_class = NULL;
5381 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5382 static jclass LDKEvent_ChannelClosed_class = NULL;
5383 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5384 static jclass LDKEvent_DiscardFunding_class = NULL;
5385 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
5386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5387 LDKEvent_FundingGenerationReady_class =
5388 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5389 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5390 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5391 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5392 LDKEvent_PaymentReceived_class =
5393 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5394 CHECK(LDKEvent_PaymentReceived_class != NULL);
5395 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5396 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5397 LDKEvent_PaymentSent_class =
5398 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5399 CHECK(LDKEvent_PaymentSent_class != NULL);
5400 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B)V");
5401 CHECK(LDKEvent_PaymentSent_meth != NULL);
5402 LDKEvent_PaymentPathFailed_class =
5403 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5404 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5405 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[JJ)V");
5406 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5407 LDKEvent_PendingHTLCsForwardable_class =
5408 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5409 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5410 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5411 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5412 LDKEvent_SpendableOutputs_class =
5413 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5414 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5415 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5416 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5417 LDKEvent_PaymentForwarded_class =
5418 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5419 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5420 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5421 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5422 LDKEvent_ChannelClosed_class =
5423 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5424 CHECK(LDKEvent_ChannelClosed_class != NULL);
5425 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
5426 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5427 LDKEvent_DiscardFunding_class =
5428 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;"));
5429 CHECK(LDKEvent_DiscardFunding_class != NULL);
5430 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
5431 CHECK(LDKEvent_DiscardFunding_meth != NULL);
5433 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5434 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5436 case LDKEvent_FundingGenerationReady: {
5437 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5438 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5439 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5440 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5441 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5442 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);
5444 case LDKEvent_PaymentReceived: {
5445 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5446 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5447 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5448 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5450 case LDKEvent_PaymentSent: {
5451 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5452 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5453 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5454 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
5455 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr, payment_hash_arr);
5457 case LDKEvent_PaymentPathFailed: {
5458 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5459 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5460 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5461 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5462 int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
5463 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5464 for (size_t k = 0; k < path_var.datalen; k++) {
5465 LDKRouteHop path_conv_10_var = path_var.data[k];
5466 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5467 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5468 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5469 path_arr_ptr[k] = path_conv_10_ref;
5471 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5472 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
5473 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);
5475 case LDKEvent_PendingHTLCsForwardable: {
5476 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5478 case LDKEvent_SpendableOutputs: {
5479 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5480 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5481 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5482 for (size_t b = 0; b < outputs_var.datalen; b++) {
5483 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5484 outputs_arr_ptr[b] = outputs_conv_27_ref;
5486 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5487 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5489 case LDKEvent_PaymentForwarded: {
5490 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5491 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5493 case LDKEvent_ChannelClosed: {
5494 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5495 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5496 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5497 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
5499 case LDKEvent_DiscardFunding: {
5500 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5501 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
5502 LDKTransaction transaction_var = obj->discard_funding.transaction;
5503 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
5504 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
5505 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
5510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5511 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5512 ret->datalen = (*env)->GetArrayLength(env, elems);
5513 if (ret->datalen == 0) {
5516 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5517 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5518 for (size_t i = 0; i < ret->datalen; i++) {
5519 int64_t arr_elem = java_elems[i];
5520 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5521 CHECK_ACCESS(arr_elem_ptr);
5522 LDKEvent arr_elem_conv = *(LDKEvent*)(arr_elem_ptr);
5523 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5524 ret->data[i] = arr_elem_conv;
5526 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5528 return (uint64_t)ret;
5530 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5531 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5532 for (size_t i = 0; i < ret.datalen; i++) {
5533 ret.data[i] = Event_clone(&orig->data[i]);
5537 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5540 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5541 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5542 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
5546 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5547 return TxOut_clone(&tuple->b);
5549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5550 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5551 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5552 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
5553 return (uint64_t)ret_ref;
5556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5557 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5558 ret->datalen = (*env)->GetArrayLength(env, elems);
5559 if (ret->datalen == 0) {
5562 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5563 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5564 for (size_t i = 0; i < ret->datalen; i++) {
5565 int64_t arr_elem = java_elems[i];
5566 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5567 CHECK_ACCESS(arr_elem_ptr);
5568 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(arr_elem_ptr);
5569 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5570 ret->data[i] = arr_elem_conv;
5572 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5574 return (uint64_t)ret;
5576 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5577 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5578 for (size_t i = 0; i < ret.datalen; i++) {
5579 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5583 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5584 return ThirtyTwoBytes_clone(&tuple->a);
5586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5587 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5588 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5589 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data);
5593 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5594 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
5596 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5597 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5598 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
5599 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5600 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5601 for (size_t u = 0; u < ret_var.datalen; u++) {
5602 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5603 *ret_conv_20_conv = ret_var.data[u];
5604 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
5606 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5612 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5613 ret->datalen = (*env)->GetArrayLength(env, elems);
5614 if (ret->datalen == 0) {
5617 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5618 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5619 for (size_t i = 0; i < ret->datalen; i++) {
5620 int64_t arr_elem = java_elems[i];
5621 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5622 CHECK_ACCESS(arr_elem_ptr);
5623 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arr_elem_ptr);
5624 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5625 ret->data[i] = arr_elem_conv;
5627 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5629 return (uint64_t)ret;
5631 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5632 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 };
5633 for (size_t i = 0; i < ret.datalen; i++) {
5634 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5638 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5639 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5640 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5641 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5642 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5643 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5644 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5645 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5647 LDKBalance_ClaimableOnChannelClose_class =
5648 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
5649 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5650 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5651 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5652 LDKBalance_ClaimableAwaitingConfirmations_class =
5653 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
5654 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5655 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5656 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5657 LDKBalance_ContentiousClaimable_class =
5658 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
5659 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5660 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5661 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5662 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5663 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
5664 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5665 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5666 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5668 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5669 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5671 case LDKBalance_ClaimableOnChannelClose: {
5672 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5674 case LDKBalance_ClaimableAwaitingConfirmations: {
5675 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5677 case LDKBalance_ContentiousClaimable: {
5678 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5680 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5681 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);
5686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5687 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
5688 ret->datalen = (*env)->GetArrayLength(env, elems);
5689 if (ret->datalen == 0) {
5692 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
5693 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5694 for (size_t i = 0; i < ret->datalen; i++) {
5695 int64_t arr_elem = java_elems[i];
5696 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5697 CHECK_ACCESS(arr_elem_ptr);
5698 LDKBalance arr_elem_conv = *(LDKBalance*)(arr_elem_ptr);
5699 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
5700 ret->data[i] = arr_elem_conv;
5702 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5704 return (uint64_t)ret;
5706 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5707 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5708 for (size_t i = 0; i < ret.datalen; i++) {
5709 ret.data[i] = Balance_clone(&orig->data[i]);
5713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5714 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5717 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5718 CHECK(val->result_ok);
5719 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5720 *res_conv = (*val->contents.result);
5721 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
5722 return ((uint64_t)res_conv);
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5725 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5726 CHECK(!val->result_ok);
5727 LDKDecodeError err_var = (*val->contents.err);
5728 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5729 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5730 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5734 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5737 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5738 CHECK(val->result_ok);
5739 return *val->contents.result;
5741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5742 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5743 CHECK(!val->result_ok);
5744 LDKLightningError err_var = (*val->contents.err);
5745 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5746 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5747 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5750 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5754 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5755 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form);
5760 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5761 return Type_clone(&tuple->b);
5763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5764 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5765 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
5766 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
5767 return (uint64_t)ret_ret;
5770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5771 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
5772 ret->datalen = (*env)->GetArrayLength(env, elems);
5773 if (ret->datalen == 0) {
5776 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
5777 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5778 for (size_t i = 0; i < ret->datalen; i++) {
5779 int64_t arr_elem = java_elems[i];
5780 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5781 CHECK_ACCESS(arr_elem_ptr);
5782 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(arr_elem_ptr);
5783 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
5784 ret->data[i] = arr_elem_conv;
5786 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5788 return (uint64_t)ret;
5790 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5791 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5792 for (size_t i = 0; i < ret.datalen; i++) {
5793 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5798 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5801 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5802 CHECK(val->result_ok);
5803 return *val->contents.result;
5805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5806 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5807 CHECK(!val->result_ok);
5808 LDKLightningError err_var = (*val->contents.err);
5809 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5810 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5811 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5814 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5815 return ChannelAnnouncement_clone(&tuple->a);
5817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5818 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5819 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
5820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5822 uint64_t ret_ref = (uint64_t)ret_var.inner;
5823 if (ret_var.is_owned) {
5829 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5830 return ChannelUpdate_clone(&tuple->b);
5832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5833 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5834 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
5835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5837 uint64_t ret_ref = (uint64_t)ret_var.inner;
5838 if (ret_var.is_owned) {
5844 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5845 return ChannelUpdate_clone(&tuple->c);
5847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
5848 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5849 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
5850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5852 uint64_t ret_ref = (uint64_t)ret_var.inner;
5853 if (ret_var.is_owned) {
5859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5860 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5861 ret->datalen = (*env)->GetArrayLength(env, elems);
5862 if (ret->datalen == 0) {
5865 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5866 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5867 for (size_t i = 0; i < ret->datalen; i++) {
5868 int64_t arr_elem = java_elems[i];
5869 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5870 CHECK_ACCESS(arr_elem_ptr);
5871 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arr_elem_ptr);
5872 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5873 ret->data[i] = arr_elem_conv;
5875 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5877 return (uint64_t)ret;
5879 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5880 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5881 for (size_t i = 0; i < ret.datalen; i++) {
5882 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5887 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5888 ret->datalen = (*env)->GetArrayLength(env, elems);
5889 if (ret->datalen == 0) {
5892 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5893 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5894 for (size_t i = 0; i < ret->datalen; i++) {
5895 int64_t arr_elem = java_elems[i];
5896 LDKNodeAnnouncement arr_elem_conv;
5897 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5898 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5899 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5900 ret->data[i] = arr_elem_conv;
5902 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5904 return (uint64_t)ret;
5906 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5907 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5908 for (size_t i = 0; i < ret.datalen; i++) {
5909 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5914 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5917 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5918 CHECK(val->result_ok);
5919 LDKCVec_u8Z res_var = (*val->contents.result);
5920 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5921 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5925 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5926 CHECK(!val->result_ok);
5927 LDKPeerHandleError err_var = (*val->contents.err);
5928 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5929 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5930 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5934 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5937 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5938 CHECK(val->result_ok);
5939 return *val->contents.result;
5941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5942 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5943 CHECK(!val->result_ok);
5944 LDKPeerHandleError err_var = (*val->contents.err);
5945 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5946 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5947 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5951 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5954 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5955 CHECK(val->result_ok);
5956 return *val->contents.result;
5958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5959 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5960 CHECK(!val->result_ok);
5961 LDKPeerHandleError err_var = (*val->contents.err);
5962 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5963 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5964 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5968 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
5970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5971 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
5972 CHECK(val->result_ok);
5973 LDKNodeId res_var = (*val->contents.result);
5974 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5980 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
5981 CHECK(!val->result_ok);
5982 LDKDecodeError err_var = (*val->contents.err);
5983 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5984 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5985 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5988 typedef struct LDKAccess_JCalls {
5989 atomic_size_t refcnt;
5992 jmethodID get_utxo_meth;
5994 static void LDKAccess_JCalls_free(void* this_arg) {
5995 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5996 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5998 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5999 if (get_jenv_res == JNI_EDETACHED) {
6000 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6002 DO_ASSERT(get_jenv_res == JNI_OK);
6004 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6005 if (get_jenv_res == JNI_EDETACHED) {
6006 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6011 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6012 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6014 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6015 if (get_jenv_res == JNI_EDETACHED) {
6016 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6018 DO_ASSERT(get_jenv_res == JNI_OK);
6020 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6021 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6022 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6024 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6025 if ((*env)->ExceptionCheck(env)) {
6026 (*env)->ExceptionDescribe(env);
6027 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6029 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6030 CHECK_ACCESS(ret_ptr);
6031 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
6032 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6033 if (get_jenv_res == JNI_EDETACHED) {
6034 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6038 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6039 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6040 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6042 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6043 jclass c = (*env)->GetObjectClass(env, o);
6045 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6046 atomic_init(&calls->refcnt, 1);
6047 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6048 calls->o = (*env)->NewWeakGlobalRef(env, o);
6049 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6050 CHECK(calls->get_utxo_meth != NULL);
6053 .this_arg = (void*) calls,
6054 .get_utxo = get_utxo_LDKAccess_jcall,
6055 .free = LDKAccess_JCalls_free,
6059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6060 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6061 *res_ptr = LDKAccess_init(env, clz, o);
6062 return (uint64_t)res_ptr;
6064 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) {
6065 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6066 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6067 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
6068 unsigned char genesis_hash_arr[32];
6069 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6070 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6071 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6072 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6073 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6074 return (uint64_t)ret_conv;
6077 static jclass LDKCOption_AccessZ_Some_class = NULL;
6078 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
6079 static jclass LDKCOption_AccessZ_None_class = NULL;
6080 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
6081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
6082 LDKCOption_AccessZ_Some_class =
6083 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
6084 CHECK(LDKCOption_AccessZ_Some_class != NULL);
6085 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
6086 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
6087 LDKCOption_AccessZ_None_class =
6088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
6089 CHECK(LDKCOption_AccessZ_None_class != NULL);
6090 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
6091 CHECK(LDKCOption_AccessZ_None_meth != NULL);
6093 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6094 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6096 case LDKCOption_AccessZ_Some: {
6097 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
6098 *some_ret = obj->some;
6099 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
6100 if ((*some_ret).free == LDKAccess_JCalls_free) {
6101 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6102 LDKAccess_JCalls_cloned(&(*some_ret));
6104 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
6106 case LDKCOption_AccessZ_None: {
6107 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
6112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6113 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
6115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6116 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6117 CHECK(val->result_ok);
6118 LDKDirectionalChannelInfo res_var = (*val->contents.result);
6119 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6120 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6121 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6125 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6126 CHECK(!val->result_ok);
6127 LDKDecodeError err_var = (*val->contents.err);
6128 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6129 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6130 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6134 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
6136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6137 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6138 CHECK(val->result_ok);
6139 LDKChannelInfo res_var = (*val->contents.result);
6140 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6141 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6142 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6146 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6147 CHECK(!val->result_ok);
6148 LDKDecodeError err_var = (*val->contents.err);
6149 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6150 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6151 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6155 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
6157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6158 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6159 CHECK(val->result_ok);
6160 LDKRoutingFees res_var = (*val->contents.result);
6161 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6162 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6163 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6167 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6168 CHECK(!val->result_ok);
6169 LDKDecodeError err_var = (*val->contents.err);
6170 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6171 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6172 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6176 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
6178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6179 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6180 CHECK(val->result_ok);
6181 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
6182 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6183 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6184 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6188 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6189 CHECK(!val->result_ok);
6190 LDKDecodeError err_var = (*val->contents.err);
6191 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6192 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6193 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6197 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
6198 ret->datalen = (*env)->GetArrayLength(env, elems);
6199 if (ret->datalen == 0) {
6202 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
6203 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6204 for (size_t i = 0; i < ret->datalen; i++) {
6205 ret->data[i] = java_elems[i];
6207 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6209 return (uint64_t)ret;
6211 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6212 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6213 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6217 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6220 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6221 CHECK(val->result_ok);
6222 LDKNodeInfo res_var = (*val->contents.result);
6223 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6224 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6225 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6229 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6230 CHECK(!val->result_ok);
6231 LDKDecodeError err_var = (*val->contents.err);
6232 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6233 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6234 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6238 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6241 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6242 CHECK(val->result_ok);
6243 LDKNetworkGraph res_var = (*val->contents.result);
6244 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6245 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6246 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6250 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6251 CHECK(!val->result_ok);
6252 LDKDecodeError err_var = (*val->contents.err);
6253 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6254 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6255 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6258 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6259 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6260 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6261 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6263 LDKCOption_CVec_NetAddressZZ_Some_class =
6264 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;"));
6265 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6266 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6267 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6268 LDKCOption_CVec_NetAddressZZ_None_class =
6269 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;"));
6270 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6271 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6272 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6274 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6275 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6277 case LDKCOption_CVec_NetAddressZZ_Some: {
6278 LDKCVec_NetAddressZ some_var = obj->some;
6279 int64_tArray some_arr = (*env)->NewLongArray(env, some_var.datalen);
6280 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6281 for (size_t m = 0; m < some_var.datalen; m++) {
6282 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
6283 some_arr_ptr[m] = some_conv_12_ref;
6285 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6286 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6288 case LDKCOption_CVec_NetAddressZZ_None: {
6289 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6295 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
6297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6298 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6299 CHECK(val->result_ok);
6300 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6303 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6304 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6305 CHECK(!val->result_ok);
6306 return *val->contents.err;
6308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6309 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
6311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6312 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6313 CHECK(val->result_ok);
6314 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6315 *res_conv = (*val->contents.result);
6316 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
6317 return (uint64_t)res_conv;
6319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6320 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6321 CHECK(!val->result_ok);
6322 LDKDecodeError err_var = (*val->contents.err);
6323 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6324 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6325 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6329 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6332 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6333 CHECK(val->result_ok);
6334 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6338 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6339 CHECK(!val->result_ok);
6340 LDKDecodeError err_var = (*val->contents.err);
6341 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6342 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6343 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6347 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6348 ret->datalen = (*env)->GetArrayLength(env, elems);
6349 if (ret->datalen == 0) {
6352 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6353 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6354 for (size_t i = 0; i < ret->datalen; i++) {
6355 int64_t arr_elem = java_elems[i];
6356 LDKUpdateAddHTLC arr_elem_conv;
6357 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6358 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6359 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6360 ret->data[i] = arr_elem_conv;
6362 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6364 return (uint64_t)ret;
6366 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6367 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6368 for (size_t i = 0; i < ret.datalen; i++) {
6369 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6374 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6375 ret->datalen = (*env)->GetArrayLength(env, elems);
6376 if (ret->datalen == 0) {
6379 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6380 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6381 for (size_t i = 0; i < ret->datalen; i++) {
6382 int64_t arr_elem = java_elems[i];
6383 LDKUpdateFulfillHTLC arr_elem_conv;
6384 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6385 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6386 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6387 ret->data[i] = arr_elem_conv;
6389 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6391 return (uint64_t)ret;
6393 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6394 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6395 for (size_t i = 0; i < ret.datalen; i++) {
6396 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6401 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6402 ret->datalen = (*env)->GetArrayLength(env, elems);
6403 if (ret->datalen == 0) {
6406 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6407 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6408 for (size_t i = 0; i < ret->datalen; i++) {
6409 int64_t arr_elem = java_elems[i];
6410 LDKUpdateFailHTLC arr_elem_conv;
6411 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6412 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6413 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6414 ret->data[i] = arr_elem_conv;
6416 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6418 return (uint64_t)ret;
6420 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6421 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6422 for (size_t i = 0; i < ret.datalen; i++) {
6423 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6428 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6429 ret->datalen = (*env)->GetArrayLength(env, elems);
6430 if (ret->datalen == 0) {
6433 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6434 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6435 for (size_t i = 0; i < ret->datalen; i++) {
6436 int64_t arr_elem = java_elems[i];
6437 LDKUpdateFailMalformedHTLC arr_elem_conv;
6438 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6439 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6440 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6441 ret->data[i] = arr_elem_conv;
6443 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6445 return (uint64_t)ret;
6447 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6448 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6449 for (size_t i = 0; i < ret.datalen; i++) {
6450 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6455 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6458 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6459 CHECK(val->result_ok);
6460 LDKAcceptChannel res_var = (*val->contents.result);
6461 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6462 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6463 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6467 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6468 CHECK(!val->result_ok);
6469 LDKDecodeError err_var = (*val->contents.err);
6470 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6471 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6472 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6476 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6479 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6480 CHECK(val->result_ok);
6481 LDKAnnouncementSignatures res_var = (*val->contents.result);
6482 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6483 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6484 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6488 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6489 CHECK(!val->result_ok);
6490 LDKDecodeError err_var = (*val->contents.err);
6491 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6492 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6493 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6497 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6500 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6501 CHECK(val->result_ok);
6502 LDKChannelReestablish res_var = (*val->contents.result);
6503 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6504 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6505 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6509 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6510 CHECK(!val->result_ok);
6511 LDKDecodeError err_var = (*val->contents.err);
6512 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6513 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6514 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6518 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6521 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6522 CHECK(val->result_ok);
6523 LDKClosingSigned res_var = (*val->contents.result);
6524 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6525 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6526 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6530 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6531 CHECK(!val->result_ok);
6532 LDKDecodeError err_var = (*val->contents.err);
6533 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6534 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6535 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6539 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6542 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6543 CHECK(val->result_ok);
6544 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6545 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6546 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6547 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6551 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6552 CHECK(!val->result_ok);
6553 LDKDecodeError err_var = (*val->contents.err);
6554 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6555 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6556 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6560 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6563 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6564 CHECK(val->result_ok);
6565 LDKCommitmentSigned res_var = (*val->contents.result);
6566 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6567 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6568 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6572 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6573 CHECK(!val->result_ok);
6574 LDKDecodeError err_var = (*val->contents.err);
6575 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6576 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6577 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6581 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6584 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6585 CHECK(val->result_ok);
6586 LDKFundingCreated res_var = (*val->contents.result);
6587 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6588 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6589 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6593 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6594 CHECK(!val->result_ok);
6595 LDKDecodeError err_var = (*val->contents.err);
6596 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6597 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6598 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6602 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6605 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6606 CHECK(val->result_ok);
6607 LDKFundingSigned res_var = (*val->contents.result);
6608 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6609 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6610 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6614 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6615 CHECK(!val->result_ok);
6616 LDKDecodeError err_var = (*val->contents.err);
6617 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6618 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6619 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6623 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
6625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6626 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6627 CHECK(val->result_ok);
6628 LDKFundingLocked res_var = (*val->contents.result);
6629 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6630 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6631 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6635 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6636 CHECK(!val->result_ok);
6637 LDKDecodeError err_var = (*val->contents.err);
6638 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6639 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6640 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6644 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
6646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6647 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6648 CHECK(val->result_ok);
6649 LDKInit res_var = (*val->contents.result);
6650 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6651 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6652 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6656 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6657 CHECK(!val->result_ok);
6658 LDKDecodeError err_var = (*val->contents.err);
6659 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6660 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6661 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6665 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
6667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6668 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6669 CHECK(val->result_ok);
6670 LDKOpenChannel res_var = (*val->contents.result);
6671 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6672 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6673 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6677 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6678 CHECK(!val->result_ok);
6679 LDKDecodeError err_var = (*val->contents.err);
6680 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6681 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6682 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6686 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
6688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6689 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6690 CHECK(val->result_ok);
6691 LDKRevokeAndACK res_var = (*val->contents.result);
6692 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6693 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6694 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6698 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6699 CHECK(!val->result_ok);
6700 LDKDecodeError err_var = (*val->contents.err);
6701 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6702 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6703 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6707 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
6709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6710 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6711 CHECK(val->result_ok);
6712 LDKShutdown res_var = (*val->contents.result);
6713 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6714 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6715 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6719 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6720 CHECK(!val->result_ok);
6721 LDKDecodeError err_var = (*val->contents.err);
6722 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6723 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6724 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6728 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
6730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6731 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6732 CHECK(val->result_ok);
6733 LDKUpdateFailHTLC res_var = (*val->contents.result);
6734 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6735 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6736 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6740 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6741 CHECK(!val->result_ok);
6742 LDKDecodeError err_var = (*val->contents.err);
6743 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6744 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6745 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6749 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
6751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6752 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6753 CHECK(val->result_ok);
6754 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6755 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6756 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6757 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6761 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6762 CHECK(!val->result_ok);
6763 LDKDecodeError err_var = (*val->contents.err);
6764 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6765 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6766 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6770 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
6772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6773 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6774 CHECK(val->result_ok);
6775 LDKUpdateFee res_var = (*val->contents.result);
6776 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6777 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6778 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6782 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6783 CHECK(!val->result_ok);
6784 LDKDecodeError err_var = (*val->contents.err);
6785 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6786 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6787 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6791 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
6793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6794 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6795 CHECK(val->result_ok);
6796 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6797 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6798 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6799 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6803 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6804 CHECK(!val->result_ok);
6805 LDKDecodeError err_var = (*val->contents.err);
6806 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6807 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6808 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6812 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
6814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6815 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6816 CHECK(val->result_ok);
6817 LDKUpdateAddHTLC res_var = (*val->contents.result);
6818 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6819 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6820 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6824 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6825 CHECK(!val->result_ok);
6826 LDKDecodeError err_var = (*val->contents.err);
6827 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6828 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6829 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6833 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
6835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6836 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6837 CHECK(val->result_ok);
6838 LDKPing res_var = (*val->contents.result);
6839 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6840 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6841 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6845 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6846 CHECK(!val->result_ok);
6847 LDKDecodeError err_var = (*val->contents.err);
6848 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6849 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6850 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6854 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
6856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6857 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6858 CHECK(val->result_ok);
6859 LDKPong res_var = (*val->contents.result);
6860 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6861 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6862 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6866 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6867 CHECK(!val->result_ok);
6868 LDKDecodeError err_var = (*val->contents.err);
6869 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6870 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6871 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6875 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6878 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6879 CHECK(val->result_ok);
6880 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
6881 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6882 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6883 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6887 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6888 CHECK(!val->result_ok);
6889 LDKDecodeError err_var = (*val->contents.err);
6890 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6891 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6892 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6896 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6899 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6900 CHECK(val->result_ok);
6901 LDKChannelAnnouncement res_var = (*val->contents.result);
6902 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6903 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6904 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6908 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6909 CHECK(!val->result_ok);
6910 LDKDecodeError err_var = (*val->contents.err);
6911 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6912 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6913 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6917 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
6919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6920 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6921 CHECK(val->result_ok);
6922 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
6923 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6924 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6925 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6929 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6930 CHECK(!val->result_ok);
6931 LDKDecodeError err_var = (*val->contents.err);
6932 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6933 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6934 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6938 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6941 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6942 CHECK(val->result_ok);
6943 LDKChannelUpdate res_var = (*val->contents.result);
6944 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6945 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6946 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6950 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6951 CHECK(!val->result_ok);
6952 LDKDecodeError err_var = (*val->contents.err);
6953 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6954 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6955 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6959 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6962 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6963 CHECK(val->result_ok);
6964 LDKErrorMessage res_var = (*val->contents.result);
6965 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6966 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6967 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6971 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6972 CHECK(!val->result_ok);
6973 LDKDecodeError err_var = (*val->contents.err);
6974 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6975 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6976 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6980 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6983 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6984 CHECK(val->result_ok);
6985 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6986 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6987 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6988 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6992 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6993 CHECK(!val->result_ok);
6994 LDKDecodeError err_var = (*val->contents.err);
6995 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6996 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6997 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7001 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
7003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7004 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7005 CHECK(val->result_ok);
7006 LDKNodeAnnouncement res_var = (*val->contents.result);
7007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7009 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7013 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7014 CHECK(!val->result_ok);
7015 LDKDecodeError err_var = (*val->contents.err);
7016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7018 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7022 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
7024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7025 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7026 CHECK(val->result_ok);
7027 LDKQueryShortChannelIds res_var = (*val->contents.result);
7028 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7029 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7030 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7034 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7035 CHECK(!val->result_ok);
7036 LDKDecodeError err_var = (*val->contents.err);
7037 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7038 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7039 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7043 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
7045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7046 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7047 CHECK(val->result_ok);
7048 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
7049 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7050 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7051 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7055 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7056 CHECK(!val->result_ok);
7057 LDKDecodeError err_var = (*val->contents.err);
7058 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7059 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7060 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7064 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
7066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7067 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7068 CHECK(val->result_ok);
7069 LDKQueryChannelRange res_var = (*val->contents.result);
7070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7076 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7077 CHECK(!val->result_ok);
7078 LDKDecodeError err_var = (*val->contents.err);
7079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7085 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
7087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7088 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7089 CHECK(val->result_ok);
7090 LDKReplyChannelRange res_var = (*val->contents.result);
7091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7097 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7098 CHECK(!val->result_ok);
7099 LDKDecodeError err_var = (*val->contents.err);
7100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7106 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
7108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7109 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7110 CHECK(val->result_ok);
7111 LDKGossipTimestampFilter res_var = (*val->contents.result);
7112 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7113 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7114 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7118 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7119 CHECK(!val->result_ok);
7120 LDKDecodeError err_var = (*val->contents.err);
7121 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7122 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7123 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7126 static jclass LDKSignOrCreationError_SignError_class = NULL;
7127 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
7128 static jclass LDKSignOrCreationError_CreationError_class = NULL;
7129 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
7130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
7131 LDKSignOrCreationError_SignError_class =
7132 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
7133 CHECK(LDKSignOrCreationError_SignError_class != NULL);
7134 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
7135 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
7136 LDKSignOrCreationError_CreationError_class =
7137 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
7138 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
7139 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
7140 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
7142 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7143 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7145 case LDKSignOrCreationError_SignError: {
7146 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
7148 case LDKSignOrCreationError_CreationError: {
7149 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
7150 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
7155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7156 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
7158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7159 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7160 CHECK(val->result_ok);
7161 LDKInvoice res_var = (*val->contents.result);
7162 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7163 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7164 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7168 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7169 CHECK(!val->result_ok);
7170 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
7173 typedef struct LDKFilter_JCalls {
7174 atomic_size_t refcnt;
7177 jmethodID register_tx_meth;
7178 jmethodID register_output_meth;
7180 static void LDKFilter_JCalls_free(void* this_arg) {
7181 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7182 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7184 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7185 if (get_jenv_res == JNI_EDETACHED) {
7186 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7188 DO_ASSERT(get_jenv_res == JNI_OK);
7190 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7191 if (get_jenv_res == JNI_EDETACHED) {
7192 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7197 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7198 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7200 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7201 if (get_jenv_res == JNI_EDETACHED) {
7202 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7204 DO_ASSERT(get_jenv_res == JNI_OK);
7206 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7207 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7208 LDKu8slice script_pubkey_var = script_pubkey;
7209 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
7210 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
7211 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7213 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
7214 if ((*env)->ExceptionCheck(env)) {
7215 (*env)->ExceptionDescribe(env);
7216 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
7218 if (get_jenv_res == JNI_EDETACHED) {
7219 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7222 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7223 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7225 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7226 if (get_jenv_res == JNI_EDETACHED) {
7227 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7229 DO_ASSERT(get_jenv_res == JNI_OK);
7231 LDKWatchedOutput output_var = output;
7232 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7233 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7234 uint64_t output_ref = (uint64_t)output_var.inner;
7235 if (output_var.is_owned) {
7238 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7240 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7241 if ((*env)->ExceptionCheck(env)) {
7242 (*env)->ExceptionDescribe(env);
7243 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7245 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7246 CHECK_ACCESS(ret_ptr);
7247 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7248 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7249 if (get_jenv_res == JNI_EDETACHED) {
7250 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7254 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7255 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7256 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7258 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7259 jclass c = (*env)->GetObjectClass(env, o);
7261 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7262 atomic_init(&calls->refcnt, 1);
7263 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7264 calls->o = (*env)->NewWeakGlobalRef(env, o);
7265 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7266 CHECK(calls->register_tx_meth != NULL);
7267 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7268 CHECK(calls->register_output_meth != NULL);
7271 .this_arg = (void*) calls,
7272 .register_tx = register_tx_LDKFilter_jcall,
7273 .register_output = register_output_LDKFilter_jcall,
7274 .free = LDKFilter_JCalls_free,
7278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7279 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7280 *res_ptr = LDKFilter_init(env, clz, o);
7281 return (uint64_t)res_ptr;
7283 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) {
7284 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7285 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7286 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7287 unsigned char txid_arr[32];
7288 CHECK((*env)->GetArrayLength(env, txid) == 32);
7289 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7290 unsigned char (*txid_ref)[32] = &txid_arr;
7291 LDKu8slice script_pubkey_ref;
7292 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7293 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7294 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7295 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7299 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7300 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7301 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7302 LDKWatchedOutput output_conv;
7303 output_conv.inner = (void*)(output & (~1));
7304 output_conv.is_owned = (output & 1) || (output == 0);
7305 output_conv = WatchedOutput_clone(&output_conv);
7306 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7307 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7308 uint64_t ret_ref = (uint64_t)ret_copy;
7312 static jclass LDKCOption_FilterZ_Some_class = NULL;
7313 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7314 static jclass LDKCOption_FilterZ_None_class = NULL;
7315 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7317 LDKCOption_FilterZ_Some_class =
7318 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7319 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7320 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7321 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7322 LDKCOption_FilterZ_None_class =
7323 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7324 CHECK(LDKCOption_FilterZ_None_class != NULL);
7325 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7326 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7328 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7329 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7331 case LDKCOption_FilterZ_Some: {
7332 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
7333 *some_ret = obj->some;
7334 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7335 if ((*some_ret).free == LDKFilter_JCalls_free) {
7336 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7337 LDKFilter_JCalls_cloned(&(*some_ret));
7339 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7341 case LDKCOption_FilterZ_None: {
7342 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7348 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
7350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7351 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7352 CHECK(val->result_ok);
7353 LDKLockedChannelMonitor res_var = (*val->contents.result);
7354 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7355 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7356 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7360 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7361 CHECK(!val->result_ok);
7362 return *val->contents.err;
7364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
7365 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
7366 ret->datalen = (*env)->GetArrayLength(env, elems);
7367 if (ret->datalen == 0) {
7370 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
7371 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
7372 for (size_t i = 0; i < ret->datalen; i++) {
7373 int64_t arr_elem = java_elems[i];
7374 LDKOutPoint arr_elem_conv;
7375 arr_elem_conv.inner = (void*)(arr_elem & (~1));
7376 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
7377 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
7378 ret->data[i] = arr_elem_conv;
7380 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
7382 return (uint64_t)ret;
7384 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7385 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7386 for (size_t i = 0; i < ret.datalen; i++) {
7387 ret.data[i] = OutPoint_clone(&orig->data[i]);
7391 typedef struct LDKMessageSendEventsProvider_JCalls {
7392 atomic_size_t refcnt;
7395 jmethodID get_and_clear_pending_msg_events_meth;
7396 } LDKMessageSendEventsProvider_JCalls;
7397 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7398 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7399 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7402 if (get_jenv_res == JNI_EDETACHED) {
7403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7405 DO_ASSERT(get_jenv_res == JNI_OK);
7407 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7408 if (get_jenv_res == JNI_EDETACHED) {
7409 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7414 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7415 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7417 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7418 if (get_jenv_res == JNI_EDETACHED) {
7419 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7421 DO_ASSERT(get_jenv_res == JNI_OK);
7423 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7425 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7426 if ((*env)->ExceptionCheck(env)) {
7427 (*env)->ExceptionDescribe(env);
7428 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7430 LDKCVec_MessageSendEventZ ret_constr;
7431 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7432 if (ret_constr.datalen > 0)
7433 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7435 ret_constr.data = NULL;
7436 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7437 for (size_t s = 0; s < ret_constr.datalen; s++) {
7438 int64_t ret_conv_18 = ret_vals[s];
7439 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
7440 CHECK_ACCESS(ret_conv_18_ptr);
7441 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7442 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7443 ret_constr.data[s] = ret_conv_18_conv;
7445 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7446 if (get_jenv_res == JNI_EDETACHED) {
7447 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7451 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7452 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7453 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7455 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7456 jclass c = (*env)->GetObjectClass(env, o);
7458 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7459 atomic_init(&calls->refcnt, 1);
7460 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7461 calls->o = (*env)->NewWeakGlobalRef(env, o);
7462 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7463 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7465 LDKMessageSendEventsProvider ret = {
7466 .this_arg = (void*) calls,
7467 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7468 .free = LDKMessageSendEventsProvider_JCalls_free,
7472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7473 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7474 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7475 return (uint64_t)res_ptr;
7477 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7478 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7479 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7480 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7481 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7482 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7483 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7484 for (size_t s = 0; s < ret_var.datalen; s++) {
7485 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7486 *ret_conv_18_copy = ret_var.data[s];
7487 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7488 ret_arr_ptr[s] = ret_conv_18_ref;
7490 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7495 typedef struct LDKEventHandler_JCalls {
7496 atomic_size_t refcnt;
7499 jmethodID handle_event_meth;
7500 } LDKEventHandler_JCalls;
7501 static void LDKEventHandler_JCalls_free(void* this_arg) {
7502 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7505 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7506 if (get_jenv_res == JNI_EDETACHED) {
7507 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7509 DO_ASSERT(get_jenv_res == JNI_OK);
7511 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7512 if (get_jenv_res == JNI_EDETACHED) {
7513 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7518 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7519 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7521 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7522 if (get_jenv_res == JNI_EDETACHED) {
7523 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7525 DO_ASSERT(get_jenv_res == JNI_OK);
7527 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7528 *ret_event = Event_clone(event);
7529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7531 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7532 if ((*env)->ExceptionCheck(env)) {
7533 (*env)->ExceptionDescribe(env);
7534 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7536 if (get_jenv_res == JNI_EDETACHED) {
7537 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7540 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7541 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7542 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7544 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7545 jclass c = (*env)->GetObjectClass(env, o);
7547 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7548 atomic_init(&calls->refcnt, 1);
7549 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7550 calls->o = (*env)->NewWeakGlobalRef(env, o);
7551 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7552 CHECK(calls->handle_event_meth != NULL);
7554 LDKEventHandler ret = {
7555 .this_arg = (void*) calls,
7556 .handle_event = handle_event_LDKEventHandler_jcall,
7557 .free = LDKEventHandler_JCalls_free,
7561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7562 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7563 *res_ptr = LDKEventHandler_init(env, clz, o);
7564 return (uint64_t)res_ptr;
7566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7567 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7568 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7569 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
7570 LDKEvent* event_conv = (LDKEvent*)event;
7571 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7574 typedef struct LDKEventsProvider_JCalls {
7575 atomic_size_t refcnt;
7578 jmethodID process_pending_events_meth;
7579 } LDKEventsProvider_JCalls;
7580 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7581 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7582 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7584 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7585 if (get_jenv_res == JNI_EDETACHED) {
7586 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7588 DO_ASSERT(get_jenv_res == JNI_OK);
7590 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7591 if (get_jenv_res == JNI_EDETACHED) {
7592 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7597 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7598 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7600 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7601 if (get_jenv_res == JNI_EDETACHED) {
7602 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7604 DO_ASSERT(get_jenv_res == JNI_OK);
7606 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7607 *handler_ret = handler;
7608 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7610 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7611 if ((*env)->ExceptionCheck(env)) {
7612 (*env)->ExceptionDescribe(env);
7613 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7615 if (get_jenv_res == JNI_EDETACHED) {
7616 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7619 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7620 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7621 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7623 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7624 jclass c = (*env)->GetObjectClass(env, o);
7626 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7627 atomic_init(&calls->refcnt, 1);
7628 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7629 calls->o = (*env)->NewWeakGlobalRef(env, o);
7630 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7631 CHECK(calls->process_pending_events_meth != NULL);
7633 LDKEventsProvider ret = {
7634 .this_arg = (void*) calls,
7635 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7636 .free = LDKEventsProvider_JCalls_free,
7640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7641 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7642 *res_ptr = LDKEventsProvider_init(env, clz, o);
7643 return (uint64_t)res_ptr;
7645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7646 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7647 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7648 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
7649 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
7650 CHECK_ACCESS(handler_ptr);
7651 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
7652 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7654 LDKEventHandler_JCalls_cloned(&handler_conv);
7656 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7659 typedef struct LDKListen_JCalls {
7660 atomic_size_t refcnt;
7663 jmethodID block_connected_meth;
7664 jmethodID block_disconnected_meth;
7666 static void LDKListen_JCalls_free(void* this_arg) {
7667 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7668 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7677 if (get_jenv_res == JNI_EDETACHED) {
7678 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7683 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7684 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7686 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7687 if (get_jenv_res == JNI_EDETACHED) {
7688 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7690 DO_ASSERT(get_jenv_res == JNI_OK);
7692 LDKu8slice block_var = block;
7693 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7694 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7695 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7697 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7698 if ((*env)->ExceptionCheck(env)) {
7699 (*env)->ExceptionDescribe(env);
7700 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
7702 if (get_jenv_res == JNI_EDETACHED) {
7703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7706 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7707 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7709 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7710 if (get_jenv_res == JNI_EDETACHED) {
7711 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7713 DO_ASSERT(get_jenv_res == JNI_OK);
7715 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7716 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7717 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7719 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7720 if ((*env)->ExceptionCheck(env)) {
7721 (*env)->ExceptionDescribe(env);
7722 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7724 if (get_jenv_res == JNI_EDETACHED) {
7725 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7728 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7729 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7730 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7732 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7733 jclass c = (*env)->GetObjectClass(env, o);
7735 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7736 atomic_init(&calls->refcnt, 1);
7737 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7738 calls->o = (*env)->NewWeakGlobalRef(env, o);
7739 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7740 CHECK(calls->block_connected_meth != NULL);
7741 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7742 CHECK(calls->block_disconnected_meth != NULL);
7745 .this_arg = (void*) calls,
7746 .block_connected = block_connected_LDKListen_jcall,
7747 .block_disconnected = block_disconnected_LDKListen_jcall,
7748 .free = LDKListen_JCalls_free,
7752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7753 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7754 *res_ptr = LDKListen_init(env, clz, o);
7755 return (uint64_t)res_ptr;
7757 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) {
7758 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7759 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7760 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7761 LDKu8slice block_ref;
7762 block_ref.datalen = (*env)->GetArrayLength(env, block);
7763 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7764 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7765 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7768 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) {
7769 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7770 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7771 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
7772 unsigned char header_arr[80];
7773 CHECK((*env)->GetArrayLength(env, header) == 80);
7774 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7775 unsigned char (*header_ref)[80] = &header_arr;
7776 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7779 typedef struct LDKConfirm_JCalls {
7780 atomic_size_t refcnt;
7783 jmethodID transactions_confirmed_meth;
7784 jmethodID transaction_unconfirmed_meth;
7785 jmethodID best_block_updated_meth;
7786 jmethodID get_relevant_txids_meth;
7787 } LDKConfirm_JCalls;
7788 static void LDKConfirm_JCalls_free(void* this_arg) {
7789 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7790 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7792 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7793 if (get_jenv_res == JNI_EDETACHED) {
7794 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7796 DO_ASSERT(get_jenv_res == JNI_OK);
7798 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7799 if (get_jenv_res == JNI_EDETACHED) {
7800 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7805 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7806 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7808 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7809 if (get_jenv_res == JNI_EDETACHED) {
7810 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7812 DO_ASSERT(get_jenv_res == JNI_OK);
7814 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7815 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7816 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7817 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7818 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7819 for (size_t c = 0; c < txdata_var.datalen; c++) {
7820 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7821 *txdata_conv_28_conv = txdata_var.data[c];
7822 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7824 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7825 FREE(txdata_var.data);
7826 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7828 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7829 if ((*env)->ExceptionCheck(env)) {
7830 (*env)->ExceptionDescribe(env);
7831 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7833 if (get_jenv_res == JNI_EDETACHED) {
7834 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7837 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7838 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7840 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7841 if (get_jenv_res == JNI_EDETACHED) {
7842 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7844 DO_ASSERT(get_jenv_res == JNI_OK);
7846 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7847 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7850 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7851 if ((*env)->ExceptionCheck(env)) {
7852 (*env)->ExceptionDescribe(env);
7853 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
7855 if (get_jenv_res == JNI_EDETACHED) {
7856 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7859 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7860 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7862 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7863 if (get_jenv_res == JNI_EDETACHED) {
7864 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7866 DO_ASSERT(get_jenv_res == JNI_OK);
7868 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7869 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7870 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7872 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
7873 if ((*env)->ExceptionCheck(env)) {
7874 (*env)->ExceptionDescribe(env);
7875 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
7877 if (get_jenv_res == JNI_EDETACHED) {
7878 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7881 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7882 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7884 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7885 if (get_jenv_res == JNI_EDETACHED) {
7886 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7888 DO_ASSERT(get_jenv_res == JNI_OK);
7890 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7892 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
7893 if ((*env)->ExceptionCheck(env)) {
7894 (*env)->ExceptionDescribe(env);
7895 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
7897 LDKCVec_TxidZ ret_constr;
7898 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7899 if (ret_constr.datalen > 0)
7900 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7902 ret_constr.data = NULL;
7903 for (size_t i = 0; i < ret_constr.datalen; i++) {
7904 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
7905 LDKThirtyTwoBytes ret_conv_8_ref;
7906 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
7907 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
7908 ret_constr.data[i] = ret_conv_8_ref;
7910 if (get_jenv_res == JNI_EDETACHED) {
7911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7915 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7916 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7917 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7919 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
7920 jclass c = (*env)->GetObjectClass(env, o);
7922 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7923 atomic_init(&calls->refcnt, 1);
7924 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7925 calls->o = (*env)->NewWeakGlobalRef(env, o);
7926 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
7927 CHECK(calls->transactions_confirmed_meth != NULL);
7928 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
7929 CHECK(calls->transaction_unconfirmed_meth != NULL);
7930 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
7931 CHECK(calls->best_block_updated_meth != NULL);
7932 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
7933 CHECK(calls->get_relevant_txids_meth != NULL);
7936 .this_arg = (void*) calls,
7937 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7938 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7939 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7940 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7941 .free = LDKConfirm_JCalls_free,
7945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
7946 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7947 *res_ptr = LDKConfirm_init(env, clz, o);
7948 return (uint64_t)res_ptr;
7950 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) {
7951 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7952 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7953 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7954 unsigned char header_arr[80];
7955 CHECK((*env)->GetArrayLength(env, header) == 80);
7956 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7957 unsigned char (*header_ref)[80] = &header_arr;
7958 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7959 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7960 if (txdata_constr.datalen > 0)
7961 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7963 txdata_constr.data = NULL;
7964 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7965 for (size_t c = 0; c < txdata_constr.datalen; c++) {
7966 int64_t txdata_conv_28 = txdata_vals[c];
7967 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
7968 CHECK_ACCESS(txdata_conv_28_ptr);
7969 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
7970 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
7971 txdata_constr.data[c] = txdata_conv_28_conv;
7973 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7974 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
7978 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7980 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7981 unsigned char txid_arr[32];
7982 CHECK((*env)->GetArrayLength(env, txid) == 32);
7983 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7984 unsigned char (*txid_ref)[32] = &txid_arr;
7985 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7988 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) {
7989 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7991 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
7992 unsigned char header_arr[80];
7993 CHECK((*env)->GetArrayLength(env, header) == 80);
7994 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7995 unsigned char (*header_ref)[80] = &header_arr;
7996 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7999 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
8000 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8001 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8002 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8003 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8004 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8006 for (size_t i = 0; i < ret_var.datalen; i++) {
8007 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
8008 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
8009 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
8015 typedef struct LDKPersist_JCalls {
8016 atomic_size_t refcnt;
8019 jmethodID persist_new_channel_meth;
8020 jmethodID update_persisted_channel_meth;
8021 } LDKPersist_JCalls;
8022 static void LDKPersist_JCalls_free(void* this_arg) {
8023 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8024 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8026 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8027 if (get_jenv_res == JNI_EDETACHED) {
8028 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8030 DO_ASSERT(get_jenv_res == JNI_OK);
8032 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8033 if (get_jenv_res == JNI_EDETACHED) {
8034 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8039 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
8040 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8043 if (get_jenv_res == JNI_EDETACHED) {
8044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8046 DO_ASSERT(get_jenv_res == JNI_OK);
8048 LDKOutPoint id_var = id;
8049 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8050 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8051 uint64_t id_ref = (uint64_t)id_var.inner;
8052 if (id_var.is_owned) {
8055 LDKChannelMonitor data_var = *data;
8056 data_var = ChannelMonitor_clone(data);
8057 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8058 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8059 uint64_t data_ref = (uint64_t)data_var.inner;
8060 if (data_var.is_owned) {
8063 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8065 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
8066 if ((*env)->ExceptionCheck(env)) {
8067 (*env)->ExceptionDescribe(env);
8068 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
8070 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8071 CHECK_ACCESS(ret_ptr);
8072 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8073 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8074 if (get_jenv_res == JNI_EDETACHED) {
8075 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8079 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
8080 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8082 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8083 if (get_jenv_res == JNI_EDETACHED) {
8084 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8086 DO_ASSERT(get_jenv_res == JNI_OK);
8088 LDKOutPoint id_var = id;
8089 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8090 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8091 uint64_t id_ref = (uint64_t)id_var.inner;
8092 if (id_var.is_owned) {
8095 LDKChannelMonitorUpdate update_var = *update;
8096 update_var = ChannelMonitorUpdate_clone(update);
8097 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8098 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8099 uint64_t update_ref = (uint64_t)update_var.inner;
8100 if (update_var.is_owned) {
8103 LDKChannelMonitor data_var = *data;
8104 data_var = ChannelMonitor_clone(data);
8105 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8106 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8107 uint64_t data_ref = (uint64_t)data_var.inner;
8108 if (data_var.is_owned) {
8111 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8113 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
8114 if ((*env)->ExceptionCheck(env)) {
8115 (*env)->ExceptionDescribe(env);
8116 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
8118 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8119 CHECK_ACCESS(ret_ptr);
8120 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8121 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8122 if (get_jenv_res == JNI_EDETACHED) {
8123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8127 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8128 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8129 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8131 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
8132 jclass c = (*env)->GetObjectClass(env, o);
8134 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8135 atomic_init(&calls->refcnt, 1);
8136 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8137 calls->o = (*env)->NewWeakGlobalRef(env, o);
8138 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
8139 CHECK(calls->persist_new_channel_meth != NULL);
8140 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
8141 CHECK(calls->update_persisted_channel_meth != NULL);
8144 .this_arg = (void*) calls,
8145 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8146 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8147 .free = LDKPersist_JCalls_free,
8151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
8152 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8153 *res_ptr = LDKPersist_init(env, clz, o);
8154 return (uint64_t)res_ptr;
8156 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) {
8157 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8159 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8160 LDKOutPoint id_conv;
8161 id_conv.inner = (void*)(id & (~1));
8162 id_conv.is_owned = (id & 1) || (id == 0);
8163 id_conv = OutPoint_clone(&id_conv);
8164 LDKChannelMonitor data_conv;
8165 data_conv.inner = (void*)(data & (~1));
8166 data_conv.is_owned = false;
8167 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8168 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
8169 return (uint64_t)ret_conv;
8172 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) {
8173 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8174 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8175 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8176 LDKOutPoint id_conv;
8177 id_conv.inner = (void*)(id & (~1));
8178 id_conv.is_owned = (id & 1) || (id == 0);
8179 id_conv = OutPoint_clone(&id_conv);
8180 LDKChannelMonitorUpdate update_conv;
8181 update_conv.inner = (void*)(update & (~1));
8182 update_conv.is_owned = false;
8183 LDKChannelMonitor data_conv;
8184 data_conv.inner = (void*)(data & (~1));
8185 data_conv.is_owned = false;
8186 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8187 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
8188 return (uint64_t)ret_conv;
8191 typedef struct LDKChannelMessageHandler_JCalls {
8192 atomic_size_t refcnt;
8195 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8196 jmethodID handle_open_channel_meth;
8197 jmethodID handle_accept_channel_meth;
8198 jmethodID handle_funding_created_meth;
8199 jmethodID handle_funding_signed_meth;
8200 jmethodID handle_funding_locked_meth;
8201 jmethodID handle_shutdown_meth;
8202 jmethodID handle_closing_signed_meth;
8203 jmethodID handle_update_add_htlc_meth;
8204 jmethodID handle_update_fulfill_htlc_meth;
8205 jmethodID handle_update_fail_htlc_meth;
8206 jmethodID handle_update_fail_malformed_htlc_meth;
8207 jmethodID handle_commitment_signed_meth;
8208 jmethodID handle_revoke_and_ack_meth;
8209 jmethodID handle_update_fee_meth;
8210 jmethodID handle_announcement_signatures_meth;
8211 jmethodID peer_disconnected_meth;
8212 jmethodID peer_connected_meth;
8213 jmethodID handle_channel_reestablish_meth;
8214 jmethodID handle_channel_update_meth;
8215 jmethodID handle_error_meth;
8216 } LDKChannelMessageHandler_JCalls;
8217 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8218 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8219 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8221 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8222 if (get_jenv_res == JNI_EDETACHED) {
8223 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8225 DO_ASSERT(get_jenv_res == JNI_OK);
8227 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8228 if (get_jenv_res == JNI_EDETACHED) {
8229 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8234 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8235 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8237 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8238 if (get_jenv_res == JNI_EDETACHED) {
8239 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8241 DO_ASSERT(get_jenv_res == JNI_OK);
8243 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8244 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8245 LDKInitFeatures their_features_var = their_features;
8246 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8247 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8248 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8249 if (their_features_var.is_owned) {
8250 their_features_ref |= 1;
8252 LDKOpenChannel msg_var = *msg;
8253 msg_var = OpenChannel_clone(msg);
8254 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8255 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8256 uint64_t msg_ref = (uint64_t)msg_var.inner;
8257 if (msg_var.is_owned) {
8260 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8262 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8263 if ((*env)->ExceptionCheck(env)) {
8264 (*env)->ExceptionDescribe(env);
8265 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
8267 if (get_jenv_res == JNI_EDETACHED) {
8268 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8271 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8272 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8274 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8275 if (get_jenv_res == JNI_EDETACHED) {
8276 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8278 DO_ASSERT(get_jenv_res == JNI_OK);
8280 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8281 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8282 LDKInitFeatures their_features_var = their_features;
8283 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8284 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8285 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8286 if (their_features_var.is_owned) {
8287 their_features_ref |= 1;
8289 LDKAcceptChannel msg_var = *msg;
8290 msg_var = AcceptChannel_clone(msg);
8291 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8292 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8293 uint64_t msg_ref = (uint64_t)msg_var.inner;
8294 if (msg_var.is_owned) {
8297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8299 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8300 if ((*env)->ExceptionCheck(env)) {
8301 (*env)->ExceptionDescribe(env);
8302 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
8304 if (get_jenv_res == JNI_EDETACHED) {
8305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8308 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8309 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8311 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8312 if (get_jenv_res == JNI_EDETACHED) {
8313 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8315 DO_ASSERT(get_jenv_res == JNI_OK);
8317 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8318 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8319 LDKFundingCreated msg_var = *msg;
8320 msg_var = FundingCreated_clone(msg);
8321 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8322 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8323 uint64_t msg_ref = (uint64_t)msg_var.inner;
8324 if (msg_var.is_owned) {
8327 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8329 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8330 if ((*env)->ExceptionCheck(env)) {
8331 (*env)->ExceptionDescribe(env);
8332 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8334 if (get_jenv_res == JNI_EDETACHED) {
8335 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8338 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8339 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8341 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8342 if (get_jenv_res == JNI_EDETACHED) {
8343 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8345 DO_ASSERT(get_jenv_res == JNI_OK);
8347 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8348 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8349 LDKFundingSigned msg_var = *msg;
8350 msg_var = FundingSigned_clone(msg);
8351 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8352 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8353 uint64_t msg_ref = (uint64_t)msg_var.inner;
8354 if (msg_var.is_owned) {
8357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8359 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8360 if ((*env)->ExceptionCheck(env)) {
8361 (*env)->ExceptionDescribe(env);
8362 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8364 if (get_jenv_res == JNI_EDETACHED) {
8365 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8368 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8369 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8371 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8372 if (get_jenv_res == JNI_EDETACHED) {
8373 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8375 DO_ASSERT(get_jenv_res == JNI_OK);
8377 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8378 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8379 LDKFundingLocked msg_var = *msg;
8380 msg_var = FundingLocked_clone(msg);
8381 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8382 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8383 uint64_t msg_ref = (uint64_t)msg_var.inner;
8384 if (msg_var.is_owned) {
8387 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8389 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8390 if ((*env)->ExceptionCheck(env)) {
8391 (*env)->ExceptionDescribe(env);
8392 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8394 if (get_jenv_res == JNI_EDETACHED) {
8395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8398 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8399 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8402 if (get_jenv_res == JNI_EDETACHED) {
8403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8405 DO_ASSERT(get_jenv_res == JNI_OK);
8407 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8408 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8409 LDKInitFeatures their_features_var = *their_features;
8410 their_features_var = InitFeatures_clone(their_features);
8411 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8412 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8413 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8414 if (their_features_var.is_owned) {
8415 their_features_ref |= 1;
8417 LDKShutdown msg_var = *msg;
8418 msg_var = Shutdown_clone(msg);
8419 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8420 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8421 uint64_t msg_ref = (uint64_t)msg_var.inner;
8422 if (msg_var.is_owned) {
8425 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8427 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8428 if ((*env)->ExceptionCheck(env)) {
8429 (*env)->ExceptionDescribe(env);
8430 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8432 if (get_jenv_res == JNI_EDETACHED) {
8433 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8436 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8437 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8439 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8440 if (get_jenv_res == JNI_EDETACHED) {
8441 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8443 DO_ASSERT(get_jenv_res == JNI_OK);
8445 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8446 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8447 LDKClosingSigned msg_var = *msg;
8448 msg_var = ClosingSigned_clone(msg);
8449 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8450 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8451 uint64_t msg_ref = (uint64_t)msg_var.inner;
8452 if (msg_var.is_owned) {
8455 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8457 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8458 if ((*env)->ExceptionCheck(env)) {
8459 (*env)->ExceptionDescribe(env);
8460 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8462 if (get_jenv_res == JNI_EDETACHED) {
8463 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8466 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8467 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8469 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8470 if (get_jenv_res == JNI_EDETACHED) {
8471 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8473 DO_ASSERT(get_jenv_res == JNI_OK);
8475 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8476 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8477 LDKUpdateAddHTLC msg_var = *msg;
8478 msg_var = UpdateAddHTLC_clone(msg);
8479 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8480 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8481 uint64_t msg_ref = (uint64_t)msg_var.inner;
8482 if (msg_var.is_owned) {
8485 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8487 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8488 if ((*env)->ExceptionCheck(env)) {
8489 (*env)->ExceptionDescribe(env);
8490 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8492 if (get_jenv_res == JNI_EDETACHED) {
8493 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8496 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8497 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8499 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8500 if (get_jenv_res == JNI_EDETACHED) {
8501 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8503 DO_ASSERT(get_jenv_res == JNI_OK);
8505 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8506 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8507 LDKUpdateFulfillHTLC msg_var = *msg;
8508 msg_var = UpdateFulfillHTLC_clone(msg);
8509 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8510 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8511 uint64_t msg_ref = (uint64_t)msg_var.inner;
8512 if (msg_var.is_owned) {
8515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8517 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8518 if ((*env)->ExceptionCheck(env)) {
8519 (*env)->ExceptionDescribe(env);
8520 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8522 if (get_jenv_res == JNI_EDETACHED) {
8523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8526 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8527 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8529 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8530 if (get_jenv_res == JNI_EDETACHED) {
8531 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8533 DO_ASSERT(get_jenv_res == JNI_OK);
8535 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8536 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8537 LDKUpdateFailHTLC msg_var = *msg;
8538 msg_var = UpdateFailHTLC_clone(msg);
8539 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8540 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8541 uint64_t msg_ref = (uint64_t)msg_var.inner;
8542 if (msg_var.is_owned) {
8545 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8547 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8548 if ((*env)->ExceptionCheck(env)) {
8549 (*env)->ExceptionDescribe(env);
8550 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8552 if (get_jenv_res == JNI_EDETACHED) {
8553 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8556 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8557 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8559 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8560 if (get_jenv_res == JNI_EDETACHED) {
8561 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8563 DO_ASSERT(get_jenv_res == JNI_OK);
8565 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8566 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8567 LDKUpdateFailMalformedHTLC msg_var = *msg;
8568 msg_var = UpdateFailMalformedHTLC_clone(msg);
8569 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8570 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8571 uint64_t msg_ref = (uint64_t)msg_var.inner;
8572 if (msg_var.is_owned) {
8575 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8577 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8578 if ((*env)->ExceptionCheck(env)) {
8579 (*env)->ExceptionDescribe(env);
8580 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8582 if (get_jenv_res == JNI_EDETACHED) {
8583 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8586 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8587 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8590 if (get_jenv_res == JNI_EDETACHED) {
8591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8593 DO_ASSERT(get_jenv_res == JNI_OK);
8595 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8596 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8597 LDKCommitmentSigned msg_var = *msg;
8598 msg_var = CommitmentSigned_clone(msg);
8599 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8600 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8601 uint64_t msg_ref = (uint64_t)msg_var.inner;
8602 if (msg_var.is_owned) {
8605 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8607 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8608 if ((*env)->ExceptionCheck(env)) {
8609 (*env)->ExceptionDescribe(env);
8610 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8612 if (get_jenv_res == JNI_EDETACHED) {
8613 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8616 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8617 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8619 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8620 if (get_jenv_res == JNI_EDETACHED) {
8621 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8623 DO_ASSERT(get_jenv_res == JNI_OK);
8625 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8626 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8627 LDKRevokeAndACK msg_var = *msg;
8628 msg_var = RevokeAndACK_clone(msg);
8629 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8630 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8631 uint64_t msg_ref = (uint64_t)msg_var.inner;
8632 if (msg_var.is_owned) {
8635 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8637 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8638 if ((*env)->ExceptionCheck(env)) {
8639 (*env)->ExceptionDescribe(env);
8640 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8642 if (get_jenv_res == JNI_EDETACHED) {
8643 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8646 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8647 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8649 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8650 if (get_jenv_res == JNI_EDETACHED) {
8651 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8653 DO_ASSERT(get_jenv_res == JNI_OK);
8655 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8656 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8657 LDKUpdateFee msg_var = *msg;
8658 msg_var = UpdateFee_clone(msg);
8659 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8660 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8661 uint64_t msg_ref = (uint64_t)msg_var.inner;
8662 if (msg_var.is_owned) {
8665 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8667 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8668 if ((*env)->ExceptionCheck(env)) {
8669 (*env)->ExceptionDescribe(env);
8670 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8672 if (get_jenv_res == JNI_EDETACHED) {
8673 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8676 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8677 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8679 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8680 if (get_jenv_res == JNI_EDETACHED) {
8681 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8683 DO_ASSERT(get_jenv_res == JNI_OK);
8685 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8686 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8687 LDKAnnouncementSignatures msg_var = *msg;
8688 msg_var = AnnouncementSignatures_clone(msg);
8689 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8690 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8691 uint64_t msg_ref = (uint64_t)msg_var.inner;
8692 if (msg_var.is_owned) {
8695 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8697 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8698 if ((*env)->ExceptionCheck(env)) {
8699 (*env)->ExceptionDescribe(env);
8700 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8702 if (get_jenv_res == JNI_EDETACHED) {
8703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8706 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8707 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8709 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8710 if (get_jenv_res == JNI_EDETACHED) {
8711 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8713 DO_ASSERT(get_jenv_res == JNI_OK);
8715 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8716 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8717 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8719 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8720 if ((*env)->ExceptionCheck(env)) {
8721 (*env)->ExceptionDescribe(env);
8722 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8724 if (get_jenv_res == JNI_EDETACHED) {
8725 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8728 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8729 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8731 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8732 if (get_jenv_res == JNI_EDETACHED) {
8733 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8735 DO_ASSERT(get_jenv_res == JNI_OK);
8737 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8738 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8739 LDKInit msg_var = *msg;
8740 msg_var = Init_clone(msg);
8741 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8742 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8743 uint64_t msg_ref = (uint64_t)msg_var.inner;
8744 if (msg_var.is_owned) {
8747 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8749 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8750 if ((*env)->ExceptionCheck(env)) {
8751 (*env)->ExceptionDescribe(env);
8752 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8754 if (get_jenv_res == JNI_EDETACHED) {
8755 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8758 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8759 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8762 if (get_jenv_res == JNI_EDETACHED) {
8763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8765 DO_ASSERT(get_jenv_res == JNI_OK);
8767 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8768 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8769 LDKChannelReestablish msg_var = *msg;
8770 msg_var = ChannelReestablish_clone(msg);
8771 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8772 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8773 uint64_t msg_ref = (uint64_t)msg_var.inner;
8774 if (msg_var.is_owned) {
8777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8779 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
8780 if ((*env)->ExceptionCheck(env)) {
8781 (*env)->ExceptionDescribe(env);
8782 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
8784 if (get_jenv_res == JNI_EDETACHED) {
8785 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8788 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8789 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8791 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8792 if (get_jenv_res == JNI_EDETACHED) {
8793 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8795 DO_ASSERT(get_jenv_res == JNI_OK);
8797 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8798 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8799 LDKChannelUpdate msg_var = *msg;
8800 msg_var = ChannelUpdate_clone(msg);
8801 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8802 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8803 uint64_t msg_ref = (uint64_t)msg_var.inner;
8804 if (msg_var.is_owned) {
8807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8809 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
8810 if ((*env)->ExceptionCheck(env)) {
8811 (*env)->ExceptionDescribe(env);
8812 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
8814 if (get_jenv_res == JNI_EDETACHED) {
8815 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8818 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8819 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8822 if (get_jenv_res == JNI_EDETACHED) {
8823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8825 DO_ASSERT(get_jenv_res == JNI_OK);
8827 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8828 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8829 LDKErrorMessage msg_var = *msg;
8830 msg_var = ErrorMessage_clone(msg);
8831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8833 uint64_t msg_ref = (uint64_t)msg_var.inner;
8834 if (msg_var.is_owned) {
8837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8839 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
8840 if ((*env)->ExceptionCheck(env)) {
8841 (*env)->ExceptionDescribe(env);
8842 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
8844 if (get_jenv_res == JNI_EDETACHED) {
8845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8848 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8849 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8850 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8851 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8853 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8854 jclass c = (*env)->GetObjectClass(env, o);
8856 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8857 atomic_init(&calls->refcnt, 1);
8858 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8859 calls->o = (*env)->NewWeakGlobalRef(env, o);
8860 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
8861 CHECK(calls->handle_open_channel_meth != NULL);
8862 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
8863 CHECK(calls->handle_accept_channel_meth != NULL);
8864 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
8865 CHECK(calls->handle_funding_created_meth != NULL);
8866 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
8867 CHECK(calls->handle_funding_signed_meth != NULL);
8868 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
8869 CHECK(calls->handle_funding_locked_meth != NULL);
8870 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
8871 CHECK(calls->handle_shutdown_meth != NULL);
8872 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
8873 CHECK(calls->handle_closing_signed_meth != NULL);
8874 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
8875 CHECK(calls->handle_update_add_htlc_meth != NULL);
8876 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
8877 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
8878 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
8879 CHECK(calls->handle_update_fail_htlc_meth != NULL);
8880 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
8881 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
8882 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
8883 CHECK(calls->handle_commitment_signed_meth != NULL);
8884 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
8885 CHECK(calls->handle_revoke_and_ack_meth != NULL);
8886 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
8887 CHECK(calls->handle_update_fee_meth != NULL);
8888 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
8889 CHECK(calls->handle_announcement_signatures_meth != NULL);
8890 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
8891 CHECK(calls->peer_disconnected_meth != NULL);
8892 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
8893 CHECK(calls->peer_connected_meth != NULL);
8894 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
8895 CHECK(calls->handle_channel_reestablish_meth != NULL);
8896 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
8897 CHECK(calls->handle_channel_update_meth != NULL);
8898 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
8899 CHECK(calls->handle_error_meth != NULL);
8901 LDKChannelMessageHandler ret = {
8902 .this_arg = (void*) calls,
8903 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8904 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8905 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8906 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8907 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8908 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8909 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8910 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8911 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8912 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8913 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8914 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8915 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8916 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8917 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8918 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8919 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8920 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8921 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8922 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8923 .free = LDKChannelMessageHandler_JCalls_free,
8924 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8926 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8930 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8931 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8932 return (uint64_t)res_ptr;
8934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8935 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
8936 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8937 DO_ASSERT((res_ptr & 1) == 0);
8938 return (int64_t)(res_ptr | 1);
8940 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) {
8941 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8942 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8943 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8944 LDKPublicKey their_node_id_ref;
8945 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8946 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8947 LDKInitFeatures their_features_conv;
8948 their_features_conv.inner = (void*)(their_features & (~1));
8949 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8950 their_features_conv = InitFeatures_clone(&their_features_conv);
8951 LDKOpenChannel msg_conv;
8952 msg_conv.inner = (void*)(msg & (~1));
8953 msg_conv.is_owned = false;
8954 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8957 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) {
8958 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8960 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8961 LDKPublicKey their_node_id_ref;
8962 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8963 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8964 LDKInitFeatures their_features_conv;
8965 their_features_conv.inner = (void*)(their_features & (~1));
8966 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8967 their_features_conv = InitFeatures_clone(&their_features_conv);
8968 LDKAcceptChannel msg_conv;
8969 msg_conv.inner = (void*)(msg & (~1));
8970 msg_conv.is_owned = false;
8971 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8974 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) {
8975 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8976 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8977 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8978 LDKPublicKey their_node_id_ref;
8979 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8980 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8981 LDKFundingCreated msg_conv;
8982 msg_conv.inner = (void*)(msg & (~1));
8983 msg_conv.is_owned = false;
8984 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8987 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) {
8988 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8989 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8990 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8991 LDKPublicKey their_node_id_ref;
8992 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8993 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8994 LDKFundingSigned msg_conv;
8995 msg_conv.inner = (void*)(msg & (~1));
8996 msg_conv.is_owned = false;
8997 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9000 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) {
9001 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9002 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9003 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9004 LDKPublicKey their_node_id_ref;
9005 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9006 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9007 LDKFundingLocked msg_conv;
9008 msg_conv.inner = (void*)(msg & (~1));
9009 msg_conv.is_owned = false;
9010 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9013 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) {
9014 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9015 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9016 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9017 LDKPublicKey their_node_id_ref;
9018 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9019 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9020 LDKInitFeatures their_features_conv;
9021 their_features_conv.inner = (void*)(their_features & (~1));
9022 their_features_conv.is_owned = false;
9023 LDKShutdown msg_conv;
9024 msg_conv.inner = (void*)(msg & (~1));
9025 msg_conv.is_owned = false;
9026 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9029 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) {
9030 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9032 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9033 LDKPublicKey their_node_id_ref;
9034 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9035 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9036 LDKClosingSigned msg_conv;
9037 msg_conv.inner = (void*)(msg & (~1));
9038 msg_conv.is_owned = false;
9039 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9042 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) {
9043 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9044 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9045 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9046 LDKPublicKey their_node_id_ref;
9047 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9048 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9049 LDKUpdateAddHTLC msg_conv;
9050 msg_conv.inner = (void*)(msg & (~1));
9051 msg_conv.is_owned = false;
9052 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9055 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) {
9056 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9057 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9058 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9059 LDKPublicKey their_node_id_ref;
9060 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9061 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9062 LDKUpdateFulfillHTLC msg_conv;
9063 msg_conv.inner = (void*)(msg & (~1));
9064 msg_conv.is_owned = false;
9065 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9068 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) {
9069 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9071 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9072 LDKPublicKey their_node_id_ref;
9073 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9074 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9075 LDKUpdateFailHTLC msg_conv;
9076 msg_conv.inner = (void*)(msg & (~1));
9077 msg_conv.is_owned = false;
9078 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9081 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) {
9082 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9083 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9084 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
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 LDKUpdateFailMalformedHTLC msg_conv;
9089 msg_conv.inner = (void*)(msg & (~1));
9090 msg_conv.is_owned = false;
9091 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9094 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) {
9095 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9096 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9097 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9098 LDKPublicKey their_node_id_ref;
9099 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9100 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9101 LDKCommitmentSigned msg_conv;
9102 msg_conv.inner = (void*)(msg & (~1));
9103 msg_conv.is_owned = false;
9104 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9107 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) {
9108 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9109 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9110 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9111 LDKPublicKey their_node_id_ref;
9112 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9113 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9114 LDKRevokeAndACK msg_conv;
9115 msg_conv.inner = (void*)(msg & (~1));
9116 msg_conv.is_owned = false;
9117 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9120 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) {
9121 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9122 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9123 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9124 LDKPublicKey their_node_id_ref;
9125 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9126 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9127 LDKUpdateFee msg_conv;
9128 msg_conv.inner = (void*)(msg & (~1));
9129 msg_conv.is_owned = false;
9130 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9133 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) {
9134 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9136 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9137 LDKPublicKey their_node_id_ref;
9138 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9139 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9140 LDKAnnouncementSignatures msg_conv;
9141 msg_conv.inner = (void*)(msg & (~1));
9142 msg_conv.is_owned = false;
9143 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9146 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) {
9147 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9148 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9149 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9150 LDKPublicKey their_node_id_ref;
9151 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9152 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9153 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9156 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) {
9157 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9158 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9159 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9160 LDKPublicKey their_node_id_ref;
9161 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9162 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9164 msg_conv.inner = (void*)(msg & (~1));
9165 msg_conv.is_owned = false;
9166 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9169 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) {
9170 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9171 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9172 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9173 LDKPublicKey their_node_id_ref;
9174 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9175 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9176 LDKChannelReestablish msg_conv;
9177 msg_conv.inner = (void*)(msg & (~1));
9178 msg_conv.is_owned = false;
9179 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9182 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) {
9183 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9184 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9185 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9186 LDKPublicKey their_node_id_ref;
9187 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9188 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9189 LDKChannelUpdate msg_conv;
9190 msg_conv.inner = (void*)(msg & (~1));
9191 msg_conv.is_owned = false;
9192 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9195 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) {
9196 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9197 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9198 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9199 LDKPublicKey their_node_id_ref;
9200 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9201 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9202 LDKErrorMessage msg_conv;
9203 msg_conv.inner = (void*)(msg & (~1));
9204 msg_conv.is_owned = false;
9205 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9208 typedef struct LDKRoutingMessageHandler_JCalls {
9209 atomic_size_t refcnt;
9212 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9213 jmethodID handle_node_announcement_meth;
9214 jmethodID handle_channel_announcement_meth;
9215 jmethodID handle_channel_update_meth;
9216 jmethodID get_next_channel_announcements_meth;
9217 jmethodID get_next_node_announcements_meth;
9218 jmethodID sync_routing_table_meth;
9219 jmethodID handle_reply_channel_range_meth;
9220 jmethodID handle_reply_short_channel_ids_end_meth;
9221 jmethodID handle_query_channel_range_meth;
9222 jmethodID handle_query_short_channel_ids_meth;
9223 } LDKRoutingMessageHandler_JCalls;
9224 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9225 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9226 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9228 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9229 if (get_jenv_res == JNI_EDETACHED) {
9230 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9232 DO_ASSERT(get_jenv_res == JNI_OK);
9234 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9235 if (get_jenv_res == JNI_EDETACHED) {
9236 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9241 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9242 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9244 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9245 if (get_jenv_res == JNI_EDETACHED) {
9246 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9248 DO_ASSERT(get_jenv_res == JNI_OK);
9250 LDKNodeAnnouncement msg_var = *msg;
9251 msg_var = NodeAnnouncement_clone(msg);
9252 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9253 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9254 uint64_t msg_ref = (uint64_t)msg_var.inner;
9255 if (msg_var.is_owned) {
9258 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9260 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
9261 if ((*env)->ExceptionCheck(env)) {
9262 (*env)->ExceptionDescribe(env);
9263 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9265 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9266 CHECK_ACCESS(ret_ptr);
9267 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9268 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9269 if (get_jenv_res == JNI_EDETACHED) {
9270 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9274 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9275 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9277 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9278 if (get_jenv_res == JNI_EDETACHED) {
9279 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9281 DO_ASSERT(get_jenv_res == JNI_OK);
9283 LDKChannelAnnouncement msg_var = *msg;
9284 msg_var = ChannelAnnouncement_clone(msg);
9285 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9286 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9287 uint64_t msg_ref = (uint64_t)msg_var.inner;
9288 if (msg_var.is_owned) {
9291 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9293 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
9294 if ((*env)->ExceptionCheck(env)) {
9295 (*env)->ExceptionDescribe(env);
9296 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9298 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9299 CHECK_ACCESS(ret_ptr);
9300 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
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 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9332 CHECK_ACCESS(ret_ptr);
9333 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9334 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9335 if (get_jenv_res == JNI_EDETACHED) {
9336 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9340 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9341 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9343 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9344 if (get_jenv_res == JNI_EDETACHED) {
9345 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9347 DO_ASSERT(get_jenv_res == JNI_OK);
9349 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9351 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
9352 if ((*env)->ExceptionCheck(env)) {
9353 (*env)->ExceptionDescribe(env);
9354 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9356 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9357 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9358 if (ret_constr.datalen > 0)
9359 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9361 ret_constr.data = NULL;
9362 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9363 for (size_t h = 0; h < ret_constr.datalen; h++) {
9364 int64_t ret_conv_59 = ret_vals[h];
9365 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
9366 CHECK_ACCESS(ret_conv_59_ptr);
9367 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9368 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
9369 ret_constr.data[h] = ret_conv_59_conv;
9371 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9372 if (get_jenv_res == JNI_EDETACHED) {
9373 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9377 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9378 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9380 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9381 if (get_jenv_res == JNI_EDETACHED) {
9382 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9384 DO_ASSERT(get_jenv_res == JNI_OK);
9386 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9387 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9390 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9391 if ((*env)->ExceptionCheck(env)) {
9392 (*env)->ExceptionDescribe(env);
9393 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9395 LDKCVec_NodeAnnouncementZ ret_constr;
9396 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9397 if (ret_constr.datalen > 0)
9398 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9400 ret_constr.data = NULL;
9401 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9402 for (size_t s = 0; s < ret_constr.datalen; s++) {
9403 int64_t ret_conv_18 = ret_vals[s];
9404 LDKNodeAnnouncement ret_conv_18_conv;
9405 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9406 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9407 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9408 ret_constr.data[s] = ret_conv_18_conv;
9410 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9411 if (get_jenv_res == JNI_EDETACHED) {
9412 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9416 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9417 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9419 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9420 if (get_jenv_res == JNI_EDETACHED) {
9421 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9423 DO_ASSERT(get_jenv_res == JNI_OK);
9425 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9426 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9427 LDKInit init_var = *init;
9428 init_var = Init_clone(init);
9429 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9430 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9431 uint64_t init_ref = (uint64_t)init_var.inner;
9432 if (init_var.is_owned) {
9435 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9437 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9438 if ((*env)->ExceptionCheck(env)) {
9439 (*env)->ExceptionDescribe(env);
9440 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9442 if (get_jenv_res == JNI_EDETACHED) {
9443 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9446 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9447 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9449 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9450 if (get_jenv_res == JNI_EDETACHED) {
9451 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9453 DO_ASSERT(get_jenv_res == JNI_OK);
9455 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9456 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9457 LDKReplyChannelRange msg_var = msg;
9458 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9459 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9460 uint64_t msg_ref = (uint64_t)msg_var.inner;
9461 if (msg_var.is_owned) {
9464 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9466 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9467 if ((*env)->ExceptionCheck(env)) {
9468 (*env)->ExceptionDescribe(env);
9469 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9471 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9472 CHECK_ACCESS(ret_ptr);
9473 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9474 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9475 if (get_jenv_res == JNI_EDETACHED) {
9476 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9480 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9481 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9484 if (get_jenv_res == JNI_EDETACHED) {
9485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9487 DO_ASSERT(get_jenv_res == JNI_OK);
9489 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9490 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9491 LDKReplyShortChannelIdsEnd msg_var = msg;
9492 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9493 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9494 uint64_t msg_ref = (uint64_t)msg_var.inner;
9495 if (msg_var.is_owned) {
9498 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9500 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9501 if ((*env)->ExceptionCheck(env)) {
9502 (*env)->ExceptionDescribe(env);
9503 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9505 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9506 CHECK_ACCESS(ret_ptr);
9507 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9508 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9509 if (get_jenv_res == JNI_EDETACHED) {
9510 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9514 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9515 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9517 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9518 if (get_jenv_res == JNI_EDETACHED) {
9519 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9521 DO_ASSERT(get_jenv_res == JNI_OK);
9523 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9524 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9525 LDKQueryChannelRange msg_var = msg;
9526 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9527 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9528 uint64_t msg_ref = (uint64_t)msg_var.inner;
9529 if (msg_var.is_owned) {
9532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9534 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9535 if ((*env)->ExceptionCheck(env)) {
9536 (*env)->ExceptionDescribe(env);
9537 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9539 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9540 CHECK_ACCESS(ret_ptr);
9541 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9542 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9543 if (get_jenv_res == JNI_EDETACHED) {
9544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9548 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9549 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9552 if (get_jenv_res == JNI_EDETACHED) {
9553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9555 DO_ASSERT(get_jenv_res == JNI_OK);
9557 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9558 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9559 LDKQueryShortChannelIds msg_var = msg;
9560 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9561 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9562 uint64_t msg_ref = (uint64_t)msg_var.inner;
9563 if (msg_var.is_owned) {
9566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9568 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9569 if ((*env)->ExceptionCheck(env)) {
9570 (*env)->ExceptionDescribe(env);
9571 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9573 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9574 CHECK_ACCESS(ret_ptr);
9575 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9576 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9577 if (get_jenv_res == JNI_EDETACHED) {
9578 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9582 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9583 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9584 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9585 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9587 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9588 jclass c = (*env)->GetObjectClass(env, o);
9590 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9591 atomic_init(&calls->refcnt, 1);
9592 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9593 calls->o = (*env)->NewWeakGlobalRef(env, o);
9594 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9595 CHECK(calls->handle_node_announcement_meth != NULL);
9596 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9597 CHECK(calls->handle_channel_announcement_meth != NULL);
9598 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9599 CHECK(calls->handle_channel_update_meth != NULL);
9600 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9601 CHECK(calls->get_next_channel_announcements_meth != NULL);
9602 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9603 CHECK(calls->get_next_node_announcements_meth != NULL);
9604 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9605 CHECK(calls->sync_routing_table_meth != NULL);
9606 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9607 CHECK(calls->handle_reply_channel_range_meth != NULL);
9608 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9609 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9610 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9611 CHECK(calls->handle_query_channel_range_meth != NULL);
9612 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9613 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9615 LDKRoutingMessageHandler ret = {
9616 .this_arg = (void*) calls,
9617 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9618 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9619 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9620 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9621 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9622 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9623 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9624 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9625 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9626 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9627 .free = LDKRoutingMessageHandler_JCalls_free,
9628 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9630 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9634 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9635 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9636 return (uint64_t)res_ptr;
9638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9639 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9640 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9641 DO_ASSERT((res_ptr & 1) == 0);
9642 return (int64_t)(res_ptr | 1);
9644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9645 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9646 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9647 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9648 LDKNodeAnnouncement msg_conv;
9649 msg_conv.inner = (void*)(msg & (~1));
9650 msg_conv.is_owned = false;
9651 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9652 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9653 return (uint64_t)ret_conv;
9656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9657 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9658 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9659 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9660 LDKChannelAnnouncement msg_conv;
9661 msg_conv.inner = (void*)(msg & (~1));
9662 msg_conv.is_owned = false;
9663 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9664 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9665 return (uint64_t)ret_conv;
9668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9669 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9670 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9671 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9672 LDKChannelUpdate msg_conv;
9673 msg_conv.inner = (void*)(msg & (~1));
9674 msg_conv.is_owned = false;
9675 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9676 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9677 return (uint64_t)ret_conv;
9680 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) {
9681 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9682 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9683 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9684 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9685 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9686 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9687 for (size_t h = 0; h < ret_var.datalen; h++) {
9688 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9689 *ret_conv_59_conv = ret_var.data[h];
9690 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
9692 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9697 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) {
9698 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9699 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9700 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9701 LDKPublicKey starting_point_ref;
9702 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9703 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9704 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9705 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9706 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9707 for (size_t s = 0; s < ret_var.datalen; s++) {
9708 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9709 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9710 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9711 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9712 if (ret_conv_18_var.is_owned) {
9713 ret_conv_18_ref |= 1;
9715 ret_arr_ptr[s] = ret_conv_18_ref;
9717 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9722 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) {
9723 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9724 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9725 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9726 LDKPublicKey their_node_id_ref;
9727 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9728 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9730 init_conv.inner = (void*)(init & (~1));
9731 init_conv.is_owned = false;
9732 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9735 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) {
9736 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9737 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9738 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9739 LDKPublicKey their_node_id_ref;
9740 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9741 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9742 LDKReplyChannelRange msg_conv;
9743 msg_conv.inner = (void*)(msg & (~1));
9744 msg_conv.is_owned = (msg & 1) || (msg == 0);
9745 msg_conv = ReplyChannelRange_clone(&msg_conv);
9746 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9747 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9748 return (uint64_t)ret_conv;
9751 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) {
9752 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9753 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9754 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
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 LDKReplyShortChannelIdsEnd msg_conv;
9759 msg_conv.inner = (void*)(msg & (~1));
9760 msg_conv.is_owned = (msg & 1) || (msg == 0);
9761 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9762 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9763 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9764 return (uint64_t)ret_conv;
9767 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) {
9768 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9769 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9770 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9771 LDKPublicKey their_node_id_ref;
9772 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9773 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9774 LDKQueryChannelRange msg_conv;
9775 msg_conv.inner = (void*)(msg & (~1));
9776 msg_conv.is_owned = (msg & 1) || (msg == 0);
9777 msg_conv = QueryChannelRange_clone(&msg_conv);
9778 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9779 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9780 return (uint64_t)ret_conv;
9783 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) {
9784 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9785 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9786 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9787 LDKPublicKey their_node_id_ref;
9788 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9789 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9790 LDKQueryShortChannelIds msg_conv;
9791 msg_conv.inner = (void*)(msg & (~1));
9792 msg_conv.is_owned = (msg & 1) || (msg == 0);
9793 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9794 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9795 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9796 return (uint64_t)ret_conv;
9799 typedef struct LDKCustomMessageReader_JCalls {
9800 atomic_size_t refcnt;
9803 jmethodID read_meth;
9804 } LDKCustomMessageReader_JCalls;
9805 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9806 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9807 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9809 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9810 if (get_jenv_res == JNI_EDETACHED) {
9811 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9813 DO_ASSERT(get_jenv_res == JNI_OK);
9815 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9816 if (get_jenv_res == JNI_EDETACHED) {
9817 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9822 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9823 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9825 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9826 if (get_jenv_res == JNI_EDETACHED) {
9827 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9829 DO_ASSERT(get_jenv_res == JNI_OK);
9831 LDKu8slice buffer_var = buffer;
9832 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
9833 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
9834 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9836 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
9837 if ((*env)->ExceptionCheck(env)) {
9838 (*env)->ExceptionDescribe(env);
9839 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
9841 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9842 CHECK_ACCESS(ret_ptr);
9843 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
9844 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
9845 if (get_jenv_res == JNI_EDETACHED) {
9846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9850 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9851 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9852 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9854 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
9855 jclass c = (*env)->GetObjectClass(env, o);
9857 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9858 atomic_init(&calls->refcnt, 1);
9859 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9860 calls->o = (*env)->NewWeakGlobalRef(env, o);
9861 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
9862 CHECK(calls->read_meth != NULL);
9864 LDKCustomMessageReader ret = {
9865 .this_arg = (void*) calls,
9866 .read = read_LDKCustomMessageReader_jcall,
9867 .free = LDKCustomMessageReader_JCalls_free,
9871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
9872 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9873 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
9874 return (uint64_t)res_ptr;
9876 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) {
9877 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9878 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9879 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
9880 LDKu8slice buffer_ref;
9881 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
9882 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
9883 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9884 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9885 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
9886 return (uint64_t)ret_conv;
9889 typedef struct LDKCustomMessageHandler_JCalls {
9890 atomic_size_t refcnt;
9893 LDKCustomMessageReader_JCalls* CustomMessageReader;
9894 jmethodID handle_custom_message_meth;
9895 jmethodID get_and_clear_pending_msg_meth;
9896 } LDKCustomMessageHandler_JCalls;
9897 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9898 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9899 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9901 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9902 if (get_jenv_res == JNI_EDETACHED) {
9903 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9905 DO_ASSERT(get_jenv_res == JNI_OK);
9907 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9908 if (get_jenv_res == JNI_EDETACHED) {
9909 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9914 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9915 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9917 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9918 if (get_jenv_res == JNI_EDETACHED) {
9919 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9921 DO_ASSERT(get_jenv_res == JNI_OK);
9923 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
9925 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
9926 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
9927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9929 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
9930 if ((*env)->ExceptionCheck(env)) {
9931 (*env)->ExceptionDescribe(env);
9932 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
9934 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9935 CHECK_ACCESS(ret_ptr);
9936 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9937 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9938 if (get_jenv_res == JNI_EDETACHED) {
9939 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9943 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9944 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9946 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9947 if (get_jenv_res == JNI_EDETACHED) {
9948 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9950 DO_ASSERT(get_jenv_res == JNI_OK);
9952 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9954 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
9955 if ((*env)->ExceptionCheck(env)) {
9956 (*env)->ExceptionDescribe(env);
9957 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
9959 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9960 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9961 if (ret_constr.datalen > 0)
9962 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9964 ret_constr.data = NULL;
9965 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9966 for (size_t z = 0; z < ret_constr.datalen; z++) {
9967 int64_t ret_conv_25 = ret_vals[z];
9968 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
9969 CHECK_ACCESS(ret_conv_25_ptr);
9970 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
9971 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
9972 ret_constr.data[z] = ret_conv_25_conv;
9974 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9975 if (get_jenv_res == JNI_EDETACHED) {
9976 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9980 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9981 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9982 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9983 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9985 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9986 jclass c = (*env)->GetObjectClass(env, o);
9988 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9989 atomic_init(&calls->refcnt, 1);
9990 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9991 calls->o = (*env)->NewWeakGlobalRef(env, o);
9992 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
9993 CHECK(calls->handle_custom_message_meth != NULL);
9994 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
9995 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
9997 LDKCustomMessageHandler ret = {
9998 .this_arg = (void*) calls,
9999 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10000 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10001 .free = LDKCustomMessageHandler_JCalls_free,
10002 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
10004 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
10008 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10009 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
10010 return (uint64_t)res_ptr;
10012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
10013 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
10014 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
10015 DO_ASSERT((res_ptr & 1) == 0);
10016 return (int64_t)(res_ptr | 1);
10018 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) {
10019 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10020 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10021 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10022 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
10023 CHECK_ACCESS(msg_ptr);
10024 LDKType msg_conv = *(LDKType*)(msg_ptr);
10025 if (msg_conv.free == LDKType_JCalls_free) {
10026 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10027 LDKType_JCalls_cloned(&msg_conv);
10029 LDKPublicKey sender_node_id_ref;
10030 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
10031 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
10032 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10033 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10034 return (uint64_t)ret_conv;
10037 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
10038 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10039 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10040 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10041 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10042 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10043 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10044 for (size_t z = 0; z < ret_var.datalen; z++) {
10045 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10046 *ret_conv_25_conv = ret_var.data[z];
10047 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
10049 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10050 FREE(ret_var.data);
10054 typedef struct LDKSocketDescriptor_JCalls {
10055 atomic_size_t refcnt;
10058 jmethodID send_data_meth;
10059 jmethodID disconnect_socket_meth;
10061 jmethodID hash_meth;
10062 } LDKSocketDescriptor_JCalls;
10063 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10064 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10065 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10067 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10068 if (get_jenv_res == JNI_EDETACHED) {
10069 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10071 DO_ASSERT(get_jenv_res == JNI_OK);
10073 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10074 if (get_jenv_res == JNI_EDETACHED) {
10075 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10080 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10081 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10083 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10084 if (get_jenv_res == JNI_EDETACHED) {
10085 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10087 DO_ASSERT(get_jenv_res == JNI_OK);
10089 LDKu8slice data_var = data;
10090 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
10091 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
10092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10093 CHECK(obj != NULL);
10094 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
10095 if ((*env)->ExceptionCheck(env)) {
10096 (*env)->ExceptionDescribe(env);
10097 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
10099 if (get_jenv_res == JNI_EDETACHED) {
10100 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10104 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10105 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10107 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10108 if (get_jenv_res == JNI_EDETACHED) {
10109 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10111 DO_ASSERT(get_jenv_res == JNI_OK);
10113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10114 CHECK(obj != NULL);
10115 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
10116 if ((*env)->ExceptionCheck(env)) {
10117 (*env)->ExceptionDescribe(env);
10118 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
10120 if (get_jenv_res == JNI_EDETACHED) {
10121 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10124 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10125 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10127 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10128 if (get_jenv_res == JNI_EDETACHED) {
10129 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10131 DO_ASSERT(get_jenv_res == JNI_OK);
10133 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10134 *other_arg_clone = SocketDescriptor_clone(other_arg);
10135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10136 CHECK(obj != NULL);
10137 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
10138 if ((*env)->ExceptionCheck(env)) {
10139 (*env)->ExceptionDescribe(env);
10140 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
10142 if (get_jenv_res == JNI_EDETACHED) {
10143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10147 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10148 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10150 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10151 if (get_jenv_res == JNI_EDETACHED) {
10152 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10154 DO_ASSERT(get_jenv_res == JNI_OK);
10156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10157 CHECK(obj != NULL);
10158 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
10159 if ((*env)->ExceptionCheck(env)) {
10160 (*env)->ExceptionDescribe(env);
10161 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
10163 if (get_jenv_res == JNI_EDETACHED) {
10164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10168 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10169 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10170 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10172 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
10173 jclass c = (*env)->GetObjectClass(env, o);
10175 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10176 atomic_init(&calls->refcnt, 1);
10177 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10178 calls->o = (*env)->NewWeakGlobalRef(env, o);
10179 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
10180 CHECK(calls->send_data_meth != NULL);
10181 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
10182 CHECK(calls->disconnect_socket_meth != NULL);
10183 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
10184 CHECK(calls->eq_meth != NULL);
10185 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
10186 CHECK(calls->hash_meth != NULL);
10188 LDKSocketDescriptor ret = {
10189 .this_arg = (void*) calls,
10190 .send_data = send_data_LDKSocketDescriptor_jcall,
10191 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10192 .eq = eq_LDKSocketDescriptor_jcall,
10193 .hash = hash_LDKSocketDescriptor_jcall,
10194 .cloned = LDKSocketDescriptor_JCalls_cloned,
10195 .free = LDKSocketDescriptor_JCalls_free,
10199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
10200 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10201 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
10202 return (uint64_t)res_ptr;
10204 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) {
10205 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10206 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10207 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10208 LDKu8slice data_ref;
10209 data_ref.datalen = (*env)->GetArrayLength(env, data);
10210 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
10211 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10212 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
10216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
10217 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10218 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10219 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10220 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
10224 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10225 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10226 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10227 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
10231 typedef struct LDKScore_JCalls {
10232 atomic_size_t refcnt;
10235 jmethodID channel_penalty_msat_meth;
10237 static void LDKScore_JCalls_free(void* this_arg) {
10238 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10239 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10241 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10242 if (get_jenv_res == JNI_EDETACHED) {
10243 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10245 DO_ASSERT(get_jenv_res == JNI_OK);
10247 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10248 if (get_jenv_res == JNI_EDETACHED) {
10249 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10254 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) {
10255 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10257 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10258 if (get_jenv_res == JNI_EDETACHED) {
10259 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10261 DO_ASSERT(get_jenv_res == JNI_OK);
10263 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10264 CHECK(obj != NULL);
10265 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id);
10266 if ((*env)->ExceptionCheck(env)) {
10267 (*env)->ExceptionDescribe(env);
10268 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10270 if (get_jenv_res == JNI_EDETACHED) {
10271 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10275 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10276 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10277 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10279 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10280 jclass c = (*env)->GetObjectClass(env, o);
10282 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10283 atomic_init(&calls->refcnt, 1);
10284 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10285 calls->o = (*env)->NewWeakGlobalRef(env, o);
10286 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(J)J");
10287 CHECK(calls->channel_penalty_msat_meth != NULL);
10290 .this_arg = (void*) calls,
10291 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10292 .free = LDKScore_JCalls_free,
10296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10297 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10298 *res_ptr = LDKScore_init(env, clz, o);
10299 return (uint64_t)res_ptr;
10301 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) {
10302 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10303 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10304 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10305 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id);
10309 typedef struct LDKChannelManagerPersister_JCalls {
10310 atomic_size_t refcnt;
10313 jmethodID persist_manager_meth;
10314 } LDKChannelManagerPersister_JCalls;
10315 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
10316 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10317 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10319 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10320 if (get_jenv_res == JNI_EDETACHED) {
10321 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10323 DO_ASSERT(get_jenv_res == JNI_OK);
10325 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10326 if (get_jenv_res == JNI_EDETACHED) {
10327 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10332 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10333 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10335 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10336 if (get_jenv_res == JNI_EDETACHED) {
10337 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10339 DO_ASSERT(get_jenv_res == JNI_OK);
10341 LDKChannelManager channel_manager_var = *channel_manager;
10342 // Warning: we may need a move here but no clone is available for LDKChannelManager
10343 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10344 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10345 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
10346 if (channel_manager_var.is_owned) {
10347 channel_manager_ref |= 1;
10349 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10350 CHECK(obj != NULL);
10351 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10352 if ((*env)->ExceptionCheck(env)) {
10353 (*env)->ExceptionDescribe(env);
10354 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
10356 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10357 CHECK_ACCESS(ret_ptr);
10358 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10359 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
10360 if (get_jenv_res == JNI_EDETACHED) {
10361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10365 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
10366 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
10367 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10369 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
10370 jclass c = (*env)->GetObjectClass(env, o);
10372 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
10373 atomic_init(&calls->refcnt, 1);
10374 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10375 calls->o = (*env)->NewWeakGlobalRef(env, o);
10376 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10377 CHECK(calls->persist_manager_meth != NULL);
10379 LDKChannelManagerPersister ret = {
10380 .this_arg = (void*) calls,
10381 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
10382 .free = LDKChannelManagerPersister_JCalls_free,
10386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10387 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
10388 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
10389 return (uint64_t)res_ptr;
10391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10392 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10393 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10394 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
10395 LDKChannelManager channel_manager_conv;
10396 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10397 channel_manager_conv.is_owned = false;
10398 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10399 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10400 return (uint64_t)ret_conv;
10403 static jclass LDKFallback_SegWitProgram_class = NULL;
10404 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
10405 static jclass LDKFallback_PubKeyHash_class = NULL;
10406 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
10407 static jclass LDKFallback_ScriptHash_class = NULL;
10408 static jmethodID LDKFallback_ScriptHash_meth = NULL;
10409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
10410 LDKFallback_SegWitProgram_class =
10411 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
10412 CHECK(LDKFallback_SegWitProgram_class != NULL);
10413 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
10414 CHECK(LDKFallback_SegWitProgram_meth != NULL);
10415 LDKFallback_PubKeyHash_class =
10416 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
10417 CHECK(LDKFallback_PubKeyHash_class != NULL);
10418 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
10419 CHECK(LDKFallback_PubKeyHash_meth != NULL);
10420 LDKFallback_ScriptHash_class =
10421 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
10422 CHECK(LDKFallback_ScriptHash_class != NULL);
10423 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
10424 CHECK(LDKFallback_ScriptHash_meth != NULL);
10426 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10427 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10429 case LDKFallback_SegWitProgram: {
10430 uint8_t version_val = obj->seg_wit_program.version._0;
10431 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10432 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
10433 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
10434 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
10436 case LDKFallback_PubKeyHash: {
10437 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
10438 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
10439 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
10441 case LDKFallback_ScriptHash: {
10442 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
10443 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
10444 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
10449 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10450 LDKStr ret_str = _ldk_get_compiled_version();
10451 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10456 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10457 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10458 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10464 LDKTransaction _res_ref;
10465 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10466 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10467 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10468 _res_ref.data_is_owned = true;
10469 Transaction_free(_res_ref);
10472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
10473 LDKCVec_u8Z script_pubkey_ref;
10474 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10475 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10476 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
10477 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10478 *ret_ref = TxOut_new(script_pubkey_ref, value);
10479 return (uint64_t)ret_ref;
10482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
10483 if ((_res & 1) != 0) return;
10484 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10485 CHECK_ACCESS(_res_ptr);
10486 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10488 TxOut_free(_res_conv);
10491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10492 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10493 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10494 *ret_ref = TxOut_clone(orig_conv);
10495 return (uint64_t)ret_ref;
10498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
10499 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10504 LDKSecretKey o_ref;
10505 CHECK((*env)->GetArrayLength(env, o) == 32);
10506 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
10507 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10508 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10509 return (uint64_t)ret_conv;
10512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10513 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10514 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10515 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10516 return (uint64_t)ret_conv;
10519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10520 if ((_res & 1) != 0) return;
10521 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10522 CHECK_ACCESS(_res_ptr);
10523 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
10525 CResult_SecretKeyErrorZ_free(_res_conv);
10528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10529 LDKPublicKey o_ref;
10530 CHECK((*env)->GetArrayLength(env, o) == 33);
10531 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
10532 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10533 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10534 return (uint64_t)ret_conv;
10537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10538 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10539 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10540 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10541 return (uint64_t)ret_conv;
10544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10545 if ((_res & 1) != 0) return;
10546 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10547 CHECK_ACCESS(_res_ptr);
10548 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
10550 CResult_PublicKeyErrorZ_free(_res_conv);
10553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10554 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10555 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10556 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10557 return (uint64_t)ret_conv;
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10561 LDKTxCreationKeys o_conv;
10562 o_conv.inner = (void*)(o & (~1));
10563 o_conv.is_owned = (o & 1) || (o == 0);
10564 o_conv = TxCreationKeys_clone(&o_conv);
10565 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10566 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10567 return (uint64_t)ret_conv;
10570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10571 LDKDecodeError e_conv;
10572 e_conv.inner = (void*)(e & (~1));
10573 e_conv.is_owned = (e & 1) || (e == 0);
10574 e_conv = DecodeError_clone(&e_conv);
10575 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10576 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10577 return (uint64_t)ret_conv;
10580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10581 if ((_res & 1) != 0) return;
10582 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10583 CHECK_ACCESS(_res_ptr);
10584 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
10586 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10590 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10591 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10592 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10593 return (uint64_t)ret_conv;
10596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10597 LDKChannelPublicKeys o_conv;
10598 o_conv.inner = (void*)(o & (~1));
10599 o_conv.is_owned = (o & 1) || (o == 0);
10600 o_conv = ChannelPublicKeys_clone(&o_conv);
10601 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10602 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10603 return (uint64_t)ret_conv;
10606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10607 LDKDecodeError e_conv;
10608 e_conv.inner = (void*)(e & (~1));
10609 e_conv.is_owned = (e & 1) || (e == 0);
10610 e_conv = DecodeError_clone(&e_conv);
10611 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10612 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10613 return (uint64_t)ret_conv;
10616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10617 if ((_res & 1) != 0) return;
10618 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10619 CHECK_ACCESS(_res_ptr);
10620 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
10622 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10626 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10627 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10628 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10629 return (uint64_t)ret_conv;
10632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10633 LDKTxCreationKeys o_conv;
10634 o_conv.inner = (void*)(o & (~1));
10635 o_conv.is_owned = (o & 1) || (o == 0);
10636 o_conv = TxCreationKeys_clone(&o_conv);
10637 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10638 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10639 return (uint64_t)ret_conv;
10642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10643 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10644 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10645 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10646 return (uint64_t)ret_conv;
10649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10650 if ((_res & 1) != 0) return;
10651 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10652 CHECK_ACCESS(_res_ptr);
10653 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
10655 CResult_TxCreationKeysErrorZ_free(_res_conv);
10658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10659 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10660 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10661 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10662 return (uint64_t)ret_conv;
10665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
10666 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10667 *ret_copy = COption_u32Z_some(o);
10668 uint64_t ret_ref = (uint64_t)ret_copy;
10672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
10673 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10674 *ret_copy = COption_u32Z_none();
10675 uint64_t ret_ref = (uint64_t)ret_copy;
10679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10680 if ((_res & 1) != 0) return;
10681 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10682 CHECK_ACCESS(_res_ptr);
10683 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
10685 COption_u32Z_free(_res_conv);
10688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10689 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10690 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10691 *ret_copy = COption_u32Z_clone(orig_conv);
10692 uint64_t ret_ref = (uint64_t)ret_copy;
10696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10697 LDKHTLCOutputInCommitment o_conv;
10698 o_conv.inner = (void*)(o & (~1));
10699 o_conv.is_owned = (o & 1) || (o == 0);
10700 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10701 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10702 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10703 return (uint64_t)ret_conv;
10706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10707 LDKDecodeError e_conv;
10708 e_conv.inner = (void*)(e & (~1));
10709 e_conv.is_owned = (e & 1) || (e == 0);
10710 e_conv = DecodeError_clone(&e_conv);
10711 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10712 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10713 return (uint64_t)ret_conv;
10716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10717 if ((_res & 1) != 0) return;
10718 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10719 CHECK_ACCESS(_res_ptr);
10720 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
10722 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10726 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10727 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10728 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10729 return (uint64_t)ret_conv;
10732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10733 LDKCounterpartyChannelTransactionParameters o_conv;
10734 o_conv.inner = (void*)(o & (~1));
10735 o_conv.is_owned = (o & 1) || (o == 0);
10736 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10737 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10738 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10739 return (uint64_t)ret_conv;
10742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10743 LDKDecodeError e_conv;
10744 e_conv.inner = (void*)(e & (~1));
10745 e_conv.is_owned = (e & 1) || (e == 0);
10746 e_conv = DecodeError_clone(&e_conv);
10747 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10748 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10749 return (uint64_t)ret_conv;
10752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10753 if ((_res & 1) != 0) return;
10754 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10755 CHECK_ACCESS(_res_ptr);
10756 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10758 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10762 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10763 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10764 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10765 return (uint64_t)ret_conv;
10768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10769 LDKChannelTransactionParameters o_conv;
10770 o_conv.inner = (void*)(o & (~1));
10771 o_conv.is_owned = (o & 1) || (o == 0);
10772 o_conv = ChannelTransactionParameters_clone(&o_conv);
10773 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10774 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10775 return (uint64_t)ret_conv;
10778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10779 LDKDecodeError e_conv;
10780 e_conv.inner = (void*)(e & (~1));
10781 e_conv.is_owned = (e & 1) || (e == 0);
10782 e_conv = DecodeError_clone(&e_conv);
10783 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10784 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10785 return (uint64_t)ret_conv;
10788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10789 if ((_res & 1) != 0) return;
10790 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10791 CHECK_ACCESS(_res_ptr);
10792 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10794 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10798 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10799 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10800 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10801 return (uint64_t)ret_conv;
10804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10805 LDKCVec_SignatureZ _res_constr;
10806 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10807 if (_res_constr.datalen > 0)
10808 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10810 _res_constr.data = NULL;
10811 for (size_t i = 0; i < _res_constr.datalen; i++) {
10812 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10813 LDKSignature _res_conv_8_ref;
10814 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
10815 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
10816 _res_constr.data[i] = _res_conv_8_ref;
10818 CVec_SignatureZ_free(_res_constr);
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10822 LDKHolderCommitmentTransaction o_conv;
10823 o_conv.inner = (void*)(o & (~1));
10824 o_conv.is_owned = (o & 1) || (o == 0);
10825 o_conv = HolderCommitmentTransaction_clone(&o_conv);
10826 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10827 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10828 return (uint64_t)ret_conv;
10831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10832 LDKDecodeError e_conv;
10833 e_conv.inner = (void*)(e & (~1));
10834 e_conv.is_owned = (e & 1) || (e == 0);
10835 e_conv = DecodeError_clone(&e_conv);
10836 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10837 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10838 return (uint64_t)ret_conv;
10841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10842 if ((_res & 1) != 0) return;
10843 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10844 CHECK_ACCESS(_res_ptr);
10845 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10847 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10851 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10852 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10853 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10854 return (uint64_t)ret_conv;
10857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10858 LDKBuiltCommitmentTransaction o_conv;
10859 o_conv.inner = (void*)(o & (~1));
10860 o_conv.is_owned = (o & 1) || (o == 0);
10861 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10862 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10863 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10864 return (uint64_t)ret_conv;
10867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10868 LDKDecodeError e_conv;
10869 e_conv.inner = (void*)(e & (~1));
10870 e_conv.is_owned = (e & 1) || (e == 0);
10871 e_conv = DecodeError_clone(&e_conv);
10872 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10873 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10874 return (uint64_t)ret_conv;
10877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10878 if ((_res & 1) != 0) return;
10879 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10880 CHECK_ACCESS(_res_ptr);
10881 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
10883 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10887 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10888 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10889 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10890 return (uint64_t)ret_conv;
10893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10894 LDKTrustedClosingTransaction o_conv;
10895 o_conv.inner = (void*)(o & (~1));
10896 o_conv.is_owned = (o & 1) || (o == 0);
10897 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
10898 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10899 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10900 return (uint64_t)ret_conv;
10903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10904 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10905 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10906 return (uint64_t)ret_conv;
10909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10910 if ((_res & 1) != 0) return;
10911 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10912 CHECK_ACCESS(_res_ptr);
10913 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
10915 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10919 LDKCommitmentTransaction o_conv;
10920 o_conv.inner = (void*)(o & (~1));
10921 o_conv.is_owned = (o & 1) || (o == 0);
10922 o_conv = CommitmentTransaction_clone(&o_conv);
10923 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10924 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10925 return (uint64_t)ret_conv;
10928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10929 LDKDecodeError e_conv;
10930 e_conv.inner = (void*)(e & (~1));
10931 e_conv.is_owned = (e & 1) || (e == 0);
10932 e_conv = DecodeError_clone(&e_conv);
10933 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10934 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10935 return (uint64_t)ret_conv;
10938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10939 if ((_res & 1) != 0) return;
10940 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10941 CHECK_ACCESS(_res_ptr);
10942 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
10944 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10948 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
10949 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10950 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10951 return (uint64_t)ret_conv;
10954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10955 LDKTrustedCommitmentTransaction o_conv;
10956 o_conv.inner = (void*)(o & (~1));
10957 o_conv.is_owned = (o & 1) || (o == 0);
10958 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10959 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10960 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10961 return (uint64_t)ret_conv;
10964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10965 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10966 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10967 return (uint64_t)ret_conv;
10970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10971 if ((_res & 1) != 0) return;
10972 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10973 CHECK_ACCESS(_res_ptr);
10974 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
10976 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10980 LDKCVec_SignatureZ o_constr;
10981 o_constr.datalen = (*env)->GetArrayLength(env, o);
10982 if (o_constr.datalen > 0)
10983 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10985 o_constr.data = NULL;
10986 for (size_t i = 0; i < o_constr.datalen; i++) {
10987 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10988 LDKSignature o_conv_8_ref;
10989 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
10990 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
10991 o_constr.data[i] = o_conv_8_ref;
10993 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10994 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10995 return (uint64_t)ret_conv;
10998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
10999 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11000 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11001 return (uint64_t)ret_conv;
11004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11005 if ((_res & 1) != 0) return;
11006 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11007 CHECK_ACCESS(_res_ptr);
11008 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11010 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11014 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11015 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11016 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11017 return (uint64_t)ret_conv;
11020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11021 LDKShutdownScript o_conv;
11022 o_conv.inner = (void*)(o & (~1));
11023 o_conv.is_owned = (o & 1) || (o == 0);
11024 o_conv = ShutdownScript_clone(&o_conv);
11025 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11026 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11027 return (uint64_t)ret_conv;
11030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11031 LDKDecodeError e_conv;
11032 e_conv.inner = (void*)(e & (~1));
11033 e_conv.is_owned = (e & 1) || (e == 0);
11034 e_conv = DecodeError_clone(&e_conv);
11035 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11036 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11037 return (uint64_t)ret_conv;
11040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11041 if ((_res & 1) != 0) return;
11042 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11043 CHECK_ACCESS(_res_ptr);
11044 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11046 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11050 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11051 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11052 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11053 return (uint64_t)ret_conv;
11056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11057 LDKShutdownScript o_conv;
11058 o_conv.inner = (void*)(o & (~1));
11059 o_conv.is_owned = (o & 1) || (o == 0);
11060 o_conv = ShutdownScript_clone(&o_conv);
11061 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11062 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11063 return (uint64_t)ret_conv;
11066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11067 LDKInvalidShutdownScript e_conv;
11068 e_conv.inner = (void*)(e & (~1));
11069 e_conv.is_owned = (e & 1) || (e == 0);
11070 e_conv = InvalidShutdownScript_clone(&e_conv);
11071 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11072 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11073 return (uint64_t)ret_conv;
11076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11077 if ((_res & 1) != 0) return;
11078 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11079 CHECK_ACCESS(_res_ptr);
11080 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11082 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11086 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11087 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11088 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11089 return (uint64_t)ret_conv;
11092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
11093 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11094 *ret_conv = CResult_NoneErrorZ_ok();
11095 return (uint64_t)ret_conv;
11098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11099 LDKIOError e_conv = LDKIOError_from_java(env, e);
11100 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11101 *ret_conv = CResult_NoneErrorZ_err(e_conv);
11102 return (uint64_t)ret_conv;
11105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11106 if ((_res & 1) != 0) return;
11107 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11108 CHECK_ACCESS(_res_ptr);
11109 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
11111 CResult_NoneErrorZ_free(_res_conv);
11114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11115 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
11116 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11117 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
11118 return (uint64_t)ret_conv;
11121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11122 LDKRouteHop o_conv;
11123 o_conv.inner = (void*)(o & (~1));
11124 o_conv.is_owned = (o & 1) || (o == 0);
11125 o_conv = RouteHop_clone(&o_conv);
11126 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11127 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11128 return (uint64_t)ret_conv;
11131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11132 LDKDecodeError e_conv;
11133 e_conv.inner = (void*)(e & (~1));
11134 e_conv.is_owned = (e & 1) || (e == 0);
11135 e_conv = DecodeError_clone(&e_conv);
11136 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11137 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11138 return (uint64_t)ret_conv;
11141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11142 if ((_res & 1) != 0) return;
11143 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11144 CHECK_ACCESS(_res_ptr);
11145 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
11147 CResult_RouteHopDecodeErrorZ_free(_res_conv);
11150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11151 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
11152 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11153 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11154 return (uint64_t)ret_conv;
11157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11158 LDKCVec_RouteHopZ _res_constr;
11159 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11160 if (_res_constr.datalen > 0)
11161 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11163 _res_constr.data = NULL;
11164 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11165 for (size_t k = 0; k < _res_constr.datalen; k++) {
11166 int64_t _res_conv_10 = _res_vals[k];
11167 LDKRouteHop _res_conv_10_conv;
11168 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
11169 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
11170 _res_constr.data[k] = _res_conv_10_conv;
11172 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11173 CVec_RouteHopZ_free(_res_constr);
11176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11177 LDKCVec_CVec_RouteHopZZ _res_constr;
11178 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11179 if (_res_constr.datalen > 0)
11180 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11182 _res_constr.data = NULL;
11183 for (size_t m = 0; m < _res_constr.datalen; m++) {
11184 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
11185 LDKCVec_RouteHopZ _res_conv_12_constr;
11186 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
11187 if (_res_conv_12_constr.datalen > 0)
11188 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11190 _res_conv_12_constr.data = NULL;
11191 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
11192 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11193 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11194 LDKRouteHop _res_conv_12_conv_10_conv;
11195 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
11196 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
11197 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11199 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
11200 _res_constr.data[m] = _res_conv_12_constr;
11202 CVec_CVec_RouteHopZZ_free(_res_constr);
11205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11207 o_conv.inner = (void*)(o & (~1));
11208 o_conv.is_owned = (o & 1) || (o == 0);
11209 o_conv = Route_clone(&o_conv);
11210 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11211 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11212 return (uint64_t)ret_conv;
11215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11216 LDKDecodeError e_conv;
11217 e_conv.inner = (void*)(e & (~1));
11218 e_conv.is_owned = (e & 1) || (e == 0);
11219 e_conv = DecodeError_clone(&e_conv);
11220 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11221 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11222 return (uint64_t)ret_conv;
11225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11226 if ((_res & 1) != 0) return;
11227 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11228 CHECK_ACCESS(_res_ptr);
11229 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
11231 CResult_RouteDecodeErrorZ_free(_res_conv);
11234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11235 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
11236 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11237 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11238 return (uint64_t)ret_conv;
11241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
11242 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11243 *ret_copy = COption_u64Z_some(o);
11244 uint64_t ret_ref = (uint64_t)ret_copy;
11248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
11249 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11250 *ret_copy = COption_u64Z_none();
11251 uint64_t ret_ref = (uint64_t)ret_copy;
11255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11256 if ((_res & 1) != 0) return;
11257 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11258 CHECK_ACCESS(_res_ptr);
11259 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11261 COption_u64Z_free(_res_conv);
11264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11265 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11266 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11267 *ret_copy = COption_u64Z_clone(orig_conv);
11268 uint64_t ret_ref = (uint64_t)ret_copy;
11272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11273 LDKCVec_ChannelDetailsZ _res_constr;
11274 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11275 if (_res_constr.datalen > 0)
11276 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11278 _res_constr.data = NULL;
11279 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11280 for (size_t q = 0; q < _res_constr.datalen; q++) {
11281 int64_t _res_conv_16 = _res_vals[q];
11282 LDKChannelDetails _res_conv_16_conv;
11283 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11284 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11285 _res_constr.data[q] = _res_conv_16_conv;
11287 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11288 CVec_ChannelDetailsZ_free(_res_constr);
11291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11292 LDKCVec_RouteHintZ _res_constr;
11293 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11294 if (_res_constr.datalen > 0)
11295 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11297 _res_constr.data = NULL;
11298 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11299 for (size_t l = 0; l < _res_constr.datalen; l++) {
11300 int64_t _res_conv_11 = _res_vals[l];
11301 LDKRouteHint _res_conv_11_conv;
11302 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11303 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11304 _res_constr.data[l] = _res_conv_11_conv;
11306 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11307 CVec_RouteHintZ_free(_res_constr);
11310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11312 o_conv.inner = (void*)(o & (~1));
11313 o_conv.is_owned = (o & 1) || (o == 0);
11314 o_conv = Route_clone(&o_conv);
11315 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11316 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11317 return (uint64_t)ret_conv;
11320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11321 LDKLightningError e_conv;
11322 e_conv.inner = (void*)(e & (~1));
11323 e_conv.is_owned = (e & 1) || (e == 0);
11324 e_conv = LightningError_clone(&e_conv);
11325 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11326 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11327 return (uint64_t)ret_conv;
11330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11331 if ((_res & 1) != 0) return;
11332 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11333 CHECK_ACCESS(_res_ptr);
11334 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11336 CResult_RouteLightningErrorZ_free(_res_conv);
11339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11340 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11341 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11342 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11343 return (uint64_t)ret_conv;
11346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11347 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11348 CHECK_ACCESS(o_ptr);
11349 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11350 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11351 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11352 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11353 return (uint64_t)ret_conv;
11356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11357 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
11358 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11359 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11360 return (uint64_t)ret_conv;
11363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11364 if ((_res & 1) != 0) return;
11365 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11366 CHECK_ACCESS(_res_ptr);
11367 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11369 CResult_TxOutAccessErrorZ_free(_res_conv);
11372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11373 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11374 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11375 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11376 return (uint64_t)ret_conv;
11379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11380 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
11381 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11382 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
11383 return ((uint64_t)ret_conv);
11386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11387 LDKTransaction b_ref;
11388 b_ref.datalen = (*env)->GetArrayLength(env, b);
11389 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
11390 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11391 b_ref.data_is_owned = true;
11392 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11393 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
11394 return ((uint64_t)ret_conv);
11397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11398 if ((_res & 1) != 0) return;
11399 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11400 CHECK_ACCESS(_res_ptr);
11401 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
11403 C2Tuple_usizeTransactionZ_free(_res_conv);
11406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11407 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
11408 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11409 if (_res_constr.datalen > 0)
11410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11412 _res_constr.data = NULL;
11413 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11414 for (size_t c = 0; c < _res_constr.datalen; c++) {
11415 int64_t _res_conv_28 = _res_vals[c];
11416 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
11417 CHECK_ACCESS(_res_conv_28_ptr);
11418 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
11419 FREE((void*)_res_conv_28);
11420 _res_constr.data[c] = _res_conv_28_conv;
11422 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11423 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
11426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11427 LDKCVec_TxidZ _res_constr;
11428 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11429 if (_res_constr.datalen > 0)
11430 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11432 _res_constr.data = NULL;
11433 for (size_t i = 0; i < _res_constr.datalen; i++) {
11434 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11435 LDKThirtyTwoBytes _res_conv_8_ref;
11436 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
11437 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
11438 _res_constr.data[i] = _res_conv_8_ref;
11440 CVec_TxidZ_free(_res_constr);
11443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
11444 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11445 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11446 return (uint64_t)ret_conv;
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
11450 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
11451 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11452 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11453 return (uint64_t)ret_conv;
11456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11457 if ((_res & 1) != 0) return;
11458 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11459 CHECK_ACCESS(_res_ptr);
11460 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
11462 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11466 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11467 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11468 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11469 return (uint64_t)ret_conv;
11472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11473 LDKCVec_MonitorEventZ _res_constr;
11474 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11475 if (_res_constr.datalen > 0)
11476 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
11478 _res_constr.data = NULL;
11479 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11480 for (size_t o = 0; o < _res_constr.datalen; o++) {
11481 int64_t _res_conv_14 = _res_vals[o];
11482 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
11483 CHECK_ACCESS(_res_conv_14_ptr);
11484 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
11485 FREE((void*)_res_conv_14);
11486 _res_constr.data[o] = _res_conv_14_conv;
11488 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11489 CVec_MonitorEventZ_free(_res_constr);
11492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11493 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11494 CHECK_ACCESS(o_ptr);
11495 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
11496 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11497 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11498 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11499 uint64_t ret_ref = (uint64_t)ret_copy;
11503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
11504 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11505 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11506 uint64_t ret_ref = (uint64_t)ret_copy;
11510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11511 if ((_res & 1) != 0) return;
11512 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11513 CHECK_ACCESS(_res_ptr);
11514 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
11516 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11520 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11521 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11522 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11523 uint64_t ret_ref = (uint64_t)ret_copy;
11527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11528 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11529 CHECK_ACCESS(o_ptr);
11530 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
11531 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
11532 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11533 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11534 uint64_t ret_ref = (uint64_t)ret_copy;
11538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
11539 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11540 *ret_copy = COption_NetworkUpdateZ_none();
11541 uint64_t ret_ref = (uint64_t)ret_copy;
11545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11546 if ((_res & 1) != 0) return;
11547 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11548 CHECK_ACCESS(_res_ptr);
11549 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
11551 COption_NetworkUpdateZ_free(_res_conv);
11554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11555 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
11556 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11557 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11558 uint64_t ret_ref = (uint64_t)ret_copy;
11562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11563 LDKCVec_SpendableOutputDescriptorZ _res_constr;
11564 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11565 if (_res_constr.datalen > 0)
11566 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11568 _res_constr.data = NULL;
11569 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11570 for (size_t b = 0; b < _res_constr.datalen; b++) {
11571 int64_t _res_conv_27 = _res_vals[b];
11572 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
11573 CHECK_ACCESS(_res_conv_27_ptr);
11574 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
11575 FREE((void*)_res_conv_27);
11576 _res_constr.data[b] = _res_conv_27_conv;
11578 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11579 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11583 LDKCVec_MessageSendEventZ _res_constr;
11584 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11585 if (_res_constr.datalen > 0)
11586 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11588 _res_constr.data = NULL;
11589 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11590 for (size_t s = 0; s < _res_constr.datalen; s++) {
11591 int64_t _res_conv_18 = _res_vals[s];
11592 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
11593 CHECK_ACCESS(_res_conv_18_ptr);
11594 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
11595 FREE((void*)_res_conv_18);
11596 _res_constr.data[s] = _res_conv_18_conv;
11598 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11599 CVec_MessageSendEventZ_free(_res_constr);
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11603 LDKInitFeatures o_conv;
11604 o_conv.inner = (void*)(o & (~1));
11605 o_conv.is_owned = (o & 1) || (o == 0);
11606 o_conv = InitFeatures_clone(&o_conv);
11607 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11608 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
11609 return (uint64_t)ret_conv;
11612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11613 LDKDecodeError e_conv;
11614 e_conv.inner = (void*)(e & (~1));
11615 e_conv.is_owned = (e & 1) || (e == 0);
11616 e_conv = DecodeError_clone(&e_conv);
11617 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11618 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
11619 return (uint64_t)ret_conv;
11622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11623 if ((_res & 1) != 0) return;
11624 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11625 CHECK_ACCESS(_res_ptr);
11626 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
11628 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
11631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11632 LDKNodeFeatures o_conv;
11633 o_conv.inner = (void*)(o & (~1));
11634 o_conv.is_owned = (o & 1) || (o == 0);
11635 o_conv = NodeFeatures_clone(&o_conv);
11636 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11637 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
11638 return (uint64_t)ret_conv;
11641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11642 LDKDecodeError e_conv;
11643 e_conv.inner = (void*)(e & (~1));
11644 e_conv.is_owned = (e & 1) || (e == 0);
11645 e_conv = DecodeError_clone(&e_conv);
11646 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11647 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
11648 return (uint64_t)ret_conv;
11651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11652 if ((_res & 1) != 0) return;
11653 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11654 CHECK_ACCESS(_res_ptr);
11655 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
11657 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
11660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11661 LDKChannelFeatures o_conv;
11662 o_conv.inner = (void*)(o & (~1));
11663 o_conv.is_owned = (o & 1) || (o == 0);
11664 o_conv = ChannelFeatures_clone(&o_conv);
11665 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11666 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
11667 return (uint64_t)ret_conv;
11670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11671 LDKDecodeError e_conv;
11672 e_conv.inner = (void*)(e & (~1));
11673 e_conv.is_owned = (e & 1) || (e == 0);
11674 e_conv = DecodeError_clone(&e_conv);
11675 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11676 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
11677 return (uint64_t)ret_conv;
11680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11681 if ((_res & 1) != 0) return;
11682 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11683 CHECK_ACCESS(_res_ptr);
11684 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
11686 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
11689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11690 LDKInvoiceFeatures o_conv;
11691 o_conv.inner = (void*)(o & (~1));
11692 o_conv.is_owned = (o & 1) || (o == 0);
11693 o_conv = InvoiceFeatures_clone(&o_conv);
11694 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11695 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
11696 return (uint64_t)ret_conv;
11699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11700 LDKDecodeError e_conv;
11701 e_conv.inner = (void*)(e & (~1));
11702 e_conv.is_owned = (e & 1) || (e == 0);
11703 e_conv = DecodeError_clone(&e_conv);
11704 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11705 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
11706 return (uint64_t)ret_conv;
11709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11710 if ((_res & 1) != 0) return;
11711 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11712 CHECK_ACCESS(_res_ptr);
11713 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
11715 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
11718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11719 LDKDelayedPaymentOutputDescriptor o_conv;
11720 o_conv.inner = (void*)(o & (~1));
11721 o_conv.is_owned = (o & 1) || (o == 0);
11722 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
11723 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11724 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11725 return (uint64_t)ret_conv;
11728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11729 LDKDecodeError e_conv;
11730 e_conv.inner = (void*)(e & (~1));
11731 e_conv.is_owned = (e & 1) || (e == 0);
11732 e_conv = DecodeError_clone(&e_conv);
11733 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11734 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11735 return (uint64_t)ret_conv;
11738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11739 if ((_res & 1) != 0) return;
11740 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11741 CHECK_ACCESS(_res_ptr);
11742 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
11744 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11748 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11749 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11750 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11751 return (uint64_t)ret_conv;
11754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11755 LDKStaticPaymentOutputDescriptor o_conv;
11756 o_conv.inner = (void*)(o & (~1));
11757 o_conv.is_owned = (o & 1) || (o == 0);
11758 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
11759 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11760 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11761 return (uint64_t)ret_conv;
11764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11765 LDKDecodeError e_conv;
11766 e_conv.inner = (void*)(e & (~1));
11767 e_conv.is_owned = (e & 1) || (e == 0);
11768 e_conv = DecodeError_clone(&e_conv);
11769 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11770 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11771 return (uint64_t)ret_conv;
11774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11775 if ((_res & 1) != 0) return;
11776 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11777 CHECK_ACCESS(_res_ptr);
11778 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
11780 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11784 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11785 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11786 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11787 return (uint64_t)ret_conv;
11790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11791 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11792 CHECK_ACCESS(o_ptr);
11793 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
11794 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
11795 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11796 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
11797 return (uint64_t)ret_conv;
11800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11801 LDKDecodeError e_conv;
11802 e_conv.inner = (void*)(e & (~1));
11803 e_conv.is_owned = (e & 1) || (e == 0);
11804 e_conv = DecodeError_clone(&e_conv);
11805 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11806 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
11807 return (uint64_t)ret_conv;
11810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11811 if ((_res & 1) != 0) return;
11812 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11813 CHECK_ACCESS(_res_ptr);
11814 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
11816 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
11819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11820 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
11821 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11822 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
11823 return (uint64_t)ret_conv;
11826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
11827 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11828 *ret_conv = CResult_NoneNoneZ_ok();
11829 return (uint64_t)ret_conv;
11832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
11833 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11834 *ret_conv = CResult_NoneNoneZ_err();
11835 return (uint64_t)ret_conv;
11838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11839 if ((_res & 1) != 0) return;
11840 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11841 CHECK_ACCESS(_res_ptr);
11842 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11844 CResult_NoneNoneZ_free(_res_conv);
11847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11848 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11849 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11850 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11851 return (uint64_t)ret_conv;
11854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11855 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
11856 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11857 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
11858 return ((uint64_t)ret_conv);
11861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
11862 LDKSignature a_ref;
11863 CHECK((*env)->GetArrayLength(env, a) == 64);
11864 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
11865 LDKCVec_SignatureZ b_constr;
11866 b_constr.datalen = (*env)->GetArrayLength(env, b);
11867 if (b_constr.datalen > 0)
11868 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11870 b_constr.data = NULL;
11871 for (size_t i = 0; i < b_constr.datalen; i++) {
11872 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
11873 LDKSignature b_conv_8_ref;
11874 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
11875 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
11876 b_constr.data[i] = b_conv_8_ref;
11878 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11879 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
11880 return ((uint64_t)ret_conv);
11883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11884 if ((_res & 1) != 0) return;
11885 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11886 CHECK_ACCESS(_res_ptr);
11887 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
11889 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
11892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11893 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11894 CHECK_ACCESS(o_ptr);
11895 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
11896 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
11897 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11898 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
11899 return (uint64_t)ret_conv;
11902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
11903 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11904 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
11905 return (uint64_t)ret_conv;
11908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11909 if ((_res & 1) != 0) return;
11910 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11911 CHECK_ACCESS(_res_ptr);
11912 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
11914 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
11917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11918 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
11919 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11920 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
11921 return (uint64_t)ret_conv;
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11925 LDKSignature o_ref;
11926 CHECK((*env)->GetArrayLength(env, o) == 64);
11927 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
11928 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11929 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
11930 return (uint64_t)ret_conv;
11933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11934 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11935 *ret_conv = CResult_SignatureNoneZ_err();
11936 return (uint64_t)ret_conv;
11939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11940 if ((_res & 1) != 0) return;
11941 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11942 CHECK_ACCESS(_res_ptr);
11943 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
11945 CResult_SignatureNoneZ_free(_res_conv);
11948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11949 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
11950 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11951 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
11952 return (uint64_t)ret_conv;
11955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11956 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11957 CHECK_ACCESS(o_ptr);
11958 LDKSign o_conv = *(LDKSign*)(o_ptr);
11959 if (o_conv.free == LDKSign_JCalls_free) {
11960 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11961 LDKSign_JCalls_cloned(&o_conv);
11963 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11964 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
11965 return (uint64_t)ret_conv;
11968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11969 LDKDecodeError e_conv;
11970 e_conv.inner = (void*)(e & (~1));
11971 e_conv.is_owned = (e & 1) || (e == 0);
11972 e_conv = DecodeError_clone(&e_conv);
11973 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11974 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
11975 return (uint64_t)ret_conv;
11978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11979 if ((_res & 1) != 0) return;
11980 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11981 CHECK_ACCESS(_res_ptr);
11982 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
11984 CResult_SignDecodeErrorZ_free(_res_conv);
11987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11988 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
11989 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11990 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
11991 return (uint64_t)ret_conv;
11994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11995 LDKCVec_u8Z _res_ref;
11996 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11997 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11998 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11999 CVec_u8Z_free(_res_ref);
12002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
12003 LDKRecoverableSignature arg_ref;
12004 CHECK((*env)->GetArrayLength(env, arg) == 68);
12005 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
12006 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
12007 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
12008 return (uint64_t)ret_conv;
12011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
12012 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
12013 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
12014 return (uint64_t)ret_conv;
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12018 if ((_res & 1) != 0) return;
12019 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12020 CHECK_ACCESS(_res_ptr);
12021 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
12023 CResult_RecoverableSignatureNoneZ_free(_res_conv);
12026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12027 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
12028 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
12029 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
12030 return (uint64_t)ret_conv;
12033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12034 LDKCVec_CVec_u8ZZ _res_constr;
12035 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12036 if (_res_constr.datalen > 0)
12037 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
12039 _res_constr.data = NULL;
12040 for (size_t i = 0; i < _res_constr.datalen; i++) {
12041 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12042 LDKCVec_u8Z _res_conv_8_ref;
12043 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
12044 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
12045 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
12046 _res_constr.data[i] = _res_conv_8_ref;
12048 CVec_CVec_u8ZZ_free(_res_constr);
12051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
12052 LDKCVec_CVec_u8ZZ o_constr;
12053 o_constr.datalen = (*env)->GetArrayLength(env, o);
12054 if (o_constr.datalen > 0)
12055 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
12057 o_constr.data = NULL;
12058 for (size_t i = 0; i < o_constr.datalen; i++) {
12059 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
12060 LDKCVec_u8Z o_conv_8_ref;
12061 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
12062 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
12063 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
12064 o_constr.data[i] = o_conv_8_ref;
12066 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
12067 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
12068 return (uint64_t)ret_conv;
12071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
12072 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
12073 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
12074 return (uint64_t)ret_conv;
12077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12078 if ((_res & 1) != 0) return;
12079 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12080 CHECK_ACCESS(_res_ptr);
12081 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
12083 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
12086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12087 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
12088 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
12089 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
12090 return (uint64_t)ret_conv;
12093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12094 LDKInMemorySigner o_conv;
12095 o_conv.inner = (void*)(o & (~1));
12096 o_conv.is_owned = (o & 1) || (o == 0);
12097 o_conv = InMemorySigner_clone(&o_conv);
12098 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
12099 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
12100 return (uint64_t)ret_conv;
12103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_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_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
12109 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
12110 return (uint64_t)ret_conv;
12113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12114 if ((_res & 1) != 0) return;
12115 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12116 CHECK_ACCESS(_res_ptr);
12117 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
12119 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
12122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12123 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
12124 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
12125 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
12126 return (uint64_t)ret_conv;
12129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12130 LDKCVec_TxOutZ _res_constr;
12131 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12132 if (_res_constr.datalen > 0)
12133 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
12135 _res_constr.data = NULL;
12136 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12137 for (size_t h = 0; h < _res_constr.datalen; h++) {
12138 int64_t _res_conv_7 = _res_vals[h];
12139 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
12140 CHECK_ACCESS(_res_conv_7_ptr);
12141 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
12142 FREE((void*)_res_conv_7);
12143 _res_constr.data[h] = _res_conv_7_conv;
12145 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12146 CVec_TxOutZ_free(_res_constr);
12149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12150 LDKTransaction o_ref;
12151 o_ref.datalen = (*env)->GetArrayLength(env, o);
12152 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
12153 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
12154 o_ref.data_is_owned = true;
12155 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
12156 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
12157 return (uint64_t)ret_conv;
12160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
12161 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
12162 *ret_conv = CResult_TransactionNoneZ_err();
12163 return (uint64_t)ret_conv;
12166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12167 if ((_res & 1) != 0) return;
12168 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12169 CHECK_ACCESS(_res_ptr);
12170 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
12172 CResult_TransactionNoneZ_free(_res_conv);
12175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12176 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
12177 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
12178 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
12179 return (uint64_t)ret_conv;
12182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12183 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
12184 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12185 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
12186 return ((uint64_t)ret_conv);
12189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12190 LDKThirtyTwoBytes a_ref;
12191 CHECK((*env)->GetArrayLength(env, a) == 32);
12192 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12193 LDKChannelMonitor b_conv;
12194 b_conv.inner = (void*)(b & (~1));
12195 b_conv.is_owned = (b & 1) || (b == 0);
12196 b_conv = ChannelMonitor_clone(&b_conv);
12197 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12198 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
12199 return ((uint64_t)ret_conv);
12202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12203 if ((_res & 1) != 0) return;
12204 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12205 CHECK_ACCESS(_res_ptr);
12206 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
12208 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
12211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12212 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
12213 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12214 if (_res_constr.datalen > 0)
12215 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
12217 _res_constr.data = NULL;
12218 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12219 for (size_t j = 0; j < _res_constr.datalen; j++) {
12220 int64_t _res_conv_35 = _res_vals[j];
12221 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
12222 CHECK_ACCESS(_res_conv_35_ptr);
12223 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
12224 FREE((void*)_res_conv_35);
12225 _res_constr.data[j] = _res_conv_35_conv;
12227 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12228 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
12231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
12232 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
12233 o_constr.datalen = (*env)->GetArrayLength(env, o);
12234 if (o_constr.datalen > 0)
12235 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
12237 o_constr.data = NULL;
12238 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
12239 for (size_t j = 0; j < o_constr.datalen; j++) {
12240 int64_t o_conv_35 = o_vals[j];
12241 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
12242 CHECK_ACCESS(o_conv_35_ptr);
12243 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
12244 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
12245 o_constr.data[j] = o_conv_35_conv;
12247 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
12248 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12249 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
12250 return (uint64_t)ret_conv;
12253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12254 LDKIOError e_conv = LDKIOError_from_java(env, e);
12255 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12256 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
12257 return (uint64_t)ret_conv;
12260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12261 if ((_res & 1) != 0) return;
12262 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12263 CHECK_ACCESS(_res_ptr);
12264 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
12266 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
12269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12270 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
12271 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
12272 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
12273 return (uint64_t)ret_conv;
12276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12277 LDKPaymentId o_conv;
12278 o_conv.inner = (void*)(o & (~1));
12279 o_conv.is_owned = (o & 1) || (o == 0);
12280 o_conv = PaymentId_clone(&o_conv);
12281 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12282 *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv);
12283 return (uint64_t)ret_conv;
12286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12287 LDKDecodeError e_conv;
12288 e_conv.inner = (void*)(e & (~1));
12289 e_conv.is_owned = (e & 1) || (e == 0);
12290 e_conv = DecodeError_clone(&e_conv);
12291 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12292 *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv);
12293 return (uint64_t)ret_conv;
12296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12297 if ((_res & 1) != 0) return;
12298 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12299 CHECK_ACCESS(_res_ptr);
12300 LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(_res_ptr);
12302 CResult_PaymentIdDecodeErrorZ_free(_res_conv);
12305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12306 LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1);
12307 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
12308 *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv);
12309 return (uint64_t)ret_conv;
12312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
12313 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12314 *ret_copy = COption_u16Z_some(o);
12315 uint64_t ret_ref = (uint64_t)ret_copy;
12319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
12320 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12321 *ret_copy = COption_u16Z_none();
12322 uint64_t ret_ref = (uint64_t)ret_copy;
12326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12327 if ((_res & 1) != 0) return;
12328 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12329 CHECK_ACCESS(_res_ptr);
12330 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
12332 COption_u16Z_free(_res_conv);
12335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12336 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
12337 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
12338 *ret_copy = COption_u16Z_clone(orig_conv);
12339 uint64_t ret_ref = (uint64_t)ret_copy;
12343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
12344 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12345 *ret_conv = CResult_NoneAPIErrorZ_ok();
12346 return (uint64_t)ret_conv;
12349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12350 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12351 CHECK_ACCESS(e_ptr);
12352 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
12353 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12354 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12355 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
12356 return (uint64_t)ret_conv;
12359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12360 if ((_res & 1) != 0) return;
12361 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12362 CHECK_ACCESS(_res_ptr);
12363 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
12365 CResult_NoneAPIErrorZ_free(_res_conv);
12368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12369 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
12370 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
12371 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
12372 return (uint64_t)ret_conv;
12375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12376 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
12377 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12378 if (_res_constr.datalen > 0)
12379 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
12381 _res_constr.data = NULL;
12382 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12383 for (size_t w = 0; w < _res_constr.datalen; w++) {
12384 int64_t _res_conv_22 = _res_vals[w];
12385 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
12386 CHECK_ACCESS(_res_conv_22_ptr);
12387 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
12388 FREE((void*)_res_conv_22);
12389 _res_constr.data[w] = _res_conv_22_conv;
12391 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12392 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
12395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12396 LDKCVec_APIErrorZ _res_constr;
12397 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12398 if (_res_constr.datalen > 0)
12399 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
12401 _res_constr.data = NULL;
12402 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12403 for (size_t k = 0; k < _res_constr.datalen; k++) {
12404 int64_t _res_conv_10 = _res_vals[k];
12405 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
12406 CHECK_ACCESS(_res_conv_10_ptr);
12407 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
12408 FREE((void*)_res_conv_10);
12409 _res_constr.data[k] = _res_conv_10_conv;
12411 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12412 CVec_APIErrorZ_free(_res_constr);
12415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12416 LDKThirtyTwoBytes o_ref;
12417 CHECK((*env)->GetArrayLength(env, o) == 32);
12418 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
12419 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12420 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
12421 return (uint64_t)ret_conv;
12424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12425 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12426 CHECK_ACCESS(e_ptr);
12427 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
12428 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12429 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12430 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
12431 return (uint64_t)ret_conv;
12434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12435 if ((_res & 1) != 0) return;
12436 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12437 CHECK_ACCESS(_res_ptr);
12438 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
12440 CResult__u832APIErrorZ_free(_res_conv);
12443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12444 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
12445 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
12446 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
12447 return (uint64_t)ret_conv;
12450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12451 LDKPaymentId o_conv;
12452 o_conv.inner = (void*)(o & (~1));
12453 o_conv.is_owned = (o & 1) || (o == 0);
12454 o_conv = PaymentId_clone(&o_conv);
12455 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12456 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv);
12457 return (uint64_t)ret_conv;
12460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12461 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12462 CHECK_ACCESS(e_ptr);
12463 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
12464 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12465 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12466 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
12467 return (uint64_t)ret_conv;
12470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12471 if ((_res & 1) != 0) return;
12472 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12473 CHECK_ACCESS(_res_ptr);
12474 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
12476 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
12479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12480 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
12481 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12482 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
12483 return (uint64_t)ret_conv;
12486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
12487 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12488 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
12489 return (uint64_t)ret_conv;
12492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12493 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12494 CHECK_ACCESS(e_ptr);
12495 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
12496 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12497 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12498 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
12499 return (uint64_t)ret_conv;
12502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12503 if ((_res & 1) != 0) return;
12504 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12505 CHECK_ACCESS(_res_ptr);
12506 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
12508 CResult_NonePaymentSendFailureZ_free(_res_conv);
12511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12512 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
12513 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12514 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
12515 return (uint64_t)ret_conv;
12518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12519 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
12520 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
12521 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
12522 return ((uint64_t)ret_conv);
12525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12526 LDKThirtyTwoBytes a_ref;
12527 CHECK((*env)->GetArrayLength(env, a) == 32);
12528 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12529 LDKPaymentId b_conv;
12530 b_conv.inner = (void*)(b & (~1));
12531 b_conv.is_owned = (b & 1) || (b == 0);
12532 b_conv = PaymentId_clone(&b_conv);
12533 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
12534 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv);
12535 return ((uint64_t)ret_conv);
12538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12539 if ((_res & 1) != 0) return;
12540 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12541 CHECK_ACCESS(_res_ptr);
12542 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
12544 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
12547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12548 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12549 CHECK_ACCESS(o_ptr);
12550 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
12551 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
12552 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12553 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
12554 return (uint64_t)ret_conv;
12557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12558 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12559 CHECK_ACCESS(e_ptr);
12560 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
12561 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
12562 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12563 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
12564 return (uint64_t)ret_conv;
12567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12568 if ((_res & 1) != 0) return;
12569 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12570 CHECK_ACCESS(_res_ptr);
12571 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
12573 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
12576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12577 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
12578 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
12579 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
12580 return (uint64_t)ret_conv;
12583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12584 LDKCVec_NetAddressZ _res_constr;
12585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12586 if (_res_constr.datalen > 0)
12587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12589 _res_constr.data = NULL;
12590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12591 for (size_t m = 0; m < _res_constr.datalen; m++) {
12592 int64_t _res_conv_12 = _res_vals[m];
12593 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
12594 CHECK_ACCESS(_res_conv_12_ptr);
12595 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
12596 FREE((void*)_res_conv_12);
12597 _res_constr.data[m] = _res_conv_12_conv;
12599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12600 CVec_NetAddressZ_free(_res_constr);
12603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12604 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
12605 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
12606 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
12607 return ((uint64_t)ret_conv);
12610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
12611 LDKThirtyTwoBytes a_ref;
12612 CHECK((*env)->GetArrayLength(env, a) == 32);
12613 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12614 LDKThirtyTwoBytes b_ref;
12615 CHECK((*env)->GetArrayLength(env, b) == 32);
12616 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12617 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
12618 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
12619 return ((uint64_t)ret_conv);
12622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12623 if ((_res & 1) != 0) return;
12624 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12625 CHECK_ACCESS(_res_ptr);
12626 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
12628 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
12631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12632 LDKThirtyTwoBytes o_ref;
12633 CHECK((*env)->GetArrayLength(env, o) == 32);
12634 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
12635 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12636 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
12637 return (uint64_t)ret_conv;
12640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12641 void* e_ptr = (void*)(((uint64_t)e) & ~1);
12642 CHECK_ACCESS(e_ptr);
12643 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
12644 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12645 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12646 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
12647 return (uint64_t)ret_conv;
12650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12651 if ((_res & 1) != 0) return;
12652 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12653 CHECK_ACCESS(_res_ptr);
12654 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
12656 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
12659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12660 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
12661 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12662 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
12663 return (uint64_t)ret_conv;
12666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12667 LDKCVec_ChannelMonitorZ _res_constr;
12668 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12669 if (_res_constr.datalen > 0)
12670 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12672 _res_constr.data = NULL;
12673 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12674 for (size_t q = 0; q < _res_constr.datalen; q++) {
12675 int64_t _res_conv_16 = _res_vals[q];
12676 LDKChannelMonitor _res_conv_16_conv;
12677 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12678 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12679 _res_constr.data[q] = _res_conv_16_conv;
12681 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12682 CVec_ChannelMonitorZ_free(_res_constr);
12685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12686 LDKThirtyTwoBytes a_ref;
12687 CHECK((*env)->GetArrayLength(env, a) == 32);
12688 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12689 LDKChannelManager b_conv;
12690 b_conv.inner = (void*)(b & (~1));
12691 b_conv.is_owned = (b & 1) || (b == 0);
12692 // Warning: we need a move here but no clone is available for LDKChannelManager
12693 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
12694 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
12695 return ((uint64_t)ret_conv);
12698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12699 if ((_res & 1) != 0) return;
12700 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12701 CHECK_ACCESS(_res_ptr);
12702 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
12704 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
12707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12708 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12709 CHECK_ACCESS(o_ptr);
12710 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
12711 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
12712 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12713 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
12714 return (uint64_t)ret_conv;
12717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12718 LDKDecodeError e_conv;
12719 e_conv.inner = (void*)(e & (~1));
12720 e_conv.is_owned = (e & 1) || (e == 0);
12721 e_conv = DecodeError_clone(&e_conv);
12722 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12723 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
12724 return (uint64_t)ret_conv;
12727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12728 if ((_res & 1) != 0) return;
12729 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12730 CHECK_ACCESS(_res_ptr);
12731 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
12733 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
12736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12737 LDKChannelConfig o_conv;
12738 o_conv.inner = (void*)(o & (~1));
12739 o_conv.is_owned = (o & 1) || (o == 0);
12740 o_conv = ChannelConfig_clone(&o_conv);
12741 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12742 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
12743 return (uint64_t)ret_conv;
12746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12747 LDKDecodeError e_conv;
12748 e_conv.inner = (void*)(e & (~1));
12749 e_conv.is_owned = (e & 1) || (e == 0);
12750 e_conv = DecodeError_clone(&e_conv);
12751 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12752 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
12753 return (uint64_t)ret_conv;
12756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12757 if ((_res & 1) != 0) return;
12758 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12759 CHECK_ACCESS(_res_ptr);
12760 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
12762 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
12765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12766 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
12767 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12768 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
12769 return (uint64_t)ret_conv;
12772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12773 LDKOutPoint o_conv;
12774 o_conv.inner = (void*)(o & (~1));
12775 o_conv.is_owned = (o & 1) || (o == 0);
12776 o_conv = OutPoint_clone(&o_conv);
12777 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12778 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
12779 return (uint64_t)ret_conv;
12782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12783 LDKDecodeError e_conv;
12784 e_conv.inner = (void*)(e & (~1));
12785 e_conv.is_owned = (e & 1) || (e == 0);
12786 e_conv = DecodeError_clone(&e_conv);
12787 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12788 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
12789 return (uint64_t)ret_conv;
12792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12793 if ((_res & 1) != 0) return;
12794 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12795 CHECK_ACCESS(_res_ptr);
12796 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
12798 CResult_OutPointDecodeErrorZ_free(_res_conv);
12801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12802 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
12803 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12804 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
12805 return (uint64_t)ret_conv;
12808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
12809 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12810 CHECK_ACCESS(o_ptr);
12811 LDKType o_conv = *(LDKType*)(o_ptr);
12812 if (o_conv.free == LDKType_JCalls_free) {
12813 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12814 LDKType_JCalls_cloned(&o_conv);
12816 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12817 *ret_copy = COption_TypeZ_some(o_conv);
12818 uint64_t ret_ref = (uint64_t)ret_copy;
12822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
12823 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12824 *ret_copy = COption_TypeZ_none();
12825 uint64_t ret_ref = (uint64_t)ret_copy;
12829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12830 if ((_res & 1) != 0) return;
12831 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12832 CHECK_ACCESS(_res_ptr);
12833 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
12835 COption_TypeZ_free(_res_conv);
12838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12839 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12840 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12841 *ret_copy = COption_TypeZ_clone(orig_conv);
12842 uint64_t ret_ref = (uint64_t)ret_copy;
12846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12847 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12848 CHECK_ACCESS(o_ptr);
12849 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
12850 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12851 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12852 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12853 return (uint64_t)ret_conv;
12856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12857 LDKDecodeError e_conv;
12858 e_conv.inner = (void*)(e & (~1));
12859 e_conv.is_owned = (e & 1) || (e == 0);
12860 e_conv = DecodeError_clone(&e_conv);
12861 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12862 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12863 return (uint64_t)ret_conv;
12866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12867 if ((_res & 1) != 0) return;
12868 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12869 CHECK_ACCESS(_res_ptr);
12870 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
12872 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12876 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12877 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12878 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12879 return (uint64_t)ret_conv;
12882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
12883 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
12884 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12885 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12886 return (uint64_t)ret_conv;
12889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
12890 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12891 *ret_conv = CResult_SiPrefixNoneZ_err();
12892 return (uint64_t)ret_conv;
12895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12896 if ((_res & 1) != 0) return;
12897 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12898 CHECK_ACCESS(_res_ptr);
12899 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
12901 CResult_SiPrefixNoneZ_free(_res_conv);
12904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12905 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12906 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12907 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12908 return (uint64_t)ret_conv;
12911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12913 o_conv.inner = (void*)(o & (~1));
12914 o_conv.is_owned = (o & 1) || (o == 0);
12915 o_conv = Invoice_clone(&o_conv);
12916 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12917 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12918 return (uint64_t)ret_conv;
12921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12922 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12923 *ret_conv = CResult_InvoiceNoneZ_err();
12924 return (uint64_t)ret_conv;
12927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12928 if ((_res & 1) != 0) return;
12929 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12930 CHECK_ACCESS(_res_ptr);
12931 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
12933 CResult_InvoiceNoneZ_free(_res_conv);
12936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12937 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12938 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12939 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12940 return (uint64_t)ret_conv;
12943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12944 LDKSignedRawInvoice o_conv;
12945 o_conv.inner = (void*)(o & (~1));
12946 o_conv.is_owned = (o & 1) || (o == 0);
12947 o_conv = SignedRawInvoice_clone(&o_conv);
12948 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12949 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12950 return (uint64_t)ret_conv;
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12954 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12955 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12956 return (uint64_t)ret_conv;
12959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12960 if ((_res & 1) != 0) return;
12961 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12962 CHECK_ACCESS(_res_ptr);
12963 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
12965 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12969 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12970 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12971 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12972 return (uint64_t)ret_conv;
12975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12976 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12977 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12978 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12979 return ((uint64_t)ret_conv);
12982 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) {
12983 LDKRawInvoice a_conv;
12984 a_conv.inner = (void*)(a & (~1));
12985 a_conv.is_owned = (a & 1) || (a == 0);
12986 a_conv = RawInvoice_clone(&a_conv);
12987 LDKThirtyTwoBytes b_ref;
12988 CHECK((*env)->GetArrayLength(env, b) == 32);
12989 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12990 LDKInvoiceSignature c_conv;
12991 c_conv.inner = (void*)(c & (~1));
12992 c_conv.is_owned = (c & 1) || (c == 0);
12993 c_conv = InvoiceSignature_clone(&c_conv);
12994 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12995 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12996 return ((uint64_t)ret_conv);
12999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13000 if ((_res & 1) != 0) return;
13001 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13002 CHECK_ACCESS(_res_ptr);
13003 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
13005 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
13008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13009 LDKPayeePubKey o_conv;
13010 o_conv.inner = (void*)(o & (~1));
13011 o_conv.is_owned = (o & 1) || (o == 0);
13012 o_conv = PayeePubKey_clone(&o_conv);
13013 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
13014 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
13015 return (uint64_t)ret_conv;
13018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13019 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13020 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
13021 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
13022 return (uint64_t)ret_conv;
13025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13026 if ((_res & 1) != 0) return;
13027 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13028 CHECK_ACCESS(_res_ptr);
13029 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
13031 CResult_PayeePubKeyErrorZ_free(_res_conv);
13034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13035 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
13036 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
13037 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
13038 return (uint64_t)ret_conv;
13041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13042 LDKCVec_PrivateRouteZ _res_constr;
13043 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13044 if (_res_constr.datalen > 0)
13045 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
13047 _res_constr.data = NULL;
13048 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13049 for (size_t o = 0; o < _res_constr.datalen; o++) {
13050 int64_t _res_conv_14 = _res_vals[o];
13051 LDKPrivateRoute _res_conv_14_conv;
13052 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
13053 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
13054 _res_constr.data[o] = _res_conv_14_conv;
13056 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13057 CVec_PrivateRouteZ_free(_res_constr);
13060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13061 LDKPositiveTimestamp o_conv;
13062 o_conv.inner = (void*)(o & (~1));
13063 o_conv.is_owned = (o & 1) || (o == 0);
13064 o_conv = PositiveTimestamp_clone(&o_conv);
13065 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
13066 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
13067 return (uint64_t)ret_conv;
13070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13071 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
13072 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
13073 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
13074 return (uint64_t)ret_conv;
13077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13078 if ((_res & 1) != 0) return;
13079 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13080 CHECK_ACCESS(_res_ptr);
13081 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
13083 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
13086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13087 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
13088 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
13089 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
13090 return (uint64_t)ret_conv;
13093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
13094 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
13095 *ret_conv = CResult_NoneSemanticErrorZ_ok();
13096 return (uint64_t)ret_conv;
13099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13100 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
13101 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
13102 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
13103 return (uint64_t)ret_conv;
13106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13107 if ((_res & 1) != 0) return;
13108 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13109 CHECK_ACCESS(_res_ptr);
13110 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
13112 CResult_NoneSemanticErrorZ_free(_res_conv);
13115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13116 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
13117 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
13118 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
13119 return (uint64_t)ret_conv;
13122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13124 o_conv.inner = (void*)(o & (~1));
13125 o_conv.is_owned = (o & 1) || (o == 0);
13126 o_conv = Invoice_clone(&o_conv);
13127 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
13128 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
13129 return (uint64_t)ret_conv;
13132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13133 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
13134 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
13135 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
13136 return (uint64_t)ret_conv;
13139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13140 if ((_res & 1) != 0) return;
13141 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13142 CHECK_ACCESS(_res_ptr);
13143 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
13145 CResult_InvoiceSemanticErrorZ_free(_res_conv);
13148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13149 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
13150 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
13151 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
13152 return (uint64_t)ret_conv;
13155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13156 LDKDescription o_conv;
13157 o_conv.inner = (void*)(o & (~1));
13158 o_conv.is_owned = (o & 1) || (o == 0);
13159 o_conv = Description_clone(&o_conv);
13160 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
13161 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
13162 return (uint64_t)ret_conv;
13165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13166 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
13167 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
13168 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
13169 return (uint64_t)ret_conv;
13172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13173 if ((_res & 1) != 0) return;
13174 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13175 CHECK_ACCESS(_res_ptr);
13176 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
13178 CResult_DescriptionCreationErrorZ_free(_res_conv);
13181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13182 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
13183 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
13184 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
13185 return (uint64_t)ret_conv;
13188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13189 LDKExpiryTime o_conv;
13190 o_conv.inner = (void*)(o & (~1));
13191 o_conv.is_owned = (o & 1) || (o == 0);
13192 o_conv = ExpiryTime_clone(&o_conv);
13193 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
13194 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
13195 return (uint64_t)ret_conv;
13198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13199 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
13200 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
13201 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
13202 return (uint64_t)ret_conv;
13205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13206 if ((_res & 1) != 0) return;
13207 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13208 CHECK_ACCESS(_res_ptr);
13209 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
13211 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
13214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13215 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
13216 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
13217 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
13218 return (uint64_t)ret_conv;
13221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13222 LDKPrivateRoute o_conv;
13223 o_conv.inner = (void*)(o & (~1));
13224 o_conv.is_owned = (o & 1) || (o == 0);
13225 o_conv = PrivateRoute_clone(&o_conv);
13226 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
13227 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
13228 return (uint64_t)ret_conv;
13231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13232 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
13233 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
13234 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
13235 return (uint64_t)ret_conv;
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13239 if ((_res & 1) != 0) return;
13240 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13241 CHECK_ACCESS(_res_ptr);
13242 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
13244 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
13247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13248 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
13249 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
13250 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
13251 return (uint64_t)ret_conv;
13254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
13255 LDKStr o_conv = java_to_owned_str(env, o);
13256 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13257 *ret_conv = CResult_StringErrorZ_ok(o_conv);
13258 return (uint64_t)ret_conv;
13261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13262 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13263 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13264 *ret_conv = CResult_StringErrorZ_err(e_conv);
13265 return (uint64_t)ret_conv;
13268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13269 if ((_res & 1) != 0) return;
13270 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13271 CHECK_ACCESS(_res_ptr);
13272 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
13274 CResult_StringErrorZ_free(_res_conv);
13277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13278 LDKChannelMonitorUpdate o_conv;
13279 o_conv.inner = (void*)(o & (~1));
13280 o_conv.is_owned = (o & 1) || (o == 0);
13281 o_conv = ChannelMonitorUpdate_clone(&o_conv);
13282 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13283 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
13284 return (uint64_t)ret_conv;
13287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13288 LDKDecodeError e_conv;
13289 e_conv.inner = (void*)(e & (~1));
13290 e_conv.is_owned = (e & 1) || (e == 0);
13291 e_conv = DecodeError_clone(&e_conv);
13292 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13293 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
13294 return (uint64_t)ret_conv;
13297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13298 if ((_res & 1) != 0) return;
13299 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13300 CHECK_ACCESS(_res_ptr);
13301 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
13303 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
13306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13307 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
13308 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13309 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
13310 return (uint64_t)ret_conv;
13313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13314 LDKHTLCUpdate o_conv;
13315 o_conv.inner = (void*)(o & (~1));
13316 o_conv.is_owned = (o & 1) || (o == 0);
13317 o_conv = HTLCUpdate_clone(&o_conv);
13318 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13319 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
13320 return (uint64_t)ret_conv;
13323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13324 LDKDecodeError e_conv;
13325 e_conv.inner = (void*)(e & (~1));
13326 e_conv.is_owned = (e & 1) || (e == 0);
13327 e_conv = DecodeError_clone(&e_conv);
13328 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13329 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
13330 return (uint64_t)ret_conv;
13333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13334 if ((_res & 1) != 0) return;
13335 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13336 CHECK_ACCESS(_res_ptr);
13337 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
13339 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
13342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13343 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
13344 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13345 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
13346 return (uint64_t)ret_conv;
13349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
13350 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13351 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
13352 return (uint64_t)ret_conv;
13355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13356 LDKMonitorUpdateError e_conv;
13357 e_conv.inner = (void*)(e & (~1));
13358 e_conv.is_owned = (e & 1) || (e == 0);
13359 e_conv = MonitorUpdateError_clone(&e_conv);
13360 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13361 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
13362 return (uint64_t)ret_conv;
13365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13366 if ((_res & 1) != 0) return;
13367 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13368 CHECK_ACCESS(_res_ptr);
13369 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
13371 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
13374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13375 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
13376 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13377 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
13378 return (uint64_t)ret_conv;
13381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13382 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
13383 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13384 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
13385 return ((uint64_t)ret_conv);
13388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
13389 LDKOutPoint a_conv;
13390 a_conv.inner = (void*)(a & (~1));
13391 a_conv.is_owned = (a & 1) || (a == 0);
13392 a_conv = OutPoint_clone(&a_conv);
13394 b_ref.datalen = (*env)->GetArrayLength(env, b);
13395 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13396 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
13397 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13398 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
13399 return ((uint64_t)ret_conv);
13402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13403 if ((_res & 1) != 0) return;
13404 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13405 CHECK_ACCESS(_res_ptr);
13406 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
13408 C2Tuple_OutPointScriptZ_free(_res_conv);
13411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13412 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
13413 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13414 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
13415 return ((uint64_t)ret_conv);
13418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
13420 b_ref.datalen = (*env)->GetArrayLength(env, b);
13421 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
13422 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
13423 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
13424 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
13425 return ((uint64_t)ret_conv);
13428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13429 if ((_res & 1) != 0) return;
13430 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13431 CHECK_ACCESS(_res_ptr);
13432 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
13434 C2Tuple_u32ScriptZ_free(_res_conv);
13437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13438 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
13439 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13440 if (_res_constr.datalen > 0)
13441 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13443 _res_constr.data = NULL;
13444 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13445 for (size_t v = 0; v < _res_constr.datalen; v++) {
13446 int64_t _res_conv_21 = _res_vals[v];
13447 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
13448 CHECK_ACCESS(_res_conv_21_ptr);
13449 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
13450 FREE((void*)_res_conv_21);
13451 _res_constr.data[v] = _res_conv_21_conv;
13453 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13454 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
13457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13458 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
13459 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13460 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
13461 return ((uint64_t)ret_conv);
13464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
13465 LDKThirtyTwoBytes a_ref;
13466 CHECK((*env)->GetArrayLength(env, a) == 32);
13467 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13468 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
13469 b_constr.datalen = (*env)->GetArrayLength(env, b);
13470 if (b_constr.datalen > 0)
13471 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
13473 b_constr.data = NULL;
13474 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
13475 for (size_t v = 0; v < b_constr.datalen; v++) {
13476 int64_t b_conv_21 = b_vals[v];
13477 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
13478 CHECK_ACCESS(b_conv_21_ptr);
13479 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
13480 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
13481 b_constr.data[v] = b_conv_21_conv;
13483 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
13484 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13485 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
13486 return ((uint64_t)ret_conv);
13489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13490 if ((_res & 1) != 0) return;
13491 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13492 CHECK_ACCESS(_res_ptr);
13493 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
13495 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
13498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13499 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
13500 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13501 if (_res_constr.datalen > 0)
13502 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
13504 _res_constr.data = NULL;
13505 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13506 for (size_t o = 0; o < _res_constr.datalen; o++) {
13507 int64_t _res_conv_40 = _res_vals[o];
13508 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
13509 CHECK_ACCESS(_res_conv_40_ptr);
13510 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
13511 FREE((void*)_res_conv_40);
13512 _res_constr.data[o] = _res_conv_40_conv;
13514 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13515 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
13518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13519 LDKCVec_EventZ _res_constr;
13520 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13521 if (_res_constr.datalen > 0)
13522 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
13524 _res_constr.data = NULL;
13525 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13526 for (size_t h = 0; h < _res_constr.datalen; h++) {
13527 int64_t _res_conv_7 = _res_vals[h];
13528 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
13529 CHECK_ACCESS(_res_conv_7_ptr);
13530 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
13531 FREE((void*)_res_conv_7);
13532 _res_constr.data[h] = _res_conv_7_conv;
13534 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13535 CVec_EventZ_free(_res_constr);
13538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13539 LDKCVec_TransactionZ _res_constr;
13540 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13541 if (_res_constr.datalen > 0)
13542 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
13544 _res_constr.data = NULL;
13545 for (size_t i = 0; i < _res_constr.datalen; i++) {
13546 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13547 LDKTransaction _res_conv_8_ref;
13548 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
13549 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
13550 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
13551 _res_conv_8_ref.data_is_owned = true;
13552 _res_constr.data[i] = _res_conv_8_ref;
13554 CVec_TransactionZ_free(_res_constr);
13557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13558 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
13559 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13560 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
13561 return ((uint64_t)ret_conv);
13564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
13565 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13566 CHECK_ACCESS(b_ptr);
13567 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
13568 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
13569 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
13570 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
13571 return ((uint64_t)ret_conv);
13574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13575 if ((_res & 1) != 0) return;
13576 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13577 CHECK_ACCESS(_res_ptr);
13578 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
13580 C2Tuple_u32TxOutZ_free(_res_conv);
13583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13584 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
13585 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13586 if (_res_constr.datalen > 0)
13587 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13589 _res_constr.data = NULL;
13590 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13591 for (size_t u = 0; u < _res_constr.datalen; u++) {
13592 int64_t _res_conv_20 = _res_vals[u];
13593 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
13594 CHECK_ACCESS(_res_conv_20_ptr);
13595 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
13596 FREE((void*)_res_conv_20);
13597 _res_constr.data[u] = _res_conv_20_conv;
13599 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13600 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
13603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13604 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
13605 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13606 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
13607 return ((uint64_t)ret_conv);
13610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
13611 LDKThirtyTwoBytes a_ref;
13612 CHECK((*env)->GetArrayLength(env, a) == 32);
13613 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13614 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
13615 b_constr.datalen = (*env)->GetArrayLength(env, b);
13616 if (b_constr.datalen > 0)
13617 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
13619 b_constr.data = NULL;
13620 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
13621 for (size_t u = 0; u < b_constr.datalen; u++) {
13622 int64_t b_conv_20 = b_vals[u];
13623 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
13624 CHECK_ACCESS(b_conv_20_ptr);
13625 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
13626 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
13627 b_constr.data[u] = b_conv_20_conv;
13629 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
13630 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
13631 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
13632 return ((uint64_t)ret_conv);
13635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13636 if ((_res & 1) != 0) return;
13637 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13638 CHECK_ACCESS(_res_ptr);
13639 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
13641 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
13644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13645 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
13646 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13647 if (_res_constr.datalen > 0)
13648 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
13650 _res_constr.data = NULL;
13651 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13652 for (size_t n = 0; n < _res_constr.datalen; n++) {
13653 int64_t _res_conv_39 = _res_vals[n];
13654 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
13655 CHECK_ACCESS(_res_conv_39_ptr);
13656 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
13657 FREE((void*)_res_conv_39);
13658 _res_constr.data[n] = _res_conv_39_conv;
13660 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13661 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
13664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13665 LDKCVec_BalanceZ _res_constr;
13666 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13667 if (_res_constr.datalen > 0)
13668 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
13670 _res_constr.data = NULL;
13671 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13672 for (size_t j = 0; j < _res_constr.datalen; j++) {
13673 int64_t _res_conv_9 = _res_vals[j];
13674 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
13675 CHECK_ACCESS(_res_conv_9_ptr);
13676 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
13677 FREE((void*)_res_conv_9);
13678 _res_constr.data[j] = _res_conv_9_conv;
13680 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13681 CVec_BalanceZ_free(_res_constr);
13684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13685 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13686 CHECK_ACCESS(o_ptr);
13687 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
13688 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
13689 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13690 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
13691 return (uint64_t)ret_conv;
13694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13695 LDKDecodeError e_conv;
13696 e_conv.inner = (void*)(e & (~1));
13697 e_conv.is_owned = (e & 1) || (e == 0);
13698 e_conv = DecodeError_clone(&e_conv);
13699 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13700 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
13701 return (uint64_t)ret_conv;
13704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13705 if ((_res & 1) != 0) return;
13706 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13707 CHECK_ACCESS(_res_ptr);
13708 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
13710 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
13713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13714 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
13715 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13716 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
13717 return (uint64_t)ret_conv;
13720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
13721 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13722 *ret_conv = CResult_NoneLightningErrorZ_ok();
13723 return (uint64_t)ret_conv;
13726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13727 LDKLightningError e_conv;
13728 e_conv.inner = (void*)(e & (~1));
13729 e_conv.is_owned = (e & 1) || (e == 0);
13730 e_conv = LightningError_clone(&e_conv);
13731 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13732 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13733 return (uint64_t)ret_conv;
13736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13737 if ((_res & 1) != 0) return;
13738 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13739 CHECK_ACCESS(_res_ptr);
13740 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
13742 CResult_NoneLightningErrorZ_free(_res_conv);
13745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13746 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13747 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13748 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13749 return (uint64_t)ret_conv;
13752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13753 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13754 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13755 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13756 return ((uint64_t)ret_conv);
13759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
13760 LDKPublicKey a_ref;
13761 CHECK((*env)->GetArrayLength(env, a) == 33);
13762 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
13763 void* b_ptr = (void*)(((uint64_t)b) & ~1);
13764 CHECK_ACCESS(b_ptr);
13765 LDKType b_conv = *(LDKType*)(b_ptr);
13766 if (b_conv.free == LDKType_JCalls_free) {
13767 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13768 LDKType_JCalls_cloned(&b_conv);
13770 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13771 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13772 return ((uint64_t)ret_conv);
13775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13776 if ((_res & 1) != 0) return;
13777 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13778 CHECK_ACCESS(_res_ptr);
13779 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
13781 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13785 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13786 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13787 if (_res_constr.datalen > 0)
13788 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13790 _res_constr.data = NULL;
13791 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13792 for (size_t z = 0; z < _res_constr.datalen; z++) {
13793 int64_t _res_conv_25 = _res_vals[z];
13794 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
13795 CHECK_ACCESS(_res_conv_25_ptr);
13796 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
13797 FREE((void*)_res_conv_25);
13798 _res_constr.data[z] = _res_conv_25_conv;
13800 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13801 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13805 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13806 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13807 return (uint64_t)ret_conv;
13810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13811 LDKLightningError e_conv;
13812 e_conv.inner = (void*)(e & (~1));
13813 e_conv.is_owned = (e & 1) || (e == 0);
13814 e_conv = LightningError_clone(&e_conv);
13815 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13816 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13817 return (uint64_t)ret_conv;
13820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13821 if ((_res & 1) != 0) return;
13822 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13823 CHECK_ACCESS(_res_ptr);
13824 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
13826 CResult_boolLightningErrorZ_free(_res_conv);
13829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13830 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13831 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13832 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13833 return (uint64_t)ret_conv;
13836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13837 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13838 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13839 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13840 return ((uint64_t)ret_conv);
13843 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) {
13844 LDKChannelAnnouncement a_conv;
13845 a_conv.inner = (void*)(a & (~1));
13846 a_conv.is_owned = (a & 1) || (a == 0);
13847 a_conv = ChannelAnnouncement_clone(&a_conv);
13848 LDKChannelUpdate b_conv;
13849 b_conv.inner = (void*)(b & (~1));
13850 b_conv.is_owned = (b & 1) || (b == 0);
13851 b_conv = ChannelUpdate_clone(&b_conv);
13852 LDKChannelUpdate c_conv;
13853 c_conv.inner = (void*)(c & (~1));
13854 c_conv.is_owned = (c & 1) || (c == 0);
13855 c_conv = ChannelUpdate_clone(&c_conv);
13856 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13857 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13858 return ((uint64_t)ret_conv);
13861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13862 if ((_res & 1) != 0) return;
13863 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13864 CHECK_ACCESS(_res_ptr);
13865 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
13867 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13871 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13872 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13873 if (_res_constr.datalen > 0)
13874 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13876 _res_constr.data = NULL;
13877 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13878 for (size_t h = 0; h < _res_constr.datalen; h++) {
13879 int64_t _res_conv_59 = _res_vals[h];
13880 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
13881 CHECK_ACCESS(_res_conv_59_ptr);
13882 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
13883 FREE((void*)_res_conv_59);
13884 _res_constr.data[h] = _res_conv_59_conv;
13886 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13887 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13891 LDKCVec_NodeAnnouncementZ _res_constr;
13892 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13893 if (_res_constr.datalen > 0)
13894 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13896 _res_constr.data = NULL;
13897 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13898 for (size_t s = 0; s < _res_constr.datalen; s++) {
13899 int64_t _res_conv_18 = _res_vals[s];
13900 LDKNodeAnnouncement _res_conv_18_conv;
13901 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13902 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13903 _res_constr.data[s] = _res_conv_18_conv;
13905 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13906 CVec_NodeAnnouncementZ_free(_res_constr);
13909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13910 LDKCVec_PublicKeyZ _res_constr;
13911 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13912 if (_res_constr.datalen > 0)
13913 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13915 _res_constr.data = NULL;
13916 for (size_t i = 0; i < _res_constr.datalen; i++) {
13917 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13918 LDKPublicKey _res_conv_8_ref;
13919 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
13920 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
13921 _res_constr.data[i] = _res_conv_8_ref;
13923 CVec_PublicKeyZ_free(_res_constr);
13926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13928 o_ref.datalen = (*env)->GetArrayLength(env, o);
13929 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13930 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13931 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13932 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13933 return (uint64_t)ret_conv;
13936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13937 LDKPeerHandleError e_conv;
13938 e_conv.inner = (void*)(e & (~1));
13939 e_conv.is_owned = (e & 1) || (e == 0);
13940 e_conv = PeerHandleError_clone(&e_conv);
13941 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13942 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13943 return (uint64_t)ret_conv;
13946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13947 if ((_res & 1) != 0) return;
13948 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13949 CHECK_ACCESS(_res_ptr);
13950 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
13952 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13956 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13957 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13958 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13959 return (uint64_t)ret_conv;
13962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
13963 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13964 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13965 return (uint64_t)ret_conv;
13968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13969 LDKPeerHandleError e_conv;
13970 e_conv.inner = (void*)(e & (~1));
13971 e_conv.is_owned = (e & 1) || (e == 0);
13972 e_conv = PeerHandleError_clone(&e_conv);
13973 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13974 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13975 return (uint64_t)ret_conv;
13978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13979 if ((_res & 1) != 0) return;
13980 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13981 CHECK_ACCESS(_res_ptr);
13982 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
13984 CResult_NonePeerHandleErrorZ_free(_res_conv);
13987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13988 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13989 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13990 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13991 return (uint64_t)ret_conv;
13994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13995 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13996 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13997 return (uint64_t)ret_conv;
14000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14001 LDKPeerHandleError e_conv;
14002 e_conv.inner = (void*)(e & (~1));
14003 e_conv.is_owned = (e & 1) || (e == 0);
14004 e_conv = PeerHandleError_clone(&e_conv);
14005 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14006 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
14007 return (uint64_t)ret_conv;
14010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14011 if ((_res & 1) != 0) return;
14012 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14013 CHECK_ACCESS(_res_ptr);
14014 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
14016 CResult_boolPeerHandleErrorZ_free(_res_conv);
14019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14020 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
14021 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14022 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
14023 return (uint64_t)ret_conv;
14026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14028 o_conv.inner = (void*)(o & (~1));
14029 o_conv.is_owned = (o & 1) || (o == 0);
14030 o_conv = NodeId_clone(&o_conv);
14031 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14032 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14033 return (uint64_t)ret_conv;
14036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14037 LDKDecodeError e_conv;
14038 e_conv.inner = (void*)(e & (~1));
14039 e_conv.is_owned = (e & 1) || (e == 0);
14040 e_conv = DecodeError_clone(&e_conv);
14041 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14042 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14043 return (uint64_t)ret_conv;
14046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14047 if ((_res & 1) != 0) return;
14048 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14049 CHECK_ACCESS(_res_ptr);
14050 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14052 CResult_NodeIdDecodeErrorZ_free(_res_conv);
14055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14056 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
14057 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14058 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14059 return (uint64_t)ret_conv;
14062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14063 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14064 CHECK_ACCESS(o_ptr);
14065 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14066 if (o_conv.free == LDKAccess_JCalls_free) {
14067 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14068 LDKAccess_JCalls_cloned(&o_conv);
14070 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14071 *ret_copy = COption_AccessZ_some(o_conv);
14072 uint64_t ret_ref = (uint64_t)ret_copy;
14076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
14077 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14078 *ret_copy = COption_AccessZ_none();
14079 uint64_t ret_ref = (uint64_t)ret_copy;
14083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14084 if ((_res & 1) != 0) return;
14085 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14086 CHECK_ACCESS(_res_ptr);
14087 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14089 COption_AccessZ_free(_res_conv);
14092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14093 LDKDirectionalChannelInfo o_conv;
14094 o_conv.inner = (void*)(o & (~1));
14095 o_conv.is_owned = (o & 1) || (o == 0);
14096 o_conv = DirectionalChannelInfo_clone(&o_conv);
14097 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14098 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
14099 return (uint64_t)ret_conv;
14102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14103 LDKDecodeError e_conv;
14104 e_conv.inner = (void*)(e & (~1));
14105 e_conv.is_owned = (e & 1) || (e == 0);
14106 e_conv = DecodeError_clone(&e_conv);
14107 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14108 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
14109 return (uint64_t)ret_conv;
14112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14113 if ((_res & 1) != 0) return;
14114 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14115 CHECK_ACCESS(_res_ptr);
14116 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
14118 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
14121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14122 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
14123 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
14124 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
14125 return (uint64_t)ret_conv;
14128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14129 LDKChannelInfo o_conv;
14130 o_conv.inner = (void*)(o & (~1));
14131 o_conv.is_owned = (o & 1) || (o == 0);
14132 o_conv = ChannelInfo_clone(&o_conv);
14133 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14134 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14135 return (uint64_t)ret_conv;
14138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14139 LDKDecodeError e_conv;
14140 e_conv.inner = (void*)(e & (~1));
14141 e_conv.is_owned = (e & 1) || (e == 0);
14142 e_conv = DecodeError_clone(&e_conv);
14143 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14144 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14145 return (uint64_t)ret_conv;
14148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14149 if ((_res & 1) != 0) return;
14150 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14151 CHECK_ACCESS(_res_ptr);
14152 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14154 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14158 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
14159 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14160 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14161 return (uint64_t)ret_conv;
14164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14165 LDKRoutingFees o_conv;
14166 o_conv.inner = (void*)(o & (~1));
14167 o_conv.is_owned = (o & 1) || (o == 0);
14168 o_conv = RoutingFees_clone(&o_conv);
14169 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14170 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14171 return (uint64_t)ret_conv;
14174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14175 LDKDecodeError e_conv;
14176 e_conv.inner = (void*)(e & (~1));
14177 e_conv.is_owned = (e & 1) || (e == 0);
14178 e_conv = DecodeError_clone(&e_conv);
14179 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14180 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14181 return (uint64_t)ret_conv;
14184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14185 if ((_res & 1) != 0) return;
14186 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14187 CHECK_ACCESS(_res_ptr);
14188 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14190 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14194 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
14195 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14196 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14197 return (uint64_t)ret_conv;
14200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14201 LDKNodeAnnouncementInfo o_conv;
14202 o_conv.inner = (void*)(o & (~1));
14203 o_conv.is_owned = (o & 1) || (o == 0);
14204 o_conv = NodeAnnouncementInfo_clone(&o_conv);
14205 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14206 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14207 return (uint64_t)ret_conv;
14210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14211 LDKDecodeError e_conv;
14212 e_conv.inner = (void*)(e & (~1));
14213 e_conv.is_owned = (e & 1) || (e == 0);
14214 e_conv = DecodeError_clone(&e_conv);
14215 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14216 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14217 return (uint64_t)ret_conv;
14220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14221 if ((_res & 1) != 0) return;
14222 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14223 CHECK_ACCESS(_res_ptr);
14224 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14226 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14230 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
14231 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14232 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14233 return (uint64_t)ret_conv;
14236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14237 LDKCVec_u64Z _res_constr;
14238 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14239 if (_res_constr.datalen > 0)
14240 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14242 _res_constr.data = NULL;
14243 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14244 for (size_t g = 0; g < _res_constr.datalen; g++) {
14245 int64_t _res_conv_6 = _res_vals[g];
14246 _res_constr.data[g] = _res_conv_6;
14248 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14249 CVec_u64Z_free(_res_constr);
14252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14253 LDKNodeInfo o_conv;
14254 o_conv.inner = (void*)(o & (~1));
14255 o_conv.is_owned = (o & 1) || (o == 0);
14256 o_conv = NodeInfo_clone(&o_conv);
14257 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14258 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14259 return (uint64_t)ret_conv;
14262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14263 LDKDecodeError e_conv;
14264 e_conv.inner = (void*)(e & (~1));
14265 e_conv.is_owned = (e & 1) || (e == 0);
14266 e_conv = DecodeError_clone(&e_conv);
14267 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14268 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14269 return (uint64_t)ret_conv;
14272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14273 if ((_res & 1) != 0) return;
14274 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14275 CHECK_ACCESS(_res_ptr);
14276 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14278 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14282 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
14283 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14284 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14285 return (uint64_t)ret_conv;
14288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14289 LDKNetworkGraph o_conv;
14290 o_conv.inner = (void*)(o & (~1));
14291 o_conv.is_owned = (o & 1) || (o == 0);
14292 o_conv = NetworkGraph_clone(&o_conv);
14293 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14294 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14295 return (uint64_t)ret_conv;
14298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14299 LDKDecodeError e_conv;
14300 e_conv.inner = (void*)(e & (~1));
14301 e_conv.is_owned = (e & 1) || (e == 0);
14302 e_conv = DecodeError_clone(&e_conv);
14303 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14304 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14305 return (uint64_t)ret_conv;
14308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14309 if ((_res & 1) != 0) return;
14310 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14311 CHECK_ACCESS(_res_ptr);
14312 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14314 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14318 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
14319 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14320 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
14321 return (uint64_t)ret_conv;
14324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
14325 LDKCVec_NetAddressZ o_constr;
14326 o_constr.datalen = (*env)->GetArrayLength(env, o);
14327 if (o_constr.datalen > 0)
14328 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14330 o_constr.data = NULL;
14331 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
14332 for (size_t m = 0; m < o_constr.datalen; m++) {
14333 int64_t o_conv_12 = o_vals[m];
14334 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
14335 CHECK_ACCESS(o_conv_12_ptr);
14336 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14337 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
14338 o_constr.data[m] = o_conv_12_conv;
14340 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
14341 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14342 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14343 uint64_t ret_ref = (uint64_t)ret_copy;
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
14348 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14349 *ret_copy = COption_CVec_NetAddressZZ_none();
14350 uint64_t ret_ref = (uint64_t)ret_copy;
14354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14355 if ((_res & 1) != 0) return;
14356 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14357 CHECK_ACCESS(_res_ptr);
14358 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14360 COption_CVec_NetAddressZZ_free(_res_conv);
14363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14364 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
14365 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14366 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14367 uint64_t ret_ref = (uint64_t)ret_copy;
14371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
14372 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14373 CHECK_ACCESS(o_ptr);
14374 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
14375 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
14376 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14377 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
14378 return (uint64_t)ret_conv;
14381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
14382 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14383 *ret_conv = CResult_NetAddressu8Z_err(e);
14384 return (uint64_t)ret_conv;
14387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14388 if ((_res & 1) != 0) return;
14389 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14390 CHECK_ACCESS(_res_ptr);
14391 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(_res_ptr);
14393 CResult_NetAddressu8Z_free(_res_conv);
14396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14397 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
14398 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
14399 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
14400 return (uint64_t)ret_conv;
14403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14404 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14405 CHECK_ACCESS(o_ptr);
14406 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(o_ptr);
14407 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
14408 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14409 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
14410 return (uint64_t)ret_conv;
14413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14414 LDKDecodeError e_conv;
14415 e_conv.inner = (void*)(e & (~1));
14416 e_conv.is_owned = (e & 1) || (e == 0);
14417 e_conv = DecodeError_clone(&e_conv);
14418 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14419 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
14420 return (uint64_t)ret_conv;
14423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14424 if ((_res & 1) != 0) return;
14425 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14426 CHECK_ACCESS(_res_ptr);
14427 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(_res_ptr);
14429 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
14432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14433 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
14434 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
14435 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
14436 return (uint64_t)ret_conv;
14439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14440 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14441 CHECK_ACCESS(o_ptr);
14442 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
14443 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
14444 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14445 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
14446 return (uint64_t)ret_conv;
14449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14450 LDKDecodeError e_conv;
14451 e_conv.inner = (void*)(e & (~1));
14452 e_conv.is_owned = (e & 1) || (e == 0);
14453 e_conv = DecodeError_clone(&e_conv);
14454 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14455 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
14456 return (uint64_t)ret_conv;
14459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14460 if ((_res & 1) != 0) return;
14461 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14462 CHECK_ACCESS(_res_ptr);
14463 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
14465 CResult_NetAddressDecodeErrorZ_free(_res_conv);
14468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14469 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
14470 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
14471 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
14472 return (uint64_t)ret_conv;
14475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14476 LDKCVec_UpdateAddHTLCZ _res_constr;
14477 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14478 if (_res_constr.datalen > 0)
14479 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
14481 _res_constr.data = NULL;
14482 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14483 for (size_t p = 0; p < _res_constr.datalen; p++) {
14484 int64_t _res_conv_15 = _res_vals[p];
14485 LDKUpdateAddHTLC _res_conv_15_conv;
14486 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
14487 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
14488 _res_constr.data[p] = _res_conv_15_conv;
14490 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14491 CVec_UpdateAddHTLCZ_free(_res_constr);
14494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14495 LDKCVec_UpdateFulfillHTLCZ _res_constr;
14496 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14497 if (_res_constr.datalen > 0)
14498 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
14500 _res_constr.data = NULL;
14501 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14502 for (size_t t = 0; t < _res_constr.datalen; t++) {
14503 int64_t _res_conv_19 = _res_vals[t];
14504 LDKUpdateFulfillHTLC _res_conv_19_conv;
14505 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
14506 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
14507 _res_constr.data[t] = _res_conv_19_conv;
14509 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14510 CVec_UpdateFulfillHTLCZ_free(_res_constr);
14513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14514 LDKCVec_UpdateFailHTLCZ _res_constr;
14515 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14516 if (_res_constr.datalen > 0)
14517 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
14519 _res_constr.data = NULL;
14520 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14521 for (size_t q = 0; q < _res_constr.datalen; q++) {
14522 int64_t _res_conv_16 = _res_vals[q];
14523 LDKUpdateFailHTLC _res_conv_16_conv;
14524 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14525 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14526 _res_constr.data[q] = _res_conv_16_conv;
14528 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14529 CVec_UpdateFailHTLCZ_free(_res_constr);
14532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14533 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
14534 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14535 if (_res_constr.datalen > 0)
14536 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
14538 _res_constr.data = NULL;
14539 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14540 for (size_t z = 0; z < _res_constr.datalen; z++) {
14541 int64_t _res_conv_25 = _res_vals[z];
14542 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
14543 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
14544 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
14545 _res_constr.data[z] = _res_conv_25_conv;
14547 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14548 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
14551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14552 LDKAcceptChannel o_conv;
14553 o_conv.inner = (void*)(o & (~1));
14554 o_conv.is_owned = (o & 1) || (o == 0);
14555 o_conv = AcceptChannel_clone(&o_conv);
14556 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14557 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
14558 return (uint64_t)ret_conv;
14561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14562 LDKDecodeError e_conv;
14563 e_conv.inner = (void*)(e & (~1));
14564 e_conv.is_owned = (e & 1) || (e == 0);
14565 e_conv = DecodeError_clone(&e_conv);
14566 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14567 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
14568 return (uint64_t)ret_conv;
14571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14572 if ((_res & 1) != 0) return;
14573 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14574 CHECK_ACCESS(_res_ptr);
14575 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
14577 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
14580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14581 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
14582 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
14583 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
14584 return (uint64_t)ret_conv;
14587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14588 LDKAnnouncementSignatures o_conv;
14589 o_conv.inner = (void*)(o & (~1));
14590 o_conv.is_owned = (o & 1) || (o == 0);
14591 o_conv = AnnouncementSignatures_clone(&o_conv);
14592 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14593 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
14594 return (uint64_t)ret_conv;
14597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14598 LDKDecodeError e_conv;
14599 e_conv.inner = (void*)(e & (~1));
14600 e_conv.is_owned = (e & 1) || (e == 0);
14601 e_conv = DecodeError_clone(&e_conv);
14602 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14603 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
14604 return (uint64_t)ret_conv;
14607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14608 if ((_res & 1) != 0) return;
14609 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14610 CHECK_ACCESS(_res_ptr);
14611 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
14613 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
14616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14617 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
14618 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
14619 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
14620 return (uint64_t)ret_conv;
14623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14624 LDKChannelReestablish o_conv;
14625 o_conv.inner = (void*)(o & (~1));
14626 o_conv.is_owned = (o & 1) || (o == 0);
14627 o_conv = ChannelReestablish_clone(&o_conv);
14628 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14629 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
14630 return (uint64_t)ret_conv;
14633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14634 LDKDecodeError e_conv;
14635 e_conv.inner = (void*)(e & (~1));
14636 e_conv.is_owned = (e & 1) || (e == 0);
14637 e_conv = DecodeError_clone(&e_conv);
14638 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14639 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
14640 return (uint64_t)ret_conv;
14643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14644 if ((_res & 1) != 0) return;
14645 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14646 CHECK_ACCESS(_res_ptr);
14647 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
14649 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
14652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14653 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
14654 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
14655 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
14656 return (uint64_t)ret_conv;
14659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14660 LDKClosingSigned o_conv;
14661 o_conv.inner = (void*)(o & (~1));
14662 o_conv.is_owned = (o & 1) || (o == 0);
14663 o_conv = ClosingSigned_clone(&o_conv);
14664 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14665 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
14666 return (uint64_t)ret_conv;
14669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14670 LDKDecodeError e_conv;
14671 e_conv.inner = (void*)(e & (~1));
14672 e_conv.is_owned = (e & 1) || (e == 0);
14673 e_conv = DecodeError_clone(&e_conv);
14674 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14675 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
14676 return (uint64_t)ret_conv;
14679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14680 if ((_res & 1) != 0) return;
14681 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14682 CHECK_ACCESS(_res_ptr);
14683 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
14685 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
14688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14689 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
14690 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
14691 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
14692 return (uint64_t)ret_conv;
14695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14696 LDKClosingSignedFeeRange o_conv;
14697 o_conv.inner = (void*)(o & (~1));
14698 o_conv.is_owned = (o & 1) || (o == 0);
14699 o_conv = ClosingSignedFeeRange_clone(&o_conv);
14700 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14701 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
14702 return (uint64_t)ret_conv;
14705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14706 LDKDecodeError e_conv;
14707 e_conv.inner = (void*)(e & (~1));
14708 e_conv.is_owned = (e & 1) || (e == 0);
14709 e_conv = DecodeError_clone(&e_conv);
14710 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14711 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
14712 return (uint64_t)ret_conv;
14715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14716 if ((_res & 1) != 0) return;
14717 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14718 CHECK_ACCESS(_res_ptr);
14719 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
14721 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
14724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14725 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
14726 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
14727 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
14728 return (uint64_t)ret_conv;
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14732 LDKCommitmentSigned o_conv;
14733 o_conv.inner = (void*)(o & (~1));
14734 o_conv.is_owned = (o & 1) || (o == 0);
14735 o_conv = CommitmentSigned_clone(&o_conv);
14736 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14737 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
14738 return (uint64_t)ret_conv;
14741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14742 LDKDecodeError e_conv;
14743 e_conv.inner = (void*)(e & (~1));
14744 e_conv.is_owned = (e & 1) || (e == 0);
14745 e_conv = DecodeError_clone(&e_conv);
14746 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14747 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
14748 return (uint64_t)ret_conv;
14751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14752 if ((_res & 1) != 0) return;
14753 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14754 CHECK_ACCESS(_res_ptr);
14755 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
14757 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
14760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14761 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
14762 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
14763 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
14764 return (uint64_t)ret_conv;
14767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14768 LDKFundingCreated o_conv;
14769 o_conv.inner = (void*)(o & (~1));
14770 o_conv.is_owned = (o & 1) || (o == 0);
14771 o_conv = FundingCreated_clone(&o_conv);
14772 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14773 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
14774 return (uint64_t)ret_conv;
14777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14778 LDKDecodeError e_conv;
14779 e_conv.inner = (void*)(e & (~1));
14780 e_conv.is_owned = (e & 1) || (e == 0);
14781 e_conv = DecodeError_clone(&e_conv);
14782 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14783 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
14784 return (uint64_t)ret_conv;
14787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14788 if ((_res & 1) != 0) return;
14789 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14790 CHECK_ACCESS(_res_ptr);
14791 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
14793 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
14796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14797 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
14798 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
14799 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
14800 return (uint64_t)ret_conv;
14803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14804 LDKFundingSigned o_conv;
14805 o_conv.inner = (void*)(o & (~1));
14806 o_conv.is_owned = (o & 1) || (o == 0);
14807 o_conv = FundingSigned_clone(&o_conv);
14808 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14809 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
14810 return (uint64_t)ret_conv;
14813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14814 LDKDecodeError e_conv;
14815 e_conv.inner = (void*)(e & (~1));
14816 e_conv.is_owned = (e & 1) || (e == 0);
14817 e_conv = DecodeError_clone(&e_conv);
14818 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14819 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
14820 return (uint64_t)ret_conv;
14823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14824 if ((_res & 1) != 0) return;
14825 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14826 CHECK_ACCESS(_res_ptr);
14827 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
14829 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
14832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14833 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
14834 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
14835 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
14836 return (uint64_t)ret_conv;
14839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14840 LDKFundingLocked o_conv;
14841 o_conv.inner = (void*)(o & (~1));
14842 o_conv.is_owned = (o & 1) || (o == 0);
14843 o_conv = FundingLocked_clone(&o_conv);
14844 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14845 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
14846 return (uint64_t)ret_conv;
14849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14850 LDKDecodeError e_conv;
14851 e_conv.inner = (void*)(e & (~1));
14852 e_conv.is_owned = (e & 1) || (e == 0);
14853 e_conv = DecodeError_clone(&e_conv);
14854 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14855 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
14856 return (uint64_t)ret_conv;
14859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14860 if ((_res & 1) != 0) return;
14861 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14862 CHECK_ACCESS(_res_ptr);
14863 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
14865 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
14868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14869 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
14870 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14871 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
14872 return (uint64_t)ret_conv;
14875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14877 o_conv.inner = (void*)(o & (~1));
14878 o_conv.is_owned = (o & 1) || (o == 0);
14879 o_conv = Init_clone(&o_conv);
14880 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14881 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
14882 return (uint64_t)ret_conv;
14885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14886 LDKDecodeError e_conv;
14887 e_conv.inner = (void*)(e & (~1));
14888 e_conv.is_owned = (e & 1) || (e == 0);
14889 e_conv = DecodeError_clone(&e_conv);
14890 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14891 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
14892 return (uint64_t)ret_conv;
14895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14896 if ((_res & 1) != 0) return;
14897 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14898 CHECK_ACCESS(_res_ptr);
14899 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
14901 CResult_InitDecodeErrorZ_free(_res_conv);
14904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14905 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
14906 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14907 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
14908 return (uint64_t)ret_conv;
14911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14912 LDKOpenChannel o_conv;
14913 o_conv.inner = (void*)(o & (~1));
14914 o_conv.is_owned = (o & 1) || (o == 0);
14915 o_conv = OpenChannel_clone(&o_conv);
14916 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14917 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
14918 return (uint64_t)ret_conv;
14921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14922 LDKDecodeError e_conv;
14923 e_conv.inner = (void*)(e & (~1));
14924 e_conv.is_owned = (e & 1) || (e == 0);
14925 e_conv = DecodeError_clone(&e_conv);
14926 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14927 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
14928 return (uint64_t)ret_conv;
14931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14932 if ((_res & 1) != 0) return;
14933 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14934 CHECK_ACCESS(_res_ptr);
14935 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
14937 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
14940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14941 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
14942 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14943 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
14944 return (uint64_t)ret_conv;
14947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14948 LDKRevokeAndACK o_conv;
14949 o_conv.inner = (void*)(o & (~1));
14950 o_conv.is_owned = (o & 1) || (o == 0);
14951 o_conv = RevokeAndACK_clone(&o_conv);
14952 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14953 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
14954 return (uint64_t)ret_conv;
14957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14958 LDKDecodeError e_conv;
14959 e_conv.inner = (void*)(e & (~1));
14960 e_conv.is_owned = (e & 1) || (e == 0);
14961 e_conv = DecodeError_clone(&e_conv);
14962 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14963 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
14964 return (uint64_t)ret_conv;
14967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14968 if ((_res & 1) != 0) return;
14969 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14970 CHECK_ACCESS(_res_ptr);
14971 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
14973 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
14976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14977 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
14978 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14979 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
14980 return (uint64_t)ret_conv;
14983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14984 LDKShutdown o_conv;
14985 o_conv.inner = (void*)(o & (~1));
14986 o_conv.is_owned = (o & 1) || (o == 0);
14987 o_conv = Shutdown_clone(&o_conv);
14988 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14989 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
14990 return (uint64_t)ret_conv;
14993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14994 LDKDecodeError e_conv;
14995 e_conv.inner = (void*)(e & (~1));
14996 e_conv.is_owned = (e & 1) || (e == 0);
14997 e_conv = DecodeError_clone(&e_conv);
14998 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14999 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
15000 return (uint64_t)ret_conv;
15003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15004 if ((_res & 1) != 0) return;
15005 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15006 CHECK_ACCESS(_res_ptr);
15007 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
15009 CResult_ShutdownDecodeErrorZ_free(_res_conv);
15012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15013 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
15014 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15015 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
15016 return (uint64_t)ret_conv;
15019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15020 LDKUpdateFailHTLC o_conv;
15021 o_conv.inner = (void*)(o & (~1));
15022 o_conv.is_owned = (o & 1) || (o == 0);
15023 o_conv = UpdateFailHTLC_clone(&o_conv);
15024 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15025 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
15026 return (uint64_t)ret_conv;
15029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15030 LDKDecodeError e_conv;
15031 e_conv.inner = (void*)(e & (~1));
15032 e_conv.is_owned = (e & 1) || (e == 0);
15033 e_conv = DecodeError_clone(&e_conv);
15034 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15035 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
15036 return (uint64_t)ret_conv;
15039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15040 if ((_res & 1) != 0) return;
15041 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15042 CHECK_ACCESS(_res_ptr);
15043 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
15045 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
15048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15049 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
15050 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15051 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
15052 return (uint64_t)ret_conv;
15055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15056 LDKUpdateFailMalformedHTLC o_conv;
15057 o_conv.inner = (void*)(o & (~1));
15058 o_conv.is_owned = (o & 1) || (o == 0);
15059 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
15060 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15061 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
15062 return (uint64_t)ret_conv;
15065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15066 LDKDecodeError e_conv;
15067 e_conv.inner = (void*)(e & (~1));
15068 e_conv.is_owned = (e & 1) || (e == 0);
15069 e_conv = DecodeError_clone(&e_conv);
15070 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15071 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
15072 return (uint64_t)ret_conv;
15075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15076 if ((_res & 1) != 0) return;
15077 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15078 CHECK_ACCESS(_res_ptr);
15079 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
15081 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
15084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15085 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
15086 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15087 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
15088 return (uint64_t)ret_conv;
15091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15092 LDKUpdateFee o_conv;
15093 o_conv.inner = (void*)(o & (~1));
15094 o_conv.is_owned = (o & 1) || (o == 0);
15095 o_conv = UpdateFee_clone(&o_conv);
15096 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15097 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
15098 return (uint64_t)ret_conv;
15101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15102 LDKDecodeError e_conv;
15103 e_conv.inner = (void*)(e & (~1));
15104 e_conv.is_owned = (e & 1) || (e == 0);
15105 e_conv = DecodeError_clone(&e_conv);
15106 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15107 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
15108 return (uint64_t)ret_conv;
15111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15112 if ((_res & 1) != 0) return;
15113 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15114 CHECK_ACCESS(_res_ptr);
15115 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
15117 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
15120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15121 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
15122 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15123 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
15124 return (uint64_t)ret_conv;
15127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15128 LDKUpdateFulfillHTLC o_conv;
15129 o_conv.inner = (void*)(o & (~1));
15130 o_conv.is_owned = (o & 1) || (o == 0);
15131 o_conv = UpdateFulfillHTLC_clone(&o_conv);
15132 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15133 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
15134 return (uint64_t)ret_conv;
15137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15138 LDKDecodeError e_conv;
15139 e_conv.inner = (void*)(e & (~1));
15140 e_conv.is_owned = (e & 1) || (e == 0);
15141 e_conv = DecodeError_clone(&e_conv);
15142 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15143 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
15144 return (uint64_t)ret_conv;
15147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15148 if ((_res & 1) != 0) return;
15149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15150 CHECK_ACCESS(_res_ptr);
15151 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
15153 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
15156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15157 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
15158 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15159 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
15160 return (uint64_t)ret_conv;
15163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15164 LDKUpdateAddHTLC o_conv;
15165 o_conv.inner = (void*)(o & (~1));
15166 o_conv.is_owned = (o & 1) || (o == 0);
15167 o_conv = UpdateAddHTLC_clone(&o_conv);
15168 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15169 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
15170 return (uint64_t)ret_conv;
15173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15174 LDKDecodeError e_conv;
15175 e_conv.inner = (void*)(e & (~1));
15176 e_conv.is_owned = (e & 1) || (e == 0);
15177 e_conv = DecodeError_clone(&e_conv);
15178 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15179 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
15180 return (uint64_t)ret_conv;
15183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15184 if ((_res & 1) != 0) return;
15185 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15186 CHECK_ACCESS(_res_ptr);
15187 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
15189 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
15192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15193 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
15194 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15195 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
15196 return (uint64_t)ret_conv;
15199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15201 o_conv.inner = (void*)(o & (~1));
15202 o_conv.is_owned = (o & 1) || (o == 0);
15203 o_conv = Ping_clone(&o_conv);
15204 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15205 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
15206 return (uint64_t)ret_conv;
15209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15210 LDKDecodeError e_conv;
15211 e_conv.inner = (void*)(e & (~1));
15212 e_conv.is_owned = (e & 1) || (e == 0);
15213 e_conv = DecodeError_clone(&e_conv);
15214 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15215 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
15216 return (uint64_t)ret_conv;
15219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15220 if ((_res & 1) != 0) return;
15221 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15222 CHECK_ACCESS(_res_ptr);
15223 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
15225 CResult_PingDecodeErrorZ_free(_res_conv);
15228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15229 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
15230 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15231 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
15232 return (uint64_t)ret_conv;
15235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15237 o_conv.inner = (void*)(o & (~1));
15238 o_conv.is_owned = (o & 1) || (o == 0);
15239 o_conv = Pong_clone(&o_conv);
15240 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15241 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
15242 return (uint64_t)ret_conv;
15245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15246 LDKDecodeError e_conv;
15247 e_conv.inner = (void*)(e & (~1));
15248 e_conv.is_owned = (e & 1) || (e == 0);
15249 e_conv = DecodeError_clone(&e_conv);
15250 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15251 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
15252 return (uint64_t)ret_conv;
15255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15256 if ((_res & 1) != 0) return;
15257 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15258 CHECK_ACCESS(_res_ptr);
15259 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
15261 CResult_PongDecodeErrorZ_free(_res_conv);
15264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15265 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
15266 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15267 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
15268 return (uint64_t)ret_conv;
15271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15272 LDKUnsignedChannelAnnouncement o_conv;
15273 o_conv.inner = (void*)(o & (~1));
15274 o_conv.is_owned = (o & 1) || (o == 0);
15275 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
15276 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15277 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
15278 return (uint64_t)ret_conv;
15281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15282 LDKDecodeError e_conv;
15283 e_conv.inner = (void*)(e & (~1));
15284 e_conv.is_owned = (e & 1) || (e == 0);
15285 e_conv = DecodeError_clone(&e_conv);
15286 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15287 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
15288 return (uint64_t)ret_conv;
15291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15292 if ((_res & 1) != 0) return;
15293 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15294 CHECK_ACCESS(_res_ptr);
15295 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15297 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
15300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15301 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15302 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15303 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15304 return (uint64_t)ret_conv;
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15308 LDKChannelAnnouncement o_conv;
15309 o_conv.inner = (void*)(o & (~1));
15310 o_conv.is_owned = (o & 1) || (o == 0);
15311 o_conv = ChannelAnnouncement_clone(&o_conv);
15312 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15313 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
15314 return (uint64_t)ret_conv;
15317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15318 LDKDecodeError e_conv;
15319 e_conv.inner = (void*)(e & (~1));
15320 e_conv.is_owned = (e & 1) || (e == 0);
15321 e_conv = DecodeError_clone(&e_conv);
15322 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15323 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
15324 return (uint64_t)ret_conv;
15327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15328 if ((_res & 1) != 0) return;
15329 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15330 CHECK_ACCESS(_res_ptr);
15331 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
15333 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
15336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15337 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
15338 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15339 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
15340 return (uint64_t)ret_conv;
15343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15344 LDKUnsignedChannelUpdate o_conv;
15345 o_conv.inner = (void*)(o & (~1));
15346 o_conv.is_owned = (o & 1) || (o == 0);
15347 o_conv = UnsignedChannelUpdate_clone(&o_conv);
15348 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15349 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
15350 return (uint64_t)ret_conv;
15353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15354 LDKDecodeError e_conv;
15355 e_conv.inner = (void*)(e & (~1));
15356 e_conv.is_owned = (e & 1) || (e == 0);
15357 e_conv = DecodeError_clone(&e_conv);
15358 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15359 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
15360 return (uint64_t)ret_conv;
15363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15364 if ((_res & 1) != 0) return;
15365 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15366 CHECK_ACCESS(_res_ptr);
15367 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
15369 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
15372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15373 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
15374 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15375 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
15376 return (uint64_t)ret_conv;
15379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15380 LDKChannelUpdate o_conv;
15381 o_conv.inner = (void*)(o & (~1));
15382 o_conv.is_owned = (o & 1) || (o == 0);
15383 o_conv = ChannelUpdate_clone(&o_conv);
15384 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15385 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
15386 return (uint64_t)ret_conv;
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15390 LDKDecodeError e_conv;
15391 e_conv.inner = (void*)(e & (~1));
15392 e_conv.is_owned = (e & 1) || (e == 0);
15393 e_conv = DecodeError_clone(&e_conv);
15394 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15395 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
15396 return (uint64_t)ret_conv;
15399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15400 if ((_res & 1) != 0) return;
15401 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15402 CHECK_ACCESS(_res_ptr);
15403 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
15405 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
15408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15409 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
15410 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15411 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
15412 return (uint64_t)ret_conv;
15415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15416 LDKErrorMessage o_conv;
15417 o_conv.inner = (void*)(o & (~1));
15418 o_conv.is_owned = (o & 1) || (o == 0);
15419 o_conv = ErrorMessage_clone(&o_conv);
15420 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15421 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
15422 return (uint64_t)ret_conv;
15425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15426 LDKDecodeError e_conv;
15427 e_conv.inner = (void*)(e & (~1));
15428 e_conv.is_owned = (e & 1) || (e == 0);
15429 e_conv = DecodeError_clone(&e_conv);
15430 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15431 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
15432 return (uint64_t)ret_conv;
15435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15436 if ((_res & 1) != 0) return;
15437 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15438 CHECK_ACCESS(_res_ptr);
15439 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
15441 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
15444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15445 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
15446 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15447 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
15448 return (uint64_t)ret_conv;
15451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15452 LDKUnsignedNodeAnnouncement o_conv;
15453 o_conv.inner = (void*)(o & (~1));
15454 o_conv.is_owned = (o & 1) || (o == 0);
15455 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
15456 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15457 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
15458 return (uint64_t)ret_conv;
15461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15462 LDKDecodeError e_conv;
15463 e_conv.inner = (void*)(e & (~1));
15464 e_conv.is_owned = (e & 1) || (e == 0);
15465 e_conv = DecodeError_clone(&e_conv);
15466 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15467 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
15468 return (uint64_t)ret_conv;
15471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15472 if ((_res & 1) != 0) return;
15473 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15474 CHECK_ACCESS(_res_ptr);
15475 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
15477 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
15480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15481 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
15482 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15483 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
15484 return (uint64_t)ret_conv;
15487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15488 LDKNodeAnnouncement o_conv;
15489 o_conv.inner = (void*)(o & (~1));
15490 o_conv.is_owned = (o & 1) || (o == 0);
15491 o_conv = NodeAnnouncement_clone(&o_conv);
15492 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15493 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
15494 return (uint64_t)ret_conv;
15497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15498 LDKDecodeError e_conv;
15499 e_conv.inner = (void*)(e & (~1));
15500 e_conv.is_owned = (e & 1) || (e == 0);
15501 e_conv = DecodeError_clone(&e_conv);
15502 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15503 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
15504 return (uint64_t)ret_conv;
15507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15508 if ((_res & 1) != 0) return;
15509 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15510 CHECK_ACCESS(_res_ptr);
15511 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
15513 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
15516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15517 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
15518 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15519 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
15520 return (uint64_t)ret_conv;
15523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15524 LDKQueryShortChannelIds o_conv;
15525 o_conv.inner = (void*)(o & (~1));
15526 o_conv.is_owned = (o & 1) || (o == 0);
15527 o_conv = QueryShortChannelIds_clone(&o_conv);
15528 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15529 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
15530 return (uint64_t)ret_conv;
15533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15534 LDKDecodeError e_conv;
15535 e_conv.inner = (void*)(e & (~1));
15536 e_conv.is_owned = (e & 1) || (e == 0);
15537 e_conv = DecodeError_clone(&e_conv);
15538 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15539 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
15540 return (uint64_t)ret_conv;
15543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15544 if ((_res & 1) != 0) return;
15545 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15546 CHECK_ACCESS(_res_ptr);
15547 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
15549 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
15552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15553 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
15554 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15555 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
15556 return (uint64_t)ret_conv;
15559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15560 LDKReplyShortChannelIdsEnd o_conv;
15561 o_conv.inner = (void*)(o & (~1));
15562 o_conv.is_owned = (o & 1) || (o == 0);
15563 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
15564 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15565 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
15566 return (uint64_t)ret_conv;
15569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15570 LDKDecodeError e_conv;
15571 e_conv.inner = (void*)(e & (~1));
15572 e_conv.is_owned = (e & 1) || (e == 0);
15573 e_conv = DecodeError_clone(&e_conv);
15574 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15575 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
15576 return (uint64_t)ret_conv;
15579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15580 if ((_res & 1) != 0) return;
15581 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15582 CHECK_ACCESS(_res_ptr);
15583 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
15585 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
15588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15589 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
15590 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15591 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
15592 return (uint64_t)ret_conv;
15595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15596 LDKQueryChannelRange o_conv;
15597 o_conv.inner = (void*)(o & (~1));
15598 o_conv.is_owned = (o & 1) || (o == 0);
15599 o_conv = QueryChannelRange_clone(&o_conv);
15600 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15601 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
15602 return (uint64_t)ret_conv;
15605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15606 LDKDecodeError e_conv;
15607 e_conv.inner = (void*)(e & (~1));
15608 e_conv.is_owned = (e & 1) || (e == 0);
15609 e_conv = DecodeError_clone(&e_conv);
15610 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15611 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
15612 return (uint64_t)ret_conv;
15615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15616 if ((_res & 1) != 0) return;
15617 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15618 CHECK_ACCESS(_res_ptr);
15619 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
15621 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
15624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15625 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
15626 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15627 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
15628 return (uint64_t)ret_conv;
15631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15632 LDKReplyChannelRange o_conv;
15633 o_conv.inner = (void*)(o & (~1));
15634 o_conv.is_owned = (o & 1) || (o == 0);
15635 o_conv = ReplyChannelRange_clone(&o_conv);
15636 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15637 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
15638 return (uint64_t)ret_conv;
15641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15642 LDKDecodeError e_conv;
15643 e_conv.inner = (void*)(e & (~1));
15644 e_conv.is_owned = (e & 1) || (e == 0);
15645 e_conv = DecodeError_clone(&e_conv);
15646 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15647 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
15648 return (uint64_t)ret_conv;
15651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15652 if ((_res & 1) != 0) return;
15653 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15654 CHECK_ACCESS(_res_ptr);
15655 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
15657 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15661 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
15662 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
15663 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
15664 return (uint64_t)ret_conv;
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15668 LDKGossipTimestampFilter o_conv;
15669 o_conv.inner = (void*)(o & (~1));
15670 o_conv.is_owned = (o & 1) || (o == 0);
15671 o_conv = GossipTimestampFilter_clone(&o_conv);
15672 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15673 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
15674 return (uint64_t)ret_conv;
15677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15678 LDKDecodeError e_conv;
15679 e_conv.inner = (void*)(e & (~1));
15680 e_conv.is_owned = (e & 1) || (e == 0);
15681 e_conv = DecodeError_clone(&e_conv);
15682 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15683 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
15684 return (uint64_t)ret_conv;
15687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15688 if ((_res & 1) != 0) return;
15689 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15690 CHECK_ACCESS(_res_ptr);
15691 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
15693 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
15696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15697 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
15698 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
15699 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
15700 return (uint64_t)ret_conv;
15703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15705 o_conv.inner = (void*)(o & (~1));
15706 o_conv.is_owned = (o & 1) || (o == 0);
15707 o_conv = Invoice_clone(&o_conv);
15708 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15709 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
15710 return (uint64_t)ret_conv;
15713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15714 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15715 CHECK_ACCESS(e_ptr);
15716 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
15717 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
15718 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15719 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
15720 return (uint64_t)ret_conv;
15723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15724 if ((_res & 1) != 0) return;
15725 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15726 CHECK_ACCESS(_res_ptr);
15727 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
15729 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
15732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15733 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
15734 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
15735 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
15736 return (uint64_t)ret_conv;
15739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15740 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15741 CHECK_ACCESS(o_ptr);
15742 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15743 if (o_conv.free == LDKFilter_JCalls_free) {
15744 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15745 LDKFilter_JCalls_cloned(&o_conv);
15747 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15748 *ret_copy = COption_FilterZ_some(o_conv);
15749 uint64_t ret_ref = (uint64_t)ret_copy;
15753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
15754 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15755 *ret_copy = COption_FilterZ_none();
15756 uint64_t ret_ref = (uint64_t)ret_copy;
15760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15761 if ((_res & 1) != 0) return;
15762 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15763 CHECK_ACCESS(_res_ptr);
15764 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15766 COption_FilterZ_free(_res_conv);
15769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15770 LDKLockedChannelMonitor o_conv;
15771 o_conv.inner = (void*)(o & (~1));
15772 o_conv.is_owned = (o & 1) || (o == 0);
15773 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15774 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15775 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15776 return (uint64_t)ret_conv;
15779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
15780 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15781 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15782 return (uint64_t)ret_conv;
15785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15786 if ((_res & 1) != 0) return;
15787 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15788 CHECK_ACCESS(_res_ptr);
15789 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15791 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15795 LDKCVec_OutPointZ _res_constr;
15796 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15797 if (_res_constr.datalen > 0)
15798 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15800 _res_constr.data = NULL;
15801 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15802 for (size_t k = 0; k < _res_constr.datalen; k++) {
15803 int64_t _res_conv_10 = _res_vals[k];
15804 LDKOutPoint _res_conv_10_conv;
15805 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15806 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15807 _res_constr.data[k] = _res_conv_10_conv;
15809 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15810 CVec_OutPointZ_free(_res_constr);
15813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15814 if ((this_ptr & 1) != 0) return;
15815 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15816 CHECK_ACCESS(this_ptr_ptr);
15817 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
15818 FREE((void*)this_ptr);
15819 PaymentPurpose_free(this_ptr_conv);
15822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15823 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
15824 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15825 *ret_copy = PaymentPurpose_clone(orig_conv);
15826 uint64_t ret_ref = (uint64_t)ret_copy;
15830 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) {
15831 LDKThirtyTwoBytes payment_preimage_ref;
15832 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15833 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15834 LDKThirtyTwoBytes payment_secret_ref;
15835 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15836 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15837 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15838 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
15839 uint64_t ret_ref = (uint64_t)ret_copy;
15843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
15844 LDKThirtyTwoBytes a_ref;
15845 CHECK((*env)->GetArrayLength(env, a) == 32);
15846 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
15847 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
15848 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
15849 uint64_t ret_ref = (uint64_t)ret_copy;
15853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15854 if ((this_ptr & 1) != 0) return;
15855 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15856 CHECK_ACCESS(this_ptr_ptr);
15857 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
15858 FREE((void*)this_ptr);
15859 ClosureReason_free(this_ptr_conv);
15862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15863 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
15864 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15865 *ret_copy = ClosureReason_clone(orig_conv);
15866 uint64_t ret_ref = (uint64_t)ret_copy;
15870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
15871 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
15872 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15873 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
15874 uint64_t ret_ref = (uint64_t)ret_copy;
15878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
15879 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15880 *ret_copy = ClosureReason_holder_force_closed();
15881 uint64_t ret_ref = (uint64_t)ret_copy;
15885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
15886 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15887 *ret_copy = ClosureReason_cooperative_closure();
15888 uint64_t ret_ref = (uint64_t)ret_copy;
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
15893 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15894 *ret_copy = ClosureReason_commitment_tx_confirmed();
15895 uint64_t ret_ref = (uint64_t)ret_copy;
15899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
15900 LDKStr err_conv = java_to_owned_str(env, err);
15901 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15902 *ret_copy = ClosureReason_processing_error(err_conv);
15903 uint64_t ret_ref = (uint64_t)ret_copy;
15907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
15908 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15909 *ret_copy = ClosureReason_disconnected_peer();
15910 uint64_t ret_ref = (uint64_t)ret_copy;
15914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
15915 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
15916 *ret_copy = ClosureReason_outdated_channel_manager();
15917 uint64_t ret_ref = (uint64_t)ret_copy;
15921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
15922 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
15923 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
15924 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15925 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15926 CVec_u8Z_free(ret_var);
15930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15931 if ((this_ptr & 1) != 0) return;
15932 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
15933 CHECK_ACCESS(this_ptr_ptr);
15934 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
15935 FREE((void*)this_ptr);
15936 Event_free(this_ptr_conv);
15939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15940 LDKEvent* orig_conv = (LDKEvent*)orig;
15941 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15942 *ret_copy = Event_clone(orig_conv);
15943 uint64_t ret_ref = (uint64_t)ret_copy;
15947 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) {
15948 LDKThirtyTwoBytes temporary_channel_id_ref;
15949 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15950 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
15951 LDKCVec_u8Z output_script_ref;
15952 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
15953 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
15954 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
15955 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15956 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
15957 uint64_t ret_ref = (uint64_t)ret_copy;
15961 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) {
15962 LDKThirtyTwoBytes payment_hash_ref;
15963 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15964 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15965 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
15966 CHECK_ACCESS(purpose_ptr);
15967 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
15968 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
15969 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15970 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
15971 uint64_t ret_ref = (uint64_t)ret_copy;
15975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_hash) {
15976 LDKThirtyTwoBytes payment_preimage_ref;
15977 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15978 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15979 LDKThirtyTwoBytes payment_hash_ref;
15980 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15981 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15982 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15983 *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref);
15984 uint64_t ret_ref = (uint64_t)ret_copy;
15988 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) {
15989 LDKThirtyTwoBytes payment_hash_ref;
15990 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15991 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15992 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
15993 CHECK_ACCESS(network_update_ptr);
15994 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
15995 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
15996 LDKCVec_RouteHopZ path_constr;
15997 path_constr.datalen = (*env)->GetArrayLength(env, path);
15998 if (path_constr.datalen > 0)
15999 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16001 path_constr.data = NULL;
16002 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
16003 for (size_t k = 0; k < path_constr.datalen; k++) {
16004 int64_t path_conv_10 = path_vals[k];
16005 LDKRouteHop path_conv_10_conv;
16006 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16007 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16008 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16009 path_constr.data[k] = path_conv_10_conv;
16011 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
16012 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16013 CHECK_ACCESS(short_channel_id_ptr);
16014 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16015 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16016 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16017 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv);
16018 uint64_t ret_ref = (uint64_t)ret_copy;
16022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
16023 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16024 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16025 uint64_t ret_ref = (uint64_t)ret_copy;
16029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
16030 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16031 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
16032 if (outputs_constr.datalen > 0)
16033 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16035 outputs_constr.data = NULL;
16036 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
16037 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16038 int64_t outputs_conv_27 = outputs_vals[b];
16039 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16040 CHECK_ACCESS(outputs_conv_27_ptr);
16041 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16042 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16043 outputs_constr.data[b] = outputs_conv_27_conv;
16045 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
16046 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16047 *ret_copy = Event_spendable_outputs(outputs_constr);
16048 uint64_t ret_ref = (uint64_t)ret_copy;
16052 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) {
16053 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16054 CHECK_ACCESS(fee_earned_msat_ptr);
16055 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16056 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16057 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16058 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16059 uint64_t ret_ref = (uint64_t)ret_copy;
16063 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) {
16064 LDKThirtyTwoBytes channel_id_ref;
16065 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16066 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
16067 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16068 CHECK_ACCESS(reason_ptr);
16069 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16070 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16071 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16072 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16073 uint64_t ret_ref = (uint64_t)ret_copy;
16077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
16078 LDKThirtyTwoBytes channel_id_ref;
16079 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16080 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
16081 LDKTransaction transaction_ref;
16082 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
16083 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16084 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
16085 transaction_ref.data_is_owned = true;
16086 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16087 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16088 uint64_t ret_ref = (uint64_t)ret_copy;
16092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
16093 LDKEvent* obj_conv = (LDKEvent*)obj;
16094 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16097 CVec_u8Z_free(ret_var);
16101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16102 if ((this_ptr & 1) != 0) return;
16103 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16104 CHECK_ACCESS(this_ptr_ptr);
16105 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16106 FREE((void*)this_ptr);
16107 MessageSendEvent_free(this_ptr_conv);
16110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16111 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16112 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16113 *ret_copy = MessageSendEvent_clone(orig_conv);
16114 uint64_t ret_ref = (uint64_t)ret_copy;
16118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16119 LDKPublicKey node_id_ref;
16120 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16121 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16122 LDKAcceptChannel msg_conv;
16123 msg_conv.inner = (void*)(msg & (~1));
16124 msg_conv.is_owned = (msg & 1) || (msg == 0);
16125 msg_conv = AcceptChannel_clone(&msg_conv);
16126 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16127 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16128 uint64_t ret_ref = (uint64_t)ret_copy;
16132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16133 LDKPublicKey node_id_ref;
16134 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16135 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16136 LDKOpenChannel msg_conv;
16137 msg_conv.inner = (void*)(msg & (~1));
16138 msg_conv.is_owned = (msg & 1) || (msg == 0);
16139 msg_conv = OpenChannel_clone(&msg_conv);
16140 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16141 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16142 uint64_t ret_ref = (uint64_t)ret_copy;
16146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16147 LDKPublicKey node_id_ref;
16148 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16149 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16150 LDKFundingCreated msg_conv;
16151 msg_conv.inner = (void*)(msg & (~1));
16152 msg_conv.is_owned = (msg & 1) || (msg == 0);
16153 msg_conv = FundingCreated_clone(&msg_conv);
16154 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16155 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16156 uint64_t ret_ref = (uint64_t)ret_copy;
16160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16161 LDKPublicKey node_id_ref;
16162 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16163 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16164 LDKFundingSigned msg_conv;
16165 msg_conv.inner = (void*)(msg & (~1));
16166 msg_conv.is_owned = (msg & 1) || (msg == 0);
16167 msg_conv = FundingSigned_clone(&msg_conv);
16168 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16169 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16170 uint64_t ret_ref = (uint64_t)ret_copy;
16174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16175 LDKPublicKey node_id_ref;
16176 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16177 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16178 LDKFundingLocked msg_conv;
16179 msg_conv.inner = (void*)(msg & (~1));
16180 msg_conv.is_owned = (msg & 1) || (msg == 0);
16181 msg_conv = FundingLocked_clone(&msg_conv);
16182 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16183 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16184 uint64_t ret_ref = (uint64_t)ret_copy;
16188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16189 LDKPublicKey node_id_ref;
16190 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16191 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16192 LDKAnnouncementSignatures msg_conv;
16193 msg_conv.inner = (void*)(msg & (~1));
16194 msg_conv.is_owned = (msg & 1) || (msg == 0);
16195 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16196 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16197 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16198 uint64_t ret_ref = (uint64_t)ret_copy;
16202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
16203 LDKPublicKey node_id_ref;
16204 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16205 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16206 LDKCommitmentUpdate updates_conv;
16207 updates_conv.inner = (void*)(updates & (~1));
16208 updates_conv.is_owned = (updates & 1) || (updates == 0);
16209 updates_conv = CommitmentUpdate_clone(&updates_conv);
16210 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16211 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16212 uint64_t ret_ref = (uint64_t)ret_copy;
16216 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) {
16217 LDKPublicKey node_id_ref;
16218 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16219 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16220 LDKRevokeAndACK msg_conv;
16221 msg_conv.inner = (void*)(msg & (~1));
16222 msg_conv.is_owned = (msg & 1) || (msg == 0);
16223 msg_conv = RevokeAndACK_clone(&msg_conv);
16224 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16225 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16226 uint64_t ret_ref = (uint64_t)ret_copy;
16230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16231 LDKPublicKey node_id_ref;
16232 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16233 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16234 LDKClosingSigned msg_conv;
16235 msg_conv.inner = (void*)(msg & (~1));
16236 msg_conv.is_owned = (msg & 1) || (msg == 0);
16237 msg_conv = ClosingSigned_clone(&msg_conv);
16238 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16239 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16240 uint64_t ret_ref = (uint64_t)ret_copy;
16244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16245 LDKPublicKey node_id_ref;
16246 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16247 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16248 LDKShutdown msg_conv;
16249 msg_conv.inner = (void*)(msg & (~1));
16250 msg_conv.is_owned = (msg & 1) || (msg == 0);
16251 msg_conv = Shutdown_clone(&msg_conv);
16252 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16253 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16254 uint64_t ret_ref = (uint64_t)ret_copy;
16258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16259 LDKPublicKey node_id_ref;
16260 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16261 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16262 LDKChannelReestablish msg_conv;
16263 msg_conv.inner = (void*)(msg & (~1));
16264 msg_conv.is_owned = (msg & 1) || (msg == 0);
16265 msg_conv = ChannelReestablish_clone(&msg_conv);
16266 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16267 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16268 uint64_t ret_ref = (uint64_t)ret_copy;
16272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
16273 LDKChannelAnnouncement msg_conv;
16274 msg_conv.inner = (void*)(msg & (~1));
16275 msg_conv.is_owned = (msg & 1) || (msg == 0);
16276 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16277 LDKChannelUpdate update_msg_conv;
16278 update_msg_conv.inner = (void*)(update_msg & (~1));
16279 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16280 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16281 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16282 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16283 uint64_t ret_ref = (uint64_t)ret_copy;
16287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
16288 LDKNodeAnnouncement msg_conv;
16289 msg_conv.inner = (void*)(msg & (~1));
16290 msg_conv.is_owned = (msg & 1) || (msg == 0);
16291 msg_conv = NodeAnnouncement_clone(&msg_conv);
16292 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16293 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16294 uint64_t ret_ref = (uint64_t)ret_copy;
16298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
16299 LDKChannelUpdate msg_conv;
16300 msg_conv.inner = (void*)(msg & (~1));
16301 msg_conv.is_owned = (msg & 1) || (msg == 0);
16302 msg_conv = ChannelUpdate_clone(&msg_conv);
16303 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16304 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16305 uint64_t ret_ref = (uint64_t)ret_copy;
16309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
16310 LDKPublicKey node_id_ref;
16311 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16312 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16313 LDKChannelUpdate msg_conv;
16314 msg_conv.inner = (void*)(msg & (~1));
16315 msg_conv.is_owned = (msg & 1) || (msg == 0);
16316 msg_conv = ChannelUpdate_clone(&msg_conv);
16317 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16318 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16319 uint64_t ret_ref = (uint64_t)ret_copy;
16323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
16324 LDKPublicKey node_id_ref;
16325 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16326 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16327 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16328 CHECK_ACCESS(action_ptr);
16329 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16330 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
16331 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16332 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
16333 uint64_t ret_ref = (uint64_t)ret_copy;
16337 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) {
16338 LDKPublicKey node_id_ref;
16339 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16340 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16341 LDKQueryChannelRange msg_conv;
16342 msg_conv.inner = (void*)(msg & (~1));
16343 msg_conv.is_owned = (msg & 1) || (msg == 0);
16344 msg_conv = QueryChannelRange_clone(&msg_conv);
16345 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16346 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
16347 uint64_t ret_ref = (uint64_t)ret_copy;
16351 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) {
16352 LDKPublicKey node_id_ref;
16353 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16354 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16355 LDKQueryShortChannelIds msg_conv;
16356 msg_conv.inner = (void*)(msg & (~1));
16357 msg_conv.is_owned = (msg & 1) || (msg == 0);
16358 msg_conv = QueryShortChannelIds_clone(&msg_conv);
16359 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16360 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
16361 uint64_t ret_ref = (uint64_t)ret_copy;
16365 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) {
16366 LDKPublicKey node_id_ref;
16367 CHECK((*env)->GetArrayLength(env, node_id) == 33);
16368 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
16369 LDKReplyChannelRange msg_conv;
16370 msg_conv.inner = (void*)(msg & (~1));
16371 msg_conv.is_owned = (msg & 1) || (msg == 0);
16372 msg_conv = ReplyChannelRange_clone(&msg_conv);
16373 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16374 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
16375 uint64_t ret_ref = (uint64_t)ret_copy;
16379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16380 if ((this_ptr & 1) != 0) return;
16381 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16382 CHECK_ACCESS(this_ptr_ptr);
16383 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
16384 FREE((void*)this_ptr);
16385 MessageSendEventsProvider_free(this_ptr_conv);
16388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16389 if ((this_ptr & 1) != 0) return;
16390 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16391 CHECK_ACCESS(this_ptr_ptr);
16392 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
16393 FREE((void*)this_ptr);
16394 EventsProvider_free(this_ptr_conv);
16397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16398 if ((this_ptr & 1) != 0) return;
16399 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16400 CHECK_ACCESS(this_ptr_ptr);
16401 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
16402 FREE((void*)this_ptr);
16403 EventHandler_free(this_ptr_conv);
16406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16407 if ((this_ptr & 1) != 0) return;
16408 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16409 CHECK_ACCESS(this_ptr_ptr);
16410 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
16411 FREE((void*)this_ptr);
16412 APIError_free(this_ptr_conv);
16415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16416 LDKAPIError* orig_conv = (LDKAPIError*)orig;
16417 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16418 *ret_copy = APIError_clone(orig_conv);
16419 uint64_t ret_ref = (uint64_t)ret_copy;
16423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
16424 LDKStr err_conv = java_to_owned_str(env, err);
16425 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16426 *ret_copy = APIError_apimisuse_error(err_conv);
16427 uint64_t ret_ref = (uint64_t)ret_copy;
16431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
16432 LDKStr err_conv = java_to_owned_str(env, err);
16433 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16434 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
16435 uint64_t ret_ref = (uint64_t)ret_copy;
16439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
16440 LDKStr err_conv = java_to_owned_str(env, err);
16441 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16442 *ret_copy = APIError_route_error(err_conv);
16443 uint64_t ret_ref = (uint64_t)ret_copy;
16447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
16448 LDKStr err_conv = java_to_owned_str(env, err);
16449 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16450 *ret_copy = APIError_channel_unavailable(err_conv);
16451 uint64_t ret_ref = (uint64_t)ret_copy;
16455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
16456 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16457 *ret_copy = APIError_monitor_update_failed();
16458 uint64_t ret_ref = (uint64_t)ret_copy;
16462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
16463 LDKShutdownScript script_conv;
16464 script_conv.inner = (void*)(script & (~1));
16465 script_conv.is_owned = (script & 1) || (script == 0);
16466 script_conv = ShutdownScript_clone(&script_conv);
16467 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16468 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16469 uint64_t ret_ref = (uint64_t)ret_copy;
16473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
16474 LDKu8slice msg_ref;
16475 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16476 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16477 unsigned char sk_arr[32];
16478 CHECK((*env)->GetArrayLength(env, sk) == 32);
16479 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
16480 unsigned char (*sk_ref)[32] = &sk_arr;
16481 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16482 *ret_conv = sign(msg_ref, sk_ref);
16483 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16484 return (uint64_t)ret_conv;
16487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
16488 LDKu8slice msg_ref;
16489 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16490 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16491 LDKStr sig_conv = java_to_owned_str(env, sig);
16492 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16493 *ret_conv = recover_pk(msg_ref, sig_conv);
16494 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16495 return (uint64_t)ret_conv;
16498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
16499 LDKu8slice msg_ref;
16500 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
16501 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
16502 LDKStr sig_conv = java_to_owned_str(env, sig);
16503 LDKPublicKey pk_ref;
16504 CHECK((*env)->GetArrayLength(env, pk) == 33);
16505 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
16506 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16507 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
16511 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16512 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16513 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
16517 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
16518 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
16522 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
16523 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
16527 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
16528 jclass ret_conv = LDKLevel_to_java(env, Level_info());
16532 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
16533 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
16537 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
16538 jclass ret_conv = LDKLevel_to_java(env, Level_error());
16542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16543 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16544 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16545 jboolean ret_val = Level_eq(a_conv, b_conv);
16549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
16550 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16551 int64_t ret_val = Level_hash(o_conv);
16555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
16556 jclass ret_conv = LDKLevel_to_java(env, Level_max());
16560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16561 if ((this_ptr & 1) != 0) return;
16562 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16563 CHECK_ACCESS(this_ptr_ptr);
16564 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
16565 FREE((void*)this_ptr);
16566 Logger_free(this_ptr_conv);
16569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16570 LDKChannelHandshakeConfig this_obj_conv;
16571 this_obj_conv.inner = (void*)(this_obj & (~1));
16572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16573 ChannelHandshakeConfig_free(this_obj_conv);
16576 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16577 LDKChannelHandshakeConfig this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
16584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16585 LDKChannelHandshakeConfig this_ptr_conv;
16586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16587 this_ptr_conv.is_owned = false;
16588 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
16591 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16592 LDKChannelHandshakeConfig this_ptr_conv;
16593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16594 this_ptr_conv.is_owned = false;
16595 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
16599 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) {
16600 LDKChannelHandshakeConfig this_ptr_conv;
16601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16602 this_ptr_conv.is_owned = false;
16603 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
16606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16607 LDKChannelHandshakeConfig this_ptr_conv;
16608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16609 this_ptr_conv.is_owned = false;
16610 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
16614 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) {
16615 LDKChannelHandshakeConfig this_ptr_conv;
16616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16617 this_ptr_conv.is_owned = false;
16618 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
16621 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) {
16622 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
16623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16625 uint64_t ret_ref = (uint64_t)ret_var.inner;
16626 if (ret_var.is_owned) {
16632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16633 LDKChannelHandshakeConfig orig_conv;
16634 orig_conv.inner = (void*)(orig & (~1));
16635 orig_conv.is_owned = false;
16636 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
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_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
16647 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
16648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16650 uint64_t ret_ref = (uint64_t)ret_var.inner;
16651 if (ret_var.is_owned) {
16657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16658 LDKChannelHandshakeLimits this_obj_conv;
16659 this_obj_conv.inner = (void*)(this_obj & (~1));
16660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16661 ChannelHandshakeLimits_free(this_obj_conv);
16664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16665 LDKChannelHandshakeLimits this_ptr_conv;
16666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16667 this_ptr_conv.is_owned = false;
16668 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
16672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16673 LDKChannelHandshakeLimits this_ptr_conv;
16674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16675 this_ptr_conv.is_owned = false;
16676 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
16679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16680 LDKChannelHandshakeLimits this_ptr_conv;
16681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16682 this_ptr_conv.is_owned = false;
16683 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
16687 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) {
16688 LDKChannelHandshakeLimits this_ptr_conv;
16689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16690 this_ptr_conv.is_owned = false;
16691 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
16694 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) {
16695 LDKChannelHandshakeLimits this_ptr_conv;
16696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16697 this_ptr_conv.is_owned = false;
16698 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
16702 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) {
16703 LDKChannelHandshakeLimits this_ptr_conv;
16704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16705 this_ptr_conv.is_owned = false;
16706 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16710 LDKChannelHandshakeLimits this_ptr_conv;
16711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16712 this_ptr_conv.is_owned = false;
16713 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
16717 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) {
16718 LDKChannelHandshakeLimits this_ptr_conv;
16719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16720 this_ptr_conv.is_owned = false;
16721 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
16724 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16725 LDKChannelHandshakeLimits this_ptr_conv;
16726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16727 this_ptr_conv.is_owned = false;
16728 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
16732 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) {
16733 LDKChannelHandshakeLimits this_ptr_conv;
16734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16735 this_ptr_conv.is_owned = false;
16736 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
16739 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16740 LDKChannelHandshakeLimits this_ptr_conv;
16741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16742 this_ptr_conv.is_owned = false;
16743 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
16747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16748 LDKChannelHandshakeLimits this_ptr_conv;
16749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16750 this_ptr_conv.is_owned = false;
16751 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
16754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
16755 LDKChannelHandshakeLimits this_ptr_conv;
16756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16757 this_ptr_conv.is_owned = false;
16758 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
16762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16763 LDKChannelHandshakeLimits this_ptr_conv;
16764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16765 this_ptr_conv.is_owned = false;
16766 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
16769 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16770 LDKChannelHandshakeLimits this_ptr_conv;
16771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16772 this_ptr_conv.is_owned = false;
16773 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
16777 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) {
16778 LDKChannelHandshakeLimits this_ptr_conv;
16779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16780 this_ptr_conv.is_owned = false;
16781 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
16784 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) {
16785 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);
16786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16788 uint64_t ret_ref = (uint64_t)ret_var.inner;
16789 if (ret_var.is_owned) {
16795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16796 LDKChannelHandshakeLimits orig_conv;
16797 orig_conv.inner = (void*)(orig & (~1));
16798 orig_conv.is_owned = false;
16799 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
16800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16802 uint64_t ret_ref = (uint64_t)ret_var.inner;
16803 if (ret_var.is_owned) {
16809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
16810 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
16811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16813 uint64_t ret_ref = (uint64_t)ret_var.inner;
16814 if (ret_var.is_owned) {
16820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16821 LDKChannelConfig this_obj_conv;
16822 this_obj_conv.inner = (void*)(this_obj & (~1));
16823 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16824 ChannelConfig_free(this_obj_conv);
16827 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16828 LDKChannelConfig this_ptr_conv;
16829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16830 this_ptr_conv.is_owned = false;
16831 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
16835 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) {
16836 LDKChannelConfig this_ptr_conv;
16837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16838 this_ptr_conv.is_owned = false;
16839 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
16842 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16843 LDKChannelConfig this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = false;
16846 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
16850 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) {
16851 LDKChannelConfig this_ptr_conv;
16852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16853 this_ptr_conv.is_owned = false;
16854 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
16857 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16858 LDKChannelConfig this_ptr_conv;
16859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16860 this_ptr_conv.is_owned = false;
16861 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
16865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16866 LDKChannelConfig this_ptr_conv;
16867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16868 this_ptr_conv.is_owned = false;
16869 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
16872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
16873 LDKChannelConfig this_ptr_conv;
16874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16875 this_ptr_conv.is_owned = false;
16876 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
16880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16881 LDKChannelConfig this_ptr_conv;
16882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16883 this_ptr_conv.is_owned = false;
16884 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
16887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16888 LDKChannelConfig this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
16895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16896 LDKChannelConfig this_ptr_conv;
16897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16898 this_ptr_conv.is_owned = false;
16899 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
16902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16903 LDKChannelConfig this_ptr_conv;
16904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16905 this_ptr_conv.is_owned = false;
16906 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
16910 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) {
16911 LDKChannelConfig this_ptr_conv;
16912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16913 this_ptr_conv.is_owned = false;
16914 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
16917 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) {
16918 LDKChannelConfig this_ptr_conv;
16919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16920 this_ptr_conv.is_owned = false;
16921 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
16925 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) {
16926 LDKChannelConfig this_ptr_conv;
16927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16928 this_ptr_conv.is_owned = false;
16929 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
16932 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) {
16933 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);
16934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16936 uint64_t ret_ref = (uint64_t)ret_var.inner;
16937 if (ret_var.is_owned) {
16943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16944 LDKChannelConfig orig_conv;
16945 orig_conv.inner = (void*)(orig & (~1));
16946 orig_conv.is_owned = false;
16947 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
16948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16950 uint64_t ret_ref = (uint64_t)ret_var.inner;
16951 if (ret_var.is_owned) {
16957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
16958 LDKChannelConfig ret_var = ChannelConfig_default();
16959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16961 uint64_t ret_ref = (uint64_t)ret_var.inner;
16962 if (ret_var.is_owned) {
16968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
16969 LDKChannelConfig obj_conv;
16970 obj_conv.inner = (void*)(obj & (~1));
16971 obj_conv.is_owned = false;
16972 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
16973 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16974 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16975 CVec_u8Z_free(ret_var);
16979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16980 LDKu8slice ser_ref;
16981 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16982 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16983 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16984 *ret_conv = ChannelConfig_read(ser_ref);
16985 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16986 return (uint64_t)ret_conv;
16989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16990 LDKUserConfig this_obj_conv;
16991 this_obj_conv.inner = (void*)(this_obj & (~1));
16992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16993 UserConfig_free(this_obj_conv);
16996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16997 LDKUserConfig this_ptr_conv;
16998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16999 this_ptr_conv.is_owned = false;
17000 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17003 uint64_t ret_ref = (uint64_t)ret_var.inner;
17004 if (ret_var.is_owned) {
17010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17011 LDKUserConfig this_ptr_conv;
17012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17013 this_ptr_conv.is_owned = false;
17014 LDKChannelHandshakeConfig val_conv;
17015 val_conv.inner = (void*)(val & (~1));
17016 val_conv.is_owned = (val & 1) || (val == 0);
17017 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17018 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
17022 LDKUserConfig this_ptr_conv;
17023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17024 this_ptr_conv.is_owned = false;
17025 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17028 uint64_t ret_ref = (uint64_t)ret_var.inner;
17029 if (ret_var.is_owned) {
17035 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) {
17036 LDKUserConfig this_ptr_conv;
17037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17038 this_ptr_conv.is_owned = false;
17039 LDKChannelHandshakeLimits val_conv;
17040 val_conv.inner = (void*)(val & (~1));
17041 val_conv.is_owned = (val & 1) || (val == 0);
17042 val_conv = ChannelHandshakeLimits_clone(&val_conv);
17043 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
17046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
17047 LDKUserConfig this_ptr_conv;
17048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17049 this_ptr_conv.is_owned = false;
17050 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
17051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17053 uint64_t ret_ref = (uint64_t)ret_var.inner;
17054 if (ret_var.is_owned) {
17060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17061 LDKUserConfig this_ptr_conv;
17062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17063 this_ptr_conv.is_owned = false;
17064 LDKChannelConfig val_conv;
17065 val_conv.inner = (void*)(val & (~1));
17066 val_conv.is_owned = (val & 1) || (val == 0);
17067 val_conv = ChannelConfig_clone(&val_conv);
17068 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
17071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
17072 LDKUserConfig this_ptr_conv;
17073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17074 this_ptr_conv.is_owned = false;
17075 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
17079 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) {
17080 LDKUserConfig this_ptr_conv;
17081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17082 this_ptr_conv.is_owned = false;
17083 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
17086 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) {
17087 LDKChannelHandshakeConfig own_channel_config_arg_conv;
17088 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
17089 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
17090 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
17091 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
17092 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
17093 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
17094 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
17095 LDKChannelConfig channel_options_arg_conv;
17096 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
17097 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
17098 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
17099 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);
17100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17102 uint64_t ret_ref = (uint64_t)ret_var.inner;
17103 if (ret_var.is_owned) {
17109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17110 LDKUserConfig orig_conv;
17111 orig_conv.inner = (void*)(orig & (~1));
17112 orig_conv.is_owned = false;
17113 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
17114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17116 uint64_t ret_ref = (uint64_t)ret_var.inner;
17117 if (ret_var.is_owned) {
17123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
17124 LDKUserConfig ret_var = UserConfig_default();
17125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17127 uint64_t ret_ref = (uint64_t)ret_var.inner;
17128 if (ret_var.is_owned) {
17134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17135 LDKBestBlock this_obj_conv;
17136 this_obj_conv.inner = (void*)(this_obj & (~1));
17137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17138 BestBlock_free(this_obj_conv);
17141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17142 LDKBestBlock orig_conv;
17143 orig_conv.inner = (void*)(orig & (~1));
17144 orig_conv.is_owned = false;
17145 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
17146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17148 uint64_t ret_ref = (uint64_t)ret_var.inner;
17149 if (ret_var.is_owned) {
17155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
17156 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
17157 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
17158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17160 uint64_t ret_ref = (uint64_t)ret_var.inner;
17161 if (ret_var.is_owned) {
17167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
17168 LDKThirtyTwoBytes block_hash_ref;
17169 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
17170 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
17171 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
17172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17174 uint64_t ret_ref = (uint64_t)ret_var.inner;
17175 if (ret_var.is_owned) {
17181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
17182 LDKBestBlock this_arg_conv;
17183 this_arg_conv.inner = (void*)(this_arg & (~1));
17184 this_arg_conv.is_owned = false;
17185 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
17190 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
17191 LDKBestBlock this_arg_conv;
17192 this_arg_conv.inner = (void*)(this_arg & (~1));
17193 this_arg_conv.is_owned = false;
17194 int32_t ret_val = BestBlock_height(&this_arg_conv);
17198 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17199 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
17200 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
17204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
17205 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
17209 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
17210 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
17214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17215 if ((this_ptr & 1) != 0) return;
17216 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17217 CHECK_ACCESS(this_ptr_ptr);
17218 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
17219 FREE((void*)this_ptr);
17220 Access_free(this_ptr_conv);
17223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17224 if ((this_ptr & 1) != 0) return;
17225 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17226 CHECK_ACCESS(this_ptr_ptr);
17227 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
17228 FREE((void*)this_ptr);
17229 Listen_free(this_ptr_conv);
17232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17233 if ((this_ptr & 1) != 0) return;
17234 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17235 CHECK_ACCESS(this_ptr_ptr);
17236 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
17237 FREE((void*)this_ptr);
17238 Confirm_free(this_ptr_conv);
17241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17242 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
17243 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
17247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
17248 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
17252 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
17253 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
17257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17258 if ((this_ptr & 1) != 0) return;
17259 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17260 CHECK_ACCESS(this_ptr_ptr);
17261 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
17262 FREE((void*)this_ptr);
17263 Watch_free(this_ptr_conv);
17266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17267 if ((this_ptr & 1) != 0) return;
17268 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17269 CHECK_ACCESS(this_ptr_ptr);
17270 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
17271 FREE((void*)this_ptr);
17272 Filter_free(this_ptr_conv);
17275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17276 LDKWatchedOutput this_obj_conv;
17277 this_obj_conv.inner = (void*)(this_obj & (~1));
17278 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17279 WatchedOutput_free(this_obj_conv);
17282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17283 LDKWatchedOutput this_ptr_conv;
17284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17285 this_ptr_conv.is_owned = false;
17286 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17287 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
17291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17292 LDKWatchedOutput this_ptr_conv;
17293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17294 this_ptr_conv.is_owned = false;
17295 LDKThirtyTwoBytes val_ref;
17296 CHECK((*env)->GetArrayLength(env, val) == 32);
17297 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17298 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
17301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17302 LDKWatchedOutput this_ptr_conv;
17303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17304 this_ptr_conv.is_owned = false;
17305 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
17306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17308 uint64_t ret_ref = (uint64_t)ret_var.inner;
17309 if (ret_var.is_owned) {
17315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17316 LDKWatchedOutput this_ptr_conv;
17317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17318 this_ptr_conv.is_owned = false;
17319 LDKOutPoint val_conv;
17320 val_conv.inner = (void*)(val & (~1));
17321 val_conv.is_owned = (val & 1) || (val == 0);
17322 val_conv = OutPoint_clone(&val_conv);
17323 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
17326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17327 LDKWatchedOutput this_ptr_conv;
17328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17329 this_ptr_conv.is_owned = false;
17330 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
17331 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17332 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17337 LDKWatchedOutput this_ptr_conv;
17338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17339 this_ptr_conv.is_owned = false;
17340 LDKCVec_u8Z val_ref;
17341 val_ref.datalen = (*env)->GetArrayLength(env, val);
17342 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17343 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17344 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
17347 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) {
17348 LDKThirtyTwoBytes block_hash_arg_ref;
17349 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
17350 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
17351 LDKOutPoint outpoint_arg_conv;
17352 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17353 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17354 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17355 LDKCVec_u8Z script_pubkey_arg_ref;
17356 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
17357 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17358 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
17359 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
17360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17362 uint64_t ret_ref = (uint64_t)ret_var.inner;
17363 if (ret_var.is_owned) {
17369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17370 LDKWatchedOutput orig_conv;
17371 orig_conv.inner = (void*)(orig & (~1));
17372 orig_conv.is_owned = false;
17373 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
17374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17376 uint64_t ret_ref = (uint64_t)ret_var.inner;
17377 if (ret_var.is_owned) {
17383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
17384 LDKWatchedOutput o_conv;
17385 o_conv.inner = (void*)(o & (~1));
17386 o_conv.is_owned = false;
17387 int64_t ret_val = WatchedOutput_hash(&o_conv);
17391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17392 if ((this_ptr & 1) != 0) return;
17393 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17394 CHECK_ACCESS(this_ptr_ptr);
17395 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
17396 FREE((void*)this_ptr);
17397 BroadcasterInterface_free(this_ptr_conv);
17400 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17401 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
17402 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
17406 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
17407 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
17411 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
17412 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
17416 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
17417 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
17421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17422 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
17423 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
17424 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
17428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17429 if ((this_ptr & 1) != 0) return;
17430 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17431 CHECK_ACCESS(this_ptr_ptr);
17432 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
17433 FREE((void*)this_ptr);
17434 FeeEstimator_free(this_ptr_conv);
17437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17438 if ((this_ptr & 1) != 0) return;
17439 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17440 CHECK_ACCESS(this_ptr_ptr);
17441 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
17442 FREE((void*)this_ptr);
17443 Persist_free(this_ptr_conv);
17446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17447 LDKLockedChannelMonitor this_obj_conv;
17448 this_obj_conv.inner = (void*)(this_obj & (~1));
17449 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17450 LockedChannelMonitor_free(this_obj_conv);
17453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17454 LDKChainMonitor this_obj_conv;
17455 this_obj_conv.inner = (void*)(this_obj & (~1));
17456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17457 ChainMonitor_free(this_obj_conv);
17460 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) {
17461 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
17462 CHECK_ACCESS(chain_source_ptr);
17463 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
17464 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
17465 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
17466 // Manually implement clone for Java trait instances
17467 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
17468 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17469 LDKFilter_JCalls_cloned(&chain_source_conv.some);
17472 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
17473 CHECK_ACCESS(broadcaster_ptr);
17474 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
17475 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17476 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17477 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17479 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
17480 CHECK_ACCESS(logger_ptr);
17481 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
17482 if (logger_conv.free == LDKLogger_JCalls_free) {
17483 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17484 LDKLogger_JCalls_cloned(&logger_conv);
17486 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
17487 CHECK_ACCESS(feeest_ptr);
17488 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
17489 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
17490 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17491 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
17493 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
17494 CHECK_ACCESS(persister_ptr);
17495 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
17496 if (persister_conv.free == LDKPersist_JCalls_free) {
17497 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17498 LDKPersist_JCalls_cloned(&persister_conv);
17500 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
17501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17503 uint64_t ret_ref = (uint64_t)ret_var.inner;
17504 if (ret_var.is_owned) {
17510 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) {
17511 LDKChainMonitor this_arg_conv;
17512 this_arg_conv.inner = (void*)(this_arg & (~1));
17513 this_arg_conv.is_owned = false;
17514 LDKCVec_ChannelDetailsZ ignored_channels_constr;
17515 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
17516 if (ignored_channels_constr.datalen > 0)
17517 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
17519 ignored_channels_constr.data = NULL;
17520 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
17521 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
17522 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
17523 LDKChannelDetails ignored_channels_conv_16_conv;
17524 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
17525 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
17526 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
17527 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
17529 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
17530 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
17531 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17532 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17533 for (size_t j = 0; j < ret_var.datalen; j++) {
17534 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17535 *ret_conv_9_copy = ret_var.data[j];
17536 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
17537 ret_arr_ptr[j] = ret_conv_9_ref;
17539 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17540 FREE(ret_var.data);
17544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
17545 LDKChainMonitor this_arg_conv;
17546 this_arg_conv.inner = (void*)(this_arg & (~1));
17547 this_arg_conv.is_owned = false;
17548 LDKOutPoint funding_txo_conv;
17549 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17550 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
17551 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
17552 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
17553 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
17554 return (uint64_t)ret_conv;
17557 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
17558 LDKChainMonitor this_arg_conv;
17559 this_arg_conv.inner = (void*)(this_arg & (~1));
17560 this_arg_conv.is_owned = false;
17561 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
17562 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17563 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17564 for (size_t k = 0; k < ret_var.datalen; k++) {
17565 LDKOutPoint ret_conv_10_var = ret_var.data[k];
17566 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17567 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17568 uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
17569 if (ret_conv_10_var.is_owned) {
17570 ret_conv_10_ref |= 1;
17572 ret_arr_ptr[k] = ret_conv_10_ref;
17574 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17575 FREE(ret_var.data);
17579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
17580 LDKChainMonitor this_arg_conv;
17581 this_arg_conv.inner = (void*)(this_arg & (~1));
17582 this_arg_conv.is_owned = false;
17583 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
17584 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
17585 return (uint64_t)ret_ret;
17588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
17589 LDKChainMonitor this_arg_conv;
17590 this_arg_conv.inner = (void*)(this_arg & (~1));
17591 this_arg_conv.is_owned = false;
17592 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17593 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
17594 return (uint64_t)ret_ret;
17597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
17598 LDKChainMonitor this_arg_conv;
17599 this_arg_conv.inner = (void*)(this_arg & (~1));
17600 this_arg_conv.is_owned = false;
17601 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
17602 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
17603 return (uint64_t)ret_ret;
17606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17607 LDKChainMonitor this_arg_conv;
17608 this_arg_conv.inner = (void*)(this_arg & (~1));
17609 this_arg_conv.is_owned = false;
17610 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17611 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
17612 return (uint64_t)ret_ret;
17615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17616 LDKChannelMonitorUpdate this_obj_conv;
17617 this_obj_conv.inner = (void*)(this_obj & (~1));
17618 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17619 ChannelMonitorUpdate_free(this_obj_conv);
17622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17623 LDKChannelMonitorUpdate this_ptr_conv;
17624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17625 this_ptr_conv.is_owned = false;
17626 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
17630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17631 LDKChannelMonitorUpdate this_ptr_conv;
17632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17633 this_ptr_conv.is_owned = false;
17634 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
17637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17638 LDKChannelMonitorUpdate orig_conv;
17639 orig_conv.inner = (void*)(orig & (~1));
17640 orig_conv.is_owned = false;
17641 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
17642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17644 uint64_t ret_ref = (uint64_t)ret_var.inner;
17645 if (ret_var.is_owned) {
17651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17652 LDKChannelMonitorUpdate obj_conv;
17653 obj_conv.inner = (void*)(obj & (~1));
17654 obj_conv.is_owned = false;
17655 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
17656 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17657 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17658 CVec_u8Z_free(ret_var);
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17663 LDKu8slice ser_ref;
17664 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17665 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17666 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17667 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
17668 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17669 return (uint64_t)ret_conv;
17672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17673 LDKMonitorUpdateError this_obj_conv;
17674 this_obj_conv.inner = (void*)(this_obj & (~1));
17675 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17676 MonitorUpdateError_free(this_obj_conv);
17679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17680 LDKMonitorUpdateError orig_conv;
17681 orig_conv.inner = (void*)(orig & (~1));
17682 orig_conv.is_owned = false;
17683 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
17684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17686 uint64_t ret_ref = (uint64_t)ret_var.inner;
17687 if (ret_var.is_owned) {
17693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17694 if ((this_ptr & 1) != 0) return;
17695 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17696 CHECK_ACCESS(this_ptr_ptr);
17697 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
17698 FREE((void*)this_ptr);
17699 MonitorEvent_free(this_ptr_conv);
17702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17703 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
17704 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17705 *ret_copy = MonitorEvent_clone(orig_conv);
17706 uint64_t ret_ref = (uint64_t)ret_copy;
17710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
17711 LDKHTLCUpdate a_conv;
17712 a_conv.inner = (void*)(a & (~1));
17713 a_conv.is_owned = (a & 1) || (a == 0);
17714 a_conv = HTLCUpdate_clone(&a_conv);
17715 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17716 *ret_copy = MonitorEvent_htlcevent(a_conv);
17717 uint64_t ret_ref = (uint64_t)ret_copy;
17721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
17722 LDKOutPoint a_conv;
17723 a_conv.inner = (void*)(a & (~1));
17724 a_conv.is_owned = (a & 1) || (a == 0);
17725 a_conv = OutPoint_clone(&a_conv);
17726 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17727 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
17728 uint64_t ret_ref = (uint64_t)ret_copy;
17732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17733 LDKHTLCUpdate this_obj_conv;
17734 this_obj_conv.inner = (void*)(this_obj & (~1));
17735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17736 HTLCUpdate_free(this_obj_conv);
17739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17740 LDKHTLCUpdate orig_conv;
17741 orig_conv.inner = (void*)(orig & (~1));
17742 orig_conv.is_owned = false;
17743 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
17744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17746 uint64_t ret_ref = (uint64_t)ret_var.inner;
17747 if (ret_var.is_owned) {
17753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
17754 LDKHTLCUpdate obj_conv;
17755 obj_conv.inner = (void*)(obj & (~1));
17756 obj_conv.is_owned = false;
17757 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
17758 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17759 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17760 CVec_u8Z_free(ret_var);
17764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17765 LDKu8slice ser_ref;
17766 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17767 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17768 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17769 *ret_conv = HTLCUpdate_read(ser_ref);
17770 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17771 return (uint64_t)ret_conv;
17774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17775 if ((this_ptr & 1) != 0) return;
17776 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17777 CHECK_ACCESS(this_ptr_ptr);
17778 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
17779 FREE((void*)this_ptr);
17780 Balance_free(this_ptr_conv);
17783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17784 LDKBalance* orig_conv = (LDKBalance*)orig;
17785 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17786 *ret_copy = Balance_clone(orig_conv);
17787 uint64_t ret_ref = (uint64_t)ret_copy;
17791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
17792 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17793 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
17794 uint64_t ret_ref = (uint64_t)ret_copy;
17798 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) {
17799 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17800 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
17801 uint64_t ret_ref = (uint64_t)ret_copy;
17805 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) {
17806 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17807 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
17808 uint64_t ret_ref = (uint64_t)ret_copy;
17812 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) {
17813 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17814 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
17815 uint64_t ret_ref = (uint64_t)ret_copy;
17819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17820 LDKBalance* a_conv = (LDKBalance*)a;
17821 LDKBalance* b_conv = (LDKBalance*)b;
17822 jboolean ret_val = Balance_eq(a_conv, b_conv);
17826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17827 LDKChannelMonitor this_obj_conv;
17828 this_obj_conv.inner = (void*)(this_obj & (~1));
17829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17830 ChannelMonitor_free(this_obj_conv);
17833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17834 LDKChannelMonitor orig_conv;
17835 orig_conv.inner = (void*)(orig & (~1));
17836 orig_conv.is_owned = false;
17837 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
17838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17840 uint64_t ret_ref = (uint64_t)ret_var.inner;
17841 if (ret_var.is_owned) {
17847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17848 LDKChannelMonitor obj_conv;
17849 obj_conv.inner = (void*)(obj & (~1));
17850 obj_conv.is_owned = false;
17851 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
17852 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17853 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17854 CVec_u8Z_free(ret_var);
17858 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) {
17859 LDKChannelMonitor this_arg_conv;
17860 this_arg_conv.inner = (void*)(this_arg & (~1));
17861 this_arg_conv.is_owned = false;
17862 LDKChannelMonitorUpdate updates_conv;
17863 updates_conv.inner = (void*)(updates & (~1));
17864 updates_conv.is_owned = false;
17865 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
17866 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
17867 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
17868 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
17869 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
17870 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
17871 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
17872 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
17873 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
17874 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
17875 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
17876 return (uint64_t)ret_conv;
17879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17880 LDKChannelMonitor this_arg_conv;
17881 this_arg_conv.inner = (void*)(this_arg & (~1));
17882 this_arg_conv.is_owned = false;
17883 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
17887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
17888 LDKChannelMonitor this_arg_conv;
17889 this_arg_conv.inner = (void*)(this_arg & (~1));
17890 this_arg_conv.is_owned = false;
17891 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17892 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
17893 return ((uint64_t)ret_conv);
17896 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
17897 LDKChannelMonitor this_arg_conv;
17898 this_arg_conv.inner = (void*)(this_arg & (~1));
17899 this_arg_conv.is_owned = false;
17900 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
17901 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17902 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17903 for (size_t o = 0; o < ret_var.datalen; o++) {
17904 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17905 *ret_conv_40_conv = ret_var.data[o];
17906 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
17908 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17909 FREE(ret_var.data);
17913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
17914 LDKChannelMonitor this_arg_conv;
17915 this_arg_conv.inner = (void*)(this_arg & (~1));
17916 this_arg_conv.is_owned = false;
17917 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
17918 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
17919 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
17920 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
17923 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17924 LDKChannelMonitor this_arg_conv;
17925 this_arg_conv.inner = (void*)(this_arg & (~1));
17926 this_arg_conv.is_owned = false;
17927 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
17928 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17929 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17930 for (size_t o = 0; o < ret_var.datalen; o++) {
17931 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
17932 *ret_conv_14_copy = ret_var.data[o];
17933 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
17934 ret_arr_ptr[o] = ret_conv_14_ref;
17936 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17937 FREE(ret_var.data);
17941 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17942 LDKChannelMonitor this_arg_conv;
17943 this_arg_conv.inner = (void*)(this_arg & (~1));
17944 this_arg_conv.is_owned = false;
17945 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
17946 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17947 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17948 for (size_t h = 0; h < ret_var.datalen; h++) {
17949 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17950 *ret_conv_7_copy = ret_var.data[h];
17951 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
17952 ret_arr_ptr[h] = ret_conv_7_ref;
17954 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17955 FREE(ret_var.data);
17959 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) {
17960 LDKChannelMonitor this_arg_conv;
17961 this_arg_conv.inner = (void*)(this_arg & (~1));
17962 this_arg_conv.is_owned = false;
17963 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
17964 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
17965 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
17966 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
17967 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17969 for (size_t i = 0; i < ret_var.datalen; i++) {
17970 LDKTransaction ret_conv_8_var = ret_var.data[i];
17971 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
17972 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
17973 Transaction_free(ret_conv_8_var);
17974 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17976 FREE(ret_var.data);
17980 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) {
17981 LDKChannelMonitor this_arg_conv;
17982 this_arg_conv.inner = (void*)(this_arg & (~1));
17983 this_arg_conv.is_owned = false;
17984 unsigned char header_arr[80];
17985 CHECK((*env)->GetArrayLength(env, header) == 80);
17986 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17987 unsigned char (*header_ref)[80] = &header_arr;
17988 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
17989 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
17990 if (txdata_constr.datalen > 0)
17991 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17993 txdata_constr.data = NULL;
17994 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
17995 for (size_t c = 0; c < txdata_constr.datalen; c++) {
17996 int64_t txdata_conv_28 = txdata_vals[c];
17997 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
17998 CHECK_ACCESS(txdata_conv_28_ptr);
17999 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18000 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
18001 txdata_constr.data[c] = txdata_conv_28_conv;
18003 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18004 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18005 CHECK_ACCESS(broadcaster_ptr);
18006 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18007 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18009 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18011 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18012 CHECK_ACCESS(fee_estimator_ptr);
18013 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18014 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
18015 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18016 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
18018 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18019 CHECK_ACCESS(logger_ptr);
18020 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18021 if (logger_conv.free == LDKLogger_JCalls_free) {
18022 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18023 LDKLogger_JCalls_cloned(&logger_conv);
18025 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);
18026 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18027 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18028 for (size_t n = 0; n < ret_var.datalen; n++) {
18029 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18030 *ret_conv_39_conv = ret_var.data[n];
18031 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
18033 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18034 FREE(ret_var.data);
18038 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) {
18039 LDKChannelMonitor this_arg_conv;
18040 this_arg_conv.inner = (void*)(this_arg & (~1));
18041 this_arg_conv.is_owned = false;
18042 unsigned char header_arr[80];
18043 CHECK((*env)->GetArrayLength(env, header) == 80);
18044 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18045 unsigned char (*header_ref)[80] = &header_arr;
18046 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18047 CHECK_ACCESS(broadcaster_ptr);
18048 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18049 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18050 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18051 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18053 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18054 CHECK_ACCESS(fee_estimator_ptr);
18055 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18056 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
18057 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18058 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
18060 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18061 CHECK_ACCESS(logger_ptr);
18062 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18063 if (logger_conv.free == LDKLogger_JCalls_free) {
18064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18065 LDKLogger_JCalls_cloned(&logger_conv);
18067 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
18070 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) {
18071 LDKChannelMonitor this_arg_conv;
18072 this_arg_conv.inner = (void*)(this_arg & (~1));
18073 this_arg_conv.is_owned = false;
18074 unsigned char header_arr[80];
18075 CHECK((*env)->GetArrayLength(env, header) == 80);
18076 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18077 unsigned char (*header_ref)[80] = &header_arr;
18078 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18079 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18080 if (txdata_constr.datalen > 0)
18081 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18083 txdata_constr.data = NULL;
18084 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18085 for (size_t c = 0; c < txdata_constr.datalen; c++) {
18086 int64_t txdata_conv_28 = txdata_vals[c];
18087 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
18088 CHECK_ACCESS(txdata_conv_28_ptr);
18089 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18090 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
18091 txdata_constr.data[c] = txdata_conv_28_conv;
18093 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18094 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18095 CHECK_ACCESS(broadcaster_ptr);
18096 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18097 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18099 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18101 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18102 CHECK_ACCESS(fee_estimator_ptr);
18103 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18104 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
18105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18106 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
18108 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18109 CHECK_ACCESS(logger_ptr);
18110 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18111 if (logger_conv.free == LDKLogger_JCalls_free) {
18112 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18113 LDKLogger_JCalls_cloned(&logger_conv);
18115 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);
18116 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18117 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18118 for (size_t n = 0; n < ret_var.datalen; n++) {
18119 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18120 *ret_conv_39_conv = ret_var.data[n];
18121 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
18123 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18124 FREE(ret_var.data);
18128 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) {
18129 LDKChannelMonitor this_arg_conv;
18130 this_arg_conv.inner = (void*)(this_arg & (~1));
18131 this_arg_conv.is_owned = false;
18132 unsigned char txid_arr[32];
18133 CHECK((*env)->GetArrayLength(env, txid) == 32);
18134 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
18135 unsigned char (*txid_ref)[32] = &txid_arr;
18136 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18137 CHECK_ACCESS(broadcaster_ptr);
18138 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18139 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18140 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18141 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18143 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18144 CHECK_ACCESS(fee_estimator_ptr);
18145 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18146 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
18147 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18148 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
18150 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18151 CHECK_ACCESS(logger_ptr);
18152 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18153 if (logger_conv.free == LDKLogger_JCalls_free) {
18154 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18155 LDKLogger_JCalls_cloned(&logger_conv);
18157 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
18160 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) {
18161 LDKChannelMonitor this_arg_conv;
18162 this_arg_conv.inner = (void*)(this_arg & (~1));
18163 this_arg_conv.is_owned = false;
18164 unsigned char header_arr[80];
18165 CHECK((*env)->GetArrayLength(env, header) == 80);
18166 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18167 unsigned char (*header_ref)[80] = &header_arr;
18168 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18169 CHECK_ACCESS(broadcaster_ptr);
18170 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18171 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18172 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18173 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18175 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18176 CHECK_ACCESS(fee_estimator_ptr);
18177 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
18178 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
18179 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18180 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
18182 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18183 CHECK_ACCESS(logger_ptr);
18184 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18185 if (logger_conv.free == LDKLogger_JCalls_free) {
18186 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18187 LDKLogger_JCalls_cloned(&logger_conv);
18189 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
18190 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18191 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18192 for (size_t n = 0; n < ret_var.datalen; n++) {
18193 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18194 *ret_conv_39_conv = ret_var.data[n];
18195 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
18197 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18198 FREE(ret_var.data);
18202 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
18203 LDKChannelMonitor this_arg_conv;
18204 this_arg_conv.inner = (void*)(this_arg & (~1));
18205 this_arg_conv.is_owned = false;
18206 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
18207 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
18209 for (size_t i = 0; i < ret_var.datalen; i++) {
18210 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
18211 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
18212 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
18214 FREE(ret_var.data);
18218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
18219 LDKChannelMonitor this_arg_conv;
18220 this_arg_conv.inner = (void*)(this_arg & (~1));
18221 this_arg_conv.is_owned = false;
18222 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
18223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18225 uint64_t ret_ref = (uint64_t)ret_var.inner;
18226 if (ret_var.is_owned) {
18232 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
18233 LDKChannelMonitor this_arg_conv;
18234 this_arg_conv.inner = (void*)(this_arg & (~1));
18235 this_arg_conv.is_owned = false;
18236 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
18237 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18238 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18239 for (size_t j = 0; j < ret_var.datalen; j++) {
18240 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18241 *ret_conv_9_copy = ret_var.data[j];
18242 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18243 ret_arr_ptr[j] = ret_conv_9_ref;
18245 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18246 FREE(ret_var.data);
18250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
18251 LDKu8slice ser_ref;
18252 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18253 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18254 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
18255 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
18256 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
18257 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18258 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
18259 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18260 return (uint64_t)ret_conv;
18263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18264 LDKOutPoint this_obj_conv;
18265 this_obj_conv.inner = (void*)(this_obj & (~1));
18266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18267 OutPoint_free(this_obj_conv);
18270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18271 LDKOutPoint this_ptr_conv;
18272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18273 this_ptr_conv.is_owned = false;
18274 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18275 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
18279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18280 LDKOutPoint this_ptr_conv;
18281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18282 this_ptr_conv.is_owned = false;
18283 LDKThirtyTwoBytes val_ref;
18284 CHECK((*env)->GetArrayLength(env, val) == 32);
18285 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18286 OutPoint_set_txid(&this_ptr_conv, val_ref);
18289 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
18290 LDKOutPoint this_ptr_conv;
18291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18292 this_ptr_conv.is_owned = false;
18293 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
18297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18298 LDKOutPoint this_ptr_conv;
18299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18300 this_ptr_conv.is_owned = false;
18301 OutPoint_set_index(&this_ptr_conv, val);
18304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
18305 LDKThirtyTwoBytes txid_arg_ref;
18306 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
18307 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
18308 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
18309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18311 uint64_t ret_ref = (uint64_t)ret_var.inner;
18312 if (ret_var.is_owned) {
18318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18319 LDKOutPoint orig_conv;
18320 orig_conv.inner = (void*)(orig & (~1));
18321 orig_conv.is_owned = false;
18322 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
18323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18325 uint64_t ret_ref = (uint64_t)ret_var.inner;
18326 if (ret_var.is_owned) {
18332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
18333 LDKOutPoint a_conv;
18334 a_conv.inner = (void*)(a & (~1));
18335 a_conv.is_owned = false;
18336 LDKOutPoint b_conv;
18337 b_conv.inner = (void*)(b & (~1));
18338 b_conv.is_owned = false;
18339 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
18343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
18344 LDKOutPoint o_conv;
18345 o_conv.inner = (void*)(o & (~1));
18346 o_conv.is_owned = false;
18347 int64_t ret_val = OutPoint_hash(&o_conv);
18351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
18352 LDKOutPoint this_arg_conv;
18353 this_arg_conv.inner = (void*)(this_arg & (~1));
18354 this_arg_conv.is_owned = false;
18355 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18356 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
18360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
18361 LDKOutPoint obj_conv;
18362 obj_conv.inner = (void*)(obj & (~1));
18363 obj_conv.is_owned = false;
18364 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
18365 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18366 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18367 CVec_u8Z_free(ret_var);
18371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18372 LDKu8slice ser_ref;
18373 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18374 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18375 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18376 *ret_conv = OutPoint_read(ser_ref);
18377 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18378 return (uint64_t)ret_conv;
18381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18382 LDKDelayedPaymentOutputDescriptor this_obj_conv;
18383 this_obj_conv.inner = (void*)(this_obj & (~1));
18384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18385 DelayedPaymentOutputDescriptor_free(this_obj_conv);
18388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18389 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18391 this_ptr_conv.is_owned = false;
18392 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
18393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18395 uint64_t ret_ref = (uint64_t)ret_var.inner;
18396 if (ret_var.is_owned) {
18402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18403 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18405 this_ptr_conv.is_owned = false;
18406 LDKOutPoint val_conv;
18407 val_conv.inner = (void*)(val & (~1));
18408 val_conv.is_owned = (val & 1) || (val == 0);
18409 val_conv = OutPoint_clone(&val_conv);
18410 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
18413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18414 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18416 this_ptr_conv.is_owned = false;
18417 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18418 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
18422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18423 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18425 this_ptr_conv.is_owned = false;
18426 LDKPublicKey val_ref;
18427 CHECK((*env)->GetArrayLength(env, val) == 33);
18428 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18429 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
18432 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18433 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18435 this_ptr_conv.is_owned = false;
18436 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
18440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18441 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18443 this_ptr_conv.is_owned = false;
18444 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
18447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18448 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18450 this_ptr_conv.is_owned = false;
18451 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18452 CHECK_ACCESS(val_ptr);
18453 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
18454 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
18455 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
18458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18459 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18461 this_ptr_conv.is_owned = false;
18462 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18463 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
18467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18468 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18470 this_ptr_conv.is_owned = false;
18471 LDKPublicKey val_ref;
18472 CHECK((*env)->GetArrayLength(env, val) == 33);
18473 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18474 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
18477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18478 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18480 this_ptr_conv.is_owned = false;
18481 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18482 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
18486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18487 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18489 this_ptr_conv.is_owned = false;
18490 LDKThirtyTwoBytes val_ref;
18491 CHECK((*env)->GetArrayLength(env, val) == 32);
18492 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18493 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
18496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18497 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18499 this_ptr_conv.is_owned = false;
18500 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
18504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18505 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
18506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18507 this_ptr_conv.is_owned = false;
18508 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
18511 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) {
18512 LDKOutPoint outpoint_arg_conv;
18513 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18514 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18515 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18516 LDKPublicKey per_commitment_point_arg_ref;
18517 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
18518 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
18519 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
18520 CHECK_ACCESS(output_arg_ptr);
18521 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
18522 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
18523 LDKPublicKey revocation_pubkey_arg_ref;
18524 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
18525 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
18526 LDKThirtyTwoBytes channel_keys_id_arg_ref;
18527 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
18528 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
18529 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);
18530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18532 uint64_t ret_ref = (uint64_t)ret_var.inner;
18533 if (ret_var.is_owned) {
18539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18540 LDKDelayedPaymentOutputDescriptor orig_conv;
18541 orig_conv.inner = (void*)(orig & (~1));
18542 orig_conv.is_owned = false;
18543 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
18544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18546 uint64_t ret_ref = (uint64_t)ret_var.inner;
18547 if (ret_var.is_owned) {
18553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18554 LDKDelayedPaymentOutputDescriptor obj_conv;
18555 obj_conv.inner = (void*)(obj & (~1));
18556 obj_conv.is_owned = false;
18557 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
18558 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18559 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18560 CVec_u8Z_free(ret_var);
18564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18565 LDKu8slice ser_ref;
18566 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18567 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18568 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18569 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
18570 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18571 return (uint64_t)ret_conv;
18574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18575 LDKStaticPaymentOutputDescriptor this_obj_conv;
18576 this_obj_conv.inner = (void*)(this_obj & (~1));
18577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18578 StaticPaymentOutputDescriptor_free(this_obj_conv);
18581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18582 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18584 this_ptr_conv.is_owned = false;
18585 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
18586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18588 uint64_t ret_ref = (uint64_t)ret_var.inner;
18589 if (ret_var.is_owned) {
18595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18596 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18598 this_ptr_conv.is_owned = false;
18599 LDKOutPoint val_conv;
18600 val_conv.inner = (void*)(val & (~1));
18601 val_conv.is_owned = (val & 1) || (val == 0);
18602 val_conv = OutPoint_clone(&val_conv);
18603 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
18606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18607 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18609 this_ptr_conv.is_owned = false;
18610 void* val_ptr = (void*)(((uint64_t)val) & ~1);
18611 CHECK_ACCESS(val_ptr);
18612 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
18613 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
18614 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
18617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18618 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18620 this_ptr_conv.is_owned = false;
18621 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18622 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
18626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18627 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18629 this_ptr_conv.is_owned = false;
18630 LDKThirtyTwoBytes val_ref;
18631 CHECK((*env)->GetArrayLength(env, val) == 32);
18632 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18633 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
18636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18637 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18639 this_ptr_conv.is_owned = false;
18640 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
18644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18645 LDKStaticPaymentOutputDescriptor this_ptr_conv;
18646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18647 this_ptr_conv.is_owned = false;
18648 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
18651 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) {
18652 LDKOutPoint outpoint_arg_conv;
18653 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18654 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18655 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18656 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
18657 CHECK_ACCESS(output_arg_ptr);
18658 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
18659 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
18660 LDKThirtyTwoBytes channel_keys_id_arg_ref;
18661 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
18662 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
18663 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
18664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18666 uint64_t ret_ref = (uint64_t)ret_var.inner;
18667 if (ret_var.is_owned) {
18673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18674 LDKStaticPaymentOutputDescriptor orig_conv;
18675 orig_conv.inner = (void*)(orig & (~1));
18676 orig_conv.is_owned = false;
18677 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
18678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18680 uint64_t ret_ref = (uint64_t)ret_var.inner;
18681 if (ret_var.is_owned) {
18687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18688 LDKStaticPaymentOutputDescriptor obj_conv;
18689 obj_conv.inner = (void*)(obj & (~1));
18690 obj_conv.is_owned = false;
18691 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
18692 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18693 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18694 CVec_u8Z_free(ret_var);
18698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18699 LDKu8slice ser_ref;
18700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18702 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18703 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
18704 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18705 return (uint64_t)ret_conv;
18708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18709 if ((this_ptr & 1) != 0) return;
18710 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18711 CHECK_ACCESS(this_ptr_ptr);
18712 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
18713 FREE((void*)this_ptr);
18714 SpendableOutputDescriptor_free(this_ptr_conv);
18717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18718 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
18719 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18720 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
18721 uint64_t ret_ref = (uint64_t)ret_copy;
18725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
18726 LDKOutPoint outpoint_conv;
18727 outpoint_conv.inner = (void*)(outpoint & (~1));
18728 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
18729 outpoint_conv = OutPoint_clone(&outpoint_conv);
18730 void* output_ptr = (void*)(((uint64_t)output) & ~1);
18731 CHECK_ACCESS(output_ptr);
18732 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
18733 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
18734 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18735 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
18736 uint64_t ret_ref = (uint64_t)ret_copy;
18740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
18741 LDKDelayedPaymentOutputDescriptor a_conv;
18742 a_conv.inner = (void*)(a & (~1));
18743 a_conv.is_owned = (a & 1) || (a == 0);
18744 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
18745 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18746 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
18747 uint64_t ret_ref = (uint64_t)ret_copy;
18751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
18752 LDKStaticPaymentOutputDescriptor a_conv;
18753 a_conv.inner = (void*)(a & (~1));
18754 a_conv.is_owned = (a & 1) || (a == 0);
18755 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
18756 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
18757 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
18758 uint64_t ret_ref = (uint64_t)ret_copy;
18762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
18763 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
18764 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
18765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18767 CVec_u8Z_free(ret_var);
18771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18772 LDKu8slice ser_ref;
18773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18775 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18776 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
18777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18778 return (uint64_t)ret_conv;
18781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18782 if ((this_ptr & 1) != 0) return;
18783 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18784 CHECK_ACCESS(this_ptr_ptr);
18785 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
18786 FREE((void*)this_ptr);
18787 BaseSign_free(this_ptr_conv);
18790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18791 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
18792 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
18793 LDKSign* orig_conv = (LDKSign*)orig_ptr;
18794 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
18795 *ret_ret = Sign_clone(orig_conv);
18796 return (uint64_t)ret_ret;
18799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18800 if ((this_ptr & 1) != 0) return;
18801 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18802 CHECK_ACCESS(this_ptr_ptr);
18803 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
18804 FREE((void*)this_ptr);
18805 Sign_free(this_ptr_conv);
18808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18809 if ((this_ptr & 1) != 0) return;
18810 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18811 CHECK_ACCESS(this_ptr_ptr);
18812 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
18813 FREE((void*)this_ptr);
18814 KeysInterface_free(this_ptr_conv);
18817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18818 LDKInMemorySigner this_obj_conv;
18819 this_obj_conv.inner = (void*)(this_obj & (~1));
18820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18821 InMemorySigner_free(this_obj_conv);
18824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18825 LDKInMemorySigner this_ptr_conv;
18826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18827 this_ptr_conv.is_owned = false;
18828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
18833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18834 LDKInMemorySigner this_ptr_conv;
18835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18836 this_ptr_conv.is_owned = false;
18837 LDKSecretKey val_ref;
18838 CHECK((*env)->GetArrayLength(env, val) == 32);
18839 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18840 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
18843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18844 LDKInMemorySigner this_ptr_conv;
18845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18846 this_ptr_conv.is_owned = false;
18847 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
18852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18853 LDKInMemorySigner this_ptr_conv;
18854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18855 this_ptr_conv.is_owned = false;
18856 LDKSecretKey val_ref;
18857 CHECK((*env)->GetArrayLength(env, val) == 32);
18858 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18859 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
18862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18863 LDKInMemorySigner this_ptr_conv;
18864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18865 this_ptr_conv.is_owned = false;
18866 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18867 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
18871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18872 LDKInMemorySigner this_ptr_conv;
18873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18874 this_ptr_conv.is_owned = false;
18875 LDKSecretKey val_ref;
18876 CHECK((*env)->GetArrayLength(env, val) == 32);
18877 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18878 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
18881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18882 LDKInMemorySigner this_ptr_conv;
18883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18884 this_ptr_conv.is_owned = false;
18885 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18886 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
18890 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) {
18891 LDKInMemorySigner this_ptr_conv;
18892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18893 this_ptr_conv.is_owned = false;
18894 LDKSecretKey val_ref;
18895 CHECK((*env)->GetArrayLength(env, val) == 32);
18896 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18897 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
18900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
18901 LDKInMemorySigner this_ptr_conv;
18902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18903 this_ptr_conv.is_owned = false;
18904 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18905 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
18909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18910 LDKInMemorySigner this_ptr_conv;
18911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18912 this_ptr_conv.is_owned = false;
18913 LDKSecretKey val_ref;
18914 CHECK((*env)->GetArrayLength(env, val) == 32);
18915 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
18916 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
18919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
18920 LDKInMemorySigner this_ptr_conv;
18921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18922 this_ptr_conv.is_owned = false;
18923 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18924 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
18928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18929 LDKInMemorySigner this_ptr_conv;
18930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18931 this_ptr_conv.is_owned = false;
18932 LDKThirtyTwoBytes val_ref;
18933 CHECK((*env)->GetArrayLength(env, val) == 32);
18934 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18935 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
18938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18939 LDKInMemorySigner orig_conv;
18940 orig_conv.inner = (void*)(orig & (~1));
18941 orig_conv.is_owned = false;
18942 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
18943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18945 uint64_t ret_ref = (uint64_t)ret_var.inner;
18946 if (ret_var.is_owned) {
18952 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) {
18953 LDKSecretKey funding_key_ref;
18954 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
18955 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
18956 LDKSecretKey revocation_base_key_ref;
18957 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
18958 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
18959 LDKSecretKey payment_key_ref;
18960 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
18961 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
18962 LDKSecretKey delayed_payment_base_key_ref;
18963 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
18964 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
18965 LDKSecretKey htlc_base_key_ref;
18966 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
18967 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
18968 LDKThirtyTwoBytes commitment_seed_ref;
18969 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
18970 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
18971 LDKThirtyTwoBytes channel_keys_id_ref;
18972 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
18973 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
18974 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);
18975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18977 uint64_t ret_ref = (uint64_t)ret_var.inner;
18978 if (ret_var.is_owned) {
18984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
18985 LDKInMemorySigner this_arg_conv;
18986 this_arg_conv.inner = (void*)(this_arg & (~1));
18987 this_arg_conv.is_owned = false;
18988 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
18989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18991 uint64_t ret_ref = (uint64_t)ret_var.inner;
18992 if (ret_var.is_owned) {
18998 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
18999 LDKInMemorySigner this_arg_conv;
19000 this_arg_conv.inner = (void*)(this_arg & (~1));
19001 this_arg_conv.is_owned = false;
19002 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
19006 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
19007 LDKInMemorySigner this_arg_conv;
19008 this_arg_conv.inner = (void*)(this_arg & (~1));
19009 this_arg_conv.is_owned = false;
19010 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
19014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
19015 LDKInMemorySigner this_arg_conv;
19016 this_arg_conv.inner = (void*)(this_arg & (~1));
19017 this_arg_conv.is_owned = false;
19018 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
19022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
19023 LDKInMemorySigner this_arg_conv;
19024 this_arg_conv.inner = (void*)(this_arg & (~1));
19025 this_arg_conv.is_owned = false;
19026 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
19027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19029 uint64_t ret_ref = (uint64_t)ret_var.inner;
19030 if (ret_var.is_owned) {
19036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
19037 LDKInMemorySigner this_arg_conv;
19038 this_arg_conv.inner = (void*)(this_arg & (~1));
19039 this_arg_conv.is_owned = false;
19040 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
19041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19043 uint64_t ret_ref = (uint64_t)ret_var.inner;
19044 if (ret_var.is_owned) {
19050 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) {
19051 LDKInMemorySigner this_arg_conv;
19052 this_arg_conv.inner = (void*)(this_arg & (~1));
19053 this_arg_conv.is_owned = false;
19054 LDKTransaction spend_tx_ref;
19055 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
19056 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
19057 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
19058 spend_tx_ref.data_is_owned = true;
19059 LDKStaticPaymentOutputDescriptor descriptor_conv;
19060 descriptor_conv.inner = (void*)(descriptor & (~1));
19061 descriptor_conv.is_owned = false;
19062 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19063 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
19064 return (uint64_t)ret_conv;
19067 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) {
19068 LDKInMemorySigner this_arg_conv;
19069 this_arg_conv.inner = (void*)(this_arg & (~1));
19070 this_arg_conv.is_owned = false;
19071 LDKTransaction spend_tx_ref;
19072 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
19073 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
19074 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
19075 spend_tx_ref.data_is_owned = true;
19076 LDKDelayedPaymentOutputDescriptor descriptor_conv;
19077 descriptor_conv.inner = (void*)(descriptor & (~1));
19078 descriptor_conv.is_owned = false;
19079 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19080 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
19081 return (uint64_t)ret_conv;
19084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
19085 LDKInMemorySigner this_arg_conv;
19086 this_arg_conv.inner = (void*)(this_arg & (~1));
19087 this_arg_conv.is_owned = false;
19088 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
19089 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
19090 return (uint64_t)ret_ret;
19093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
19094 LDKInMemorySigner this_arg_conv;
19095 this_arg_conv.inner = (void*)(this_arg & (~1));
19096 this_arg_conv.is_owned = false;
19097 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
19098 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
19099 return (uint64_t)ret_ret;
19102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
19103 LDKInMemorySigner obj_conv;
19104 obj_conv.inner = (void*)(obj & (~1));
19105 obj_conv.is_owned = false;
19106 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
19107 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19108 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19109 CVec_u8Z_free(ret_var);
19113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19114 LDKu8slice ser_ref;
19115 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19116 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19117 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19118 *ret_conv = InMemorySigner_read(ser_ref);
19119 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19120 return (uint64_t)ret_conv;
19123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19124 LDKKeysManager this_obj_conv;
19125 this_obj_conv.inner = (void*)(this_obj & (~1));
19126 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19127 KeysManager_free(this_obj_conv);
19130 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) {
19131 unsigned char seed_arr[32];
19132 CHECK((*env)->GetArrayLength(env, seed) == 32);
19133 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
19134 unsigned char (*seed_ref)[32] = &seed_arr;
19135 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
19136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19138 uint64_t ret_ref = (uint64_t)ret_var.inner;
19139 if (ret_var.is_owned) {
19145 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) {
19146 LDKKeysManager this_arg_conv;
19147 this_arg_conv.inner = (void*)(this_arg & (~1));
19148 this_arg_conv.is_owned = false;
19149 unsigned char params_arr[32];
19150 CHECK((*env)->GetArrayLength(env, params) == 32);
19151 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
19152 unsigned char (*params_ref)[32] = ¶ms_arr;
19153 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
19154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19156 uint64_t ret_ref = (uint64_t)ret_var.inner;
19157 if (ret_var.is_owned) {
19163 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) {
19164 LDKKeysManager this_arg_conv;
19165 this_arg_conv.inner = (void*)(this_arg & (~1));
19166 this_arg_conv.is_owned = false;
19167 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
19168 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
19169 if (descriptors_constr.datalen > 0)
19170 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19172 descriptors_constr.data = NULL;
19173 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
19174 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
19175 int64_t descriptors_conv_27 = descriptors_vals[b];
19176 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
19177 CHECK_ACCESS(descriptors_conv_27_ptr);
19178 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
19179 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
19180 descriptors_constr.data[b] = descriptors_conv_27_conv;
19182 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
19183 LDKCVec_TxOutZ outputs_constr;
19184 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
19185 if (outputs_constr.datalen > 0)
19186 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19188 outputs_constr.data = NULL;
19189 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
19190 for (size_t h = 0; h < outputs_constr.datalen; h++) {
19191 int64_t outputs_conv_7 = outputs_vals[h];
19192 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
19193 CHECK_ACCESS(outputs_conv_7_ptr);
19194 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
19195 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
19196 outputs_constr.data[h] = outputs_conv_7_conv;
19198 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
19199 LDKCVec_u8Z change_destination_script_ref;
19200 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
19201 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
19202 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
19203 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19204 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
19205 return (uint64_t)ret_conv;
19208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
19209 LDKKeysManager this_arg_conv;
19210 this_arg_conv.inner = (void*)(this_arg & (~1));
19211 this_arg_conv.is_owned = false;
19212 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
19213 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
19214 return (uint64_t)ret_ret;
19217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19218 LDKPaymentId this_obj_conv;
19219 this_obj_conv.inner = (void*)(this_obj & (~1));
19220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19221 PaymentId_free(this_obj_conv);
19224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash(JNIEnv *env, jclass clz, int64_t o) {
19225 LDKPaymentId o_conv;
19226 o_conv.inner = (void*)(o & (~1));
19227 o_conv.is_owned = false;
19228 int64_t ret_val = PaymentId_hash(&o_conv);
19232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19233 LDKPaymentId orig_conv;
19234 orig_conv.inner = (void*)(orig & (~1));
19235 orig_conv.is_owned = false;
19236 LDKPaymentId ret_var = PaymentId_clone(&orig_conv);
19237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19239 uint64_t ret_ref = (uint64_t)ret_var.inner;
19240 if (ret_var.is_owned) {
19246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
19247 LDKPaymentId a_conv;
19248 a_conv.inner = (void*)(a & (~1));
19249 a_conv.is_owned = false;
19250 LDKPaymentId b_conv;
19251 b_conv.inner = (void*)(b & (~1));
19252 b_conv.is_owned = false;
19253 jboolean ret_val = PaymentId_eq(&a_conv, &b_conv);
19257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write(JNIEnv *env, jclass clz, int64_t obj) {
19258 LDKPaymentId obj_conv;
19259 obj_conv.inner = (void*)(obj & (~1));
19260 obj_conv.is_owned = false;
19261 LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv);
19262 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19263 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19264 CVec_u8Z_free(ret_var);
19268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19269 LDKu8slice ser_ref;
19270 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19271 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19272 LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ");
19273 *ret_conv = PaymentId_read(ser_ref);
19274 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19275 return (uint64_t)ret_conv;
19278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19279 LDKChannelManager this_obj_conv;
19280 this_obj_conv.inner = (void*)(this_obj & (~1));
19281 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19282 ChannelManager_free(this_obj_conv);
19285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19286 LDKChainParameters this_obj_conv;
19287 this_obj_conv.inner = (void*)(this_obj & (~1));
19288 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19289 ChainParameters_free(this_obj_conv);
19292 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
19293 LDKChainParameters this_ptr_conv;
19294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19295 this_ptr_conv.is_owned = false;
19296 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
19300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
19301 LDKChainParameters this_ptr_conv;
19302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19303 this_ptr_conv.is_owned = false;
19304 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
19305 ChainParameters_set_network(&this_ptr_conv, val_conv);
19308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
19309 LDKChainParameters this_ptr_conv;
19310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19311 this_ptr_conv.is_owned = false;
19312 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
19313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19315 uint64_t ret_ref = (uint64_t)ret_var.inner;
19316 if (ret_var.is_owned) {
19322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19323 LDKChainParameters this_ptr_conv;
19324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19325 this_ptr_conv.is_owned = false;
19326 LDKBestBlock val_conv;
19327 val_conv.inner = (void*)(val & (~1));
19328 val_conv.is_owned = (val & 1) || (val == 0);
19329 val_conv = BestBlock_clone(&val_conv);
19330 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
19333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
19334 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
19335 LDKBestBlock best_block_arg_conv;
19336 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
19337 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
19338 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
19339 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
19340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19342 uint64_t ret_ref = (uint64_t)ret_var.inner;
19343 if (ret_var.is_owned) {
19349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19350 LDKChainParameters orig_conv;
19351 orig_conv.inner = (void*)(orig & (~1));
19352 orig_conv.is_owned = false;
19353 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
19354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19356 uint64_t ret_ref = (uint64_t)ret_var.inner;
19357 if (ret_var.is_owned) {
19363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19364 LDKCounterpartyForwardingInfo this_obj_conv;
19365 this_obj_conv.inner = (void*)(this_obj & (~1));
19366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19367 CounterpartyForwardingInfo_free(this_obj_conv);
19370 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19371 LDKCounterpartyForwardingInfo this_ptr_conv;
19372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19373 this_ptr_conv.is_owned = false;
19374 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
19378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19379 LDKCounterpartyForwardingInfo this_ptr_conv;
19380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19381 this_ptr_conv.is_owned = false;
19382 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
19385 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19386 LDKCounterpartyForwardingInfo this_ptr_conv;
19387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19388 this_ptr_conv.is_owned = false;
19389 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
19393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19394 LDKCounterpartyForwardingInfo this_ptr_conv;
19395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19396 this_ptr_conv.is_owned = false;
19397 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
19400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19401 LDKCounterpartyForwardingInfo this_ptr_conv;
19402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19403 this_ptr_conv.is_owned = false;
19404 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
19408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19409 LDKCounterpartyForwardingInfo this_ptr_conv;
19410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19411 this_ptr_conv.is_owned = false;
19412 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
19415 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) {
19416 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
19417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19419 uint64_t ret_ref = (uint64_t)ret_var.inner;
19420 if (ret_var.is_owned) {
19426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19427 LDKCounterpartyForwardingInfo orig_conv;
19428 orig_conv.inner = (void*)(orig & (~1));
19429 orig_conv.is_owned = false;
19430 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
19431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19433 uint64_t ret_ref = (uint64_t)ret_var.inner;
19434 if (ret_var.is_owned) {
19440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19441 LDKChannelCounterparty this_obj_conv;
19442 this_obj_conv.inner = (void*)(this_obj & (~1));
19443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19444 ChannelCounterparty_free(this_obj_conv);
19447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19448 LDKChannelCounterparty this_ptr_conv;
19449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19450 this_ptr_conv.is_owned = false;
19451 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19452 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
19456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19457 LDKChannelCounterparty this_ptr_conv;
19458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19459 this_ptr_conv.is_owned = false;
19460 LDKPublicKey val_ref;
19461 CHECK((*env)->GetArrayLength(env, val) == 33);
19462 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19463 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
19466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19467 LDKChannelCounterparty this_ptr_conv;
19468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19469 this_ptr_conv.is_owned = false;
19470 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
19471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19473 uint64_t ret_ref = (uint64_t)ret_var.inner;
19474 if (ret_var.is_owned) {
19480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19481 LDKChannelCounterparty this_ptr_conv;
19482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19483 this_ptr_conv.is_owned = false;
19484 LDKInitFeatures val_conv;
19485 val_conv.inner = (void*)(val & (~1));
19486 val_conv.is_owned = (val & 1) || (val == 0);
19487 val_conv = InitFeatures_clone(&val_conv);
19488 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
19491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
19492 LDKChannelCounterparty this_ptr_conv;
19493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19494 this_ptr_conv.is_owned = false;
19495 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
19499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19500 LDKChannelCounterparty this_ptr_conv;
19501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19502 this_ptr_conv.is_owned = false;
19503 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
19506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
19507 LDKChannelCounterparty this_ptr_conv;
19508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19509 this_ptr_conv.is_owned = false;
19510 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
19511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19513 uint64_t ret_ref = (uint64_t)ret_var.inner;
19514 if (ret_var.is_owned) {
19520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19521 LDKChannelCounterparty this_ptr_conv;
19522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19523 this_ptr_conv.is_owned = false;
19524 LDKCounterpartyForwardingInfo val_conv;
19525 val_conv.inner = (void*)(val & (~1));
19526 val_conv.is_owned = (val & 1) || (val == 0);
19527 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
19528 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
19531 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) {
19532 LDKPublicKey node_id_arg_ref;
19533 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
19534 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
19535 LDKInitFeatures features_arg_conv;
19536 features_arg_conv.inner = (void*)(features_arg & (~1));
19537 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19538 features_arg_conv = InitFeatures_clone(&features_arg_conv);
19539 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
19540 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
19541 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
19542 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
19543 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
19544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19546 uint64_t ret_ref = (uint64_t)ret_var.inner;
19547 if (ret_var.is_owned) {
19553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19554 LDKChannelCounterparty orig_conv;
19555 orig_conv.inner = (void*)(orig & (~1));
19556 orig_conv.is_owned = false;
19557 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
19558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19560 uint64_t ret_ref = (uint64_t)ret_var.inner;
19561 if (ret_var.is_owned) {
19567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19568 LDKChannelDetails this_obj_conv;
19569 this_obj_conv.inner = (void*)(this_obj & (~1));
19570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19571 ChannelDetails_free(this_obj_conv);
19574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19575 LDKChannelDetails this_ptr_conv;
19576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19577 this_ptr_conv.is_owned = false;
19578 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
19583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19584 LDKChannelDetails this_ptr_conv;
19585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19586 this_ptr_conv.is_owned = false;
19587 LDKThirtyTwoBytes val_ref;
19588 CHECK((*env)->GetArrayLength(env, val) == 32);
19589 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19590 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
19593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
19594 LDKChannelDetails this_ptr_conv;
19595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19596 this_ptr_conv.is_owned = false;
19597 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
19598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19600 uint64_t ret_ref = (uint64_t)ret_var.inner;
19601 if (ret_var.is_owned) {
19607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19608 LDKChannelDetails this_ptr_conv;
19609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19610 this_ptr_conv.is_owned = false;
19611 LDKChannelCounterparty val_conv;
19612 val_conv.inner = (void*)(val & (~1));
19613 val_conv.is_owned = (val & 1) || (val == 0);
19614 val_conv = ChannelCounterparty_clone(&val_conv);
19615 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
19618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
19619 LDKChannelDetails this_ptr_conv;
19620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19621 this_ptr_conv.is_owned = false;
19622 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
19623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19625 uint64_t ret_ref = (uint64_t)ret_var.inner;
19626 if (ret_var.is_owned) {
19632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19633 LDKChannelDetails this_ptr_conv;
19634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19635 this_ptr_conv.is_owned = false;
19636 LDKOutPoint val_conv;
19637 val_conv.inner = (void*)(val & (~1));
19638 val_conv.is_owned = (val & 1) || (val == 0);
19639 val_conv = OutPoint_clone(&val_conv);
19640 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
19643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19644 LDKChannelDetails this_ptr_conv;
19645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19646 this_ptr_conv.is_owned = false;
19647 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19648 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
19649 uint64_t ret_ref = (uint64_t)ret_copy;
19653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19654 LDKChannelDetails this_ptr_conv;
19655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19656 this_ptr_conv.is_owned = false;
19657 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19658 CHECK_ACCESS(val_ptr);
19659 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
19660 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
19661 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
19664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19665 LDKChannelDetails this_ptr_conv;
19666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19667 this_ptr_conv.is_owned = false;
19668 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
19672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19673 LDKChannelDetails this_ptr_conv;
19674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19675 this_ptr_conv.is_owned = false;
19676 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
19679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
19680 LDKChannelDetails this_ptr_conv;
19681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19682 this_ptr_conv.is_owned = false;
19683 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19684 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
19685 uint64_t ret_ref = (uint64_t)ret_copy;
19689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19690 LDKChannelDetails this_ptr_conv;
19691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19692 this_ptr_conv.is_owned = false;
19693 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19694 CHECK_ACCESS(val_ptr);
19695 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
19696 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
19697 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
19700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19701 LDKChannelDetails this_ptr_conv;
19702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19703 this_ptr_conv.is_owned = false;
19704 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
19708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19709 LDKChannelDetails this_ptr_conv;
19710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19711 this_ptr_conv.is_owned = false;
19712 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
19715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19716 LDKChannelDetails this_ptr_conv;
19717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19718 this_ptr_conv.is_owned = false;
19719 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
19723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19724 LDKChannelDetails this_ptr_conv;
19725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19726 this_ptr_conv.is_owned = false;
19727 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
19730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19731 LDKChannelDetails this_ptr_conv;
19732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19733 this_ptr_conv.is_owned = false;
19734 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
19738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19739 LDKChannelDetails this_ptr_conv;
19740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19741 this_ptr_conv.is_owned = false;
19742 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
19745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
19746 LDKChannelDetails this_ptr_conv;
19747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19748 this_ptr_conv.is_owned = false;
19749 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19750 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
19751 uint64_t ret_ref = (uint64_t)ret_copy;
19755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19756 LDKChannelDetails this_ptr_conv;
19757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19758 this_ptr_conv.is_owned = false;
19759 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19760 CHECK_ACCESS(val_ptr);
19761 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
19762 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
19763 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
19766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19767 LDKChannelDetails this_ptr_conv;
19768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19769 this_ptr_conv.is_owned = false;
19770 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19771 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
19772 uint64_t ret_ref = (uint64_t)ret_copy;
19776 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) {
19777 LDKChannelDetails this_ptr_conv;
19778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19779 this_ptr_conv.is_owned = false;
19780 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19781 CHECK_ACCESS(val_ptr);
19782 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
19783 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
19784 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
19787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
19788 LDKChannelDetails this_ptr_conv;
19789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19790 this_ptr_conv.is_owned = false;
19791 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
19795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19796 LDKChannelDetails this_ptr_conv;
19797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19798 this_ptr_conv.is_owned = false;
19799 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
19802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
19803 LDKChannelDetails this_ptr_conv;
19804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19805 this_ptr_conv.is_owned = false;
19806 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
19810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19811 LDKChannelDetails this_ptr_conv;
19812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19813 this_ptr_conv.is_owned = false;
19814 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
19817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
19818 LDKChannelDetails this_ptr_conv;
19819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19820 this_ptr_conv.is_owned = false;
19821 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
19825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19826 LDKChannelDetails this_ptr_conv;
19827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19828 this_ptr_conv.is_owned = false;
19829 ChannelDetails_set_is_usable(&this_ptr_conv, val);
19832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
19833 LDKChannelDetails this_ptr_conv;
19834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19835 this_ptr_conv.is_owned = false;
19836 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
19840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19841 LDKChannelDetails this_ptr_conv;
19842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19843 this_ptr_conv.is_owned = false;
19844 ChannelDetails_set_is_public(&this_ptr_conv, val);
19847 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) {
19848 LDKThirtyTwoBytes channel_id_arg_ref;
19849 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19850 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19851 LDKChannelCounterparty counterparty_arg_conv;
19852 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
19853 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
19854 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
19855 LDKOutPoint funding_txo_arg_conv;
19856 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
19857 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
19858 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
19859 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
19860 CHECK_ACCESS(short_channel_id_arg_ptr);
19861 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
19862 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
19863 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
19864 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
19865 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
19866 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
19867 CHECK_ACCESS(confirmations_required_arg_ptr);
19868 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
19869 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
19870 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
19871 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
19872 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
19873 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
19874 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);
19875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19877 uint64_t ret_ref = (uint64_t)ret_var.inner;
19878 if (ret_var.is_owned) {
19884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19885 LDKChannelDetails orig_conv;
19886 orig_conv.inner = (void*)(orig & (~1));
19887 orig_conv.is_owned = false;
19888 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
19889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19891 uint64_t ret_ref = (uint64_t)ret_var.inner;
19892 if (ret_var.is_owned) {
19898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19899 if ((this_ptr & 1) != 0) return;
19900 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19901 CHECK_ACCESS(this_ptr_ptr);
19902 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
19903 FREE((void*)this_ptr);
19904 PaymentSendFailure_free(this_ptr_conv);
19907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19908 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
19909 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19910 *ret_copy = PaymentSendFailure_clone(orig_conv);
19911 uint64_t ret_ref = (uint64_t)ret_copy;
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
19916 void* a_ptr = (void*)(((uint64_t)a) & ~1);
19917 CHECK_ACCESS(a_ptr);
19918 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
19919 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
19920 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19921 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
19922 uint64_t ret_ref = (uint64_t)ret_copy;
19926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
19927 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
19928 a_constr.datalen = (*env)->GetArrayLength(env, a);
19929 if (a_constr.datalen > 0)
19930 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19932 a_constr.data = NULL;
19933 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19934 for (size_t w = 0; w < a_constr.datalen; w++) {
19935 int64_t a_conv_22 = a_vals[w];
19936 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
19937 CHECK_ACCESS(a_conv_22_ptr);
19938 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
19939 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
19940 a_constr.data[w] = a_conv_22_conv;
19942 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19943 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19944 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
19945 uint64_t ret_ref = (uint64_t)ret_copy;
19949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
19950 LDKCVec_APIErrorZ a_constr;
19951 a_constr.datalen = (*env)->GetArrayLength(env, a);
19952 if (a_constr.datalen > 0)
19953 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19955 a_constr.data = NULL;
19956 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19957 for (size_t k = 0; k < a_constr.datalen; k++) {
19958 int64_t a_conv_10 = a_vals[k];
19959 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
19960 CHECK_ACCESS(a_conv_10_ptr);
19961 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
19962 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
19963 a_constr.data[k] = a_conv_10_conv;
19965 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19966 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19967 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
19968 uint64_t ret_ref = (uint64_t)ret_copy;
19972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
19973 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
19974 a_constr.datalen = (*env)->GetArrayLength(env, a);
19975 if (a_constr.datalen > 0)
19976 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19978 a_constr.data = NULL;
19979 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
19980 for (size_t w = 0; w < a_constr.datalen; w++) {
19981 int64_t a_conv_22 = a_vals[w];
19982 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
19983 CHECK_ACCESS(a_conv_22_ptr);
19984 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
19985 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
19986 a_constr.data[w] = a_conv_22_conv;
19988 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
19989 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
19990 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
19991 uint64_t ret_ref = (uint64_t)ret_copy;
19995 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) {
19996 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
19997 CHECK_ACCESS(fee_est_ptr);
19998 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
19999 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
20000 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20001 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
20003 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
20004 CHECK_ACCESS(chain_monitor_ptr);
20005 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
20006 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
20007 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20008 LDKWatch_JCalls_cloned(&chain_monitor_conv);
20010 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
20011 CHECK_ACCESS(tx_broadcaster_ptr);
20012 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
20013 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
20014 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20015 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
20017 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
20018 CHECK_ACCESS(logger_ptr);
20019 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
20020 if (logger_conv.free == LDKLogger_JCalls_free) {
20021 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20022 LDKLogger_JCalls_cloned(&logger_conv);
20024 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
20025 CHECK_ACCESS(keys_manager_ptr);
20026 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
20027 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
20028 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20029 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
20031 LDKUserConfig config_conv;
20032 config_conv.inner = (void*)(config & (~1));
20033 config_conv.is_owned = (config & 1) || (config == 0);
20034 config_conv = UserConfig_clone(&config_conv);
20035 LDKChainParameters params_conv;
20036 params_conv.inner = (void*)(params & (~1));
20037 params_conv.is_owned = (params & 1) || (params == 0);
20038 params_conv = ChainParameters_clone(¶ms_conv);
20039 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
20040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20042 uint64_t ret_ref = (uint64_t)ret_var.inner;
20043 if (ret_var.is_owned) {
20049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
20050 LDKChannelManager this_arg_conv;
20051 this_arg_conv.inner = (void*)(this_arg & (~1));
20052 this_arg_conv.is_owned = false;
20053 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
20054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20056 uint64_t ret_ref = (uint64_t)ret_var.inner;
20057 if (ret_var.is_owned) {
20063 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) {
20064 LDKChannelManager this_arg_conv;
20065 this_arg_conv.inner = (void*)(this_arg & (~1));
20066 this_arg_conv.is_owned = false;
20067 LDKPublicKey their_network_key_ref;
20068 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
20069 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
20070 LDKUserConfig override_config_conv;
20071 override_config_conv.inner = (void*)(override_config & (~1));
20072 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
20073 override_config_conv = UserConfig_clone(&override_config_conv);
20074 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20075 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
20076 return (uint64_t)ret_conv;
20079 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
20080 LDKChannelManager this_arg_conv;
20081 this_arg_conv.inner = (void*)(this_arg & (~1));
20082 this_arg_conv.is_owned = false;
20083 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
20084 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20085 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20086 for (size_t q = 0; q < ret_var.datalen; q++) {
20087 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
20088 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20089 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20090 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
20091 if (ret_conv_16_var.is_owned) {
20092 ret_conv_16_ref |= 1;
20094 ret_arr_ptr[q] = ret_conv_16_ref;
20096 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20097 FREE(ret_var.data);
20101 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
20102 LDKChannelManager this_arg_conv;
20103 this_arg_conv.inner = (void*)(this_arg & (~1));
20104 this_arg_conv.is_owned = false;
20105 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
20106 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20107 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20108 for (size_t q = 0; q < ret_var.datalen; q++) {
20109 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
20110 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20111 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20112 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
20113 if (ret_conv_16_var.is_owned) {
20114 ret_conv_16_ref |= 1;
20116 ret_arr_ptr[q] = ret_conv_16_ref;
20118 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20119 FREE(ret_var.data);
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
20124 LDKChannelManager this_arg_conv;
20125 this_arg_conv.inner = (void*)(this_arg & (~1));
20126 this_arg_conv.is_owned = false;
20127 unsigned char channel_id_arr[32];
20128 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
20129 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
20130 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
20131 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20132 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
20133 return (uint64_t)ret_conv;
20136 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) {
20137 LDKChannelManager this_arg_conv;
20138 this_arg_conv.inner = (void*)(this_arg & (~1));
20139 this_arg_conv.is_owned = false;
20140 unsigned char channel_id_arr[32];
20141 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
20142 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
20143 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
20144 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20145 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
20146 return (uint64_t)ret_conv;
20149 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) {
20150 LDKChannelManager this_arg_conv;
20151 this_arg_conv.inner = (void*)(this_arg & (~1));
20152 this_arg_conv.is_owned = false;
20153 unsigned char channel_id_arr[32];
20154 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
20155 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
20156 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
20157 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20158 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
20159 return (uint64_t)ret_conv;
20162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
20163 LDKChannelManager this_arg_conv;
20164 this_arg_conv.inner = (void*)(this_arg & (~1));
20165 this_arg_conv.is_owned = false;
20166 ChannelManager_force_close_all_channels(&this_arg_conv);
20169 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) {
20170 LDKChannelManager this_arg_conv;
20171 this_arg_conv.inner = (void*)(this_arg & (~1));
20172 this_arg_conv.is_owned = false;
20173 LDKRoute route_conv;
20174 route_conv.inner = (void*)(route & (~1));
20175 route_conv.is_owned = false;
20176 LDKThirtyTwoBytes payment_hash_ref;
20177 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20178 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20179 LDKThirtyTwoBytes payment_secret_ref;
20180 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
20181 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
20182 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
20183 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
20184 return (uint64_t)ret_conv;
20187 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) {
20188 LDKChannelManager this_arg_conv;
20189 this_arg_conv.inner = (void*)(this_arg & (~1));
20190 this_arg_conv.is_owned = false;
20191 LDKRoute route_conv;
20192 route_conv.inner = (void*)(route & (~1));
20193 route_conv.is_owned = false;
20194 LDKPaymentId payment_id_conv;
20195 payment_id_conv.inner = (void*)(payment_id & (~1));
20196 payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0);
20197 payment_id_conv = PaymentId_clone(&payment_id_conv);
20198 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20199 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv);
20200 return (uint64_t)ret_conv;
20203 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) {
20204 LDKChannelManager this_arg_conv;
20205 this_arg_conv.inner = (void*)(this_arg & (~1));
20206 this_arg_conv.is_owned = false;
20207 LDKRoute route_conv;
20208 route_conv.inner = (void*)(route & (~1));
20209 route_conv.is_owned = false;
20210 LDKThirtyTwoBytes payment_preimage_ref;
20211 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
20212 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
20213 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20214 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
20215 return (uint64_t)ret_conv;
20218 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) {
20219 LDKChannelManager this_arg_conv;
20220 this_arg_conv.inner = (void*)(this_arg & (~1));
20221 this_arg_conv.is_owned = false;
20222 unsigned char temporary_channel_id_arr[32];
20223 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
20224 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
20225 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
20226 LDKTransaction funding_transaction_ref;
20227 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
20228 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
20229 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
20230 funding_transaction_ref.data_is_owned = true;
20231 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20232 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
20233 return (uint64_t)ret_conv;
20236 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) {
20237 LDKChannelManager this_arg_conv;
20238 this_arg_conv.inner = (void*)(this_arg & (~1));
20239 this_arg_conv.is_owned = false;
20240 LDKThreeBytes rgb_ref;
20241 CHECK((*env)->GetArrayLength(env, rgb) == 3);
20242 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
20243 LDKThirtyTwoBytes alias_ref;
20244 CHECK((*env)->GetArrayLength(env, alias) == 32);
20245 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
20246 LDKCVec_NetAddressZ addresses_constr;
20247 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
20248 if (addresses_constr.datalen > 0)
20249 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20251 addresses_constr.data = NULL;
20252 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
20253 for (size_t m = 0; m < addresses_constr.datalen; m++) {
20254 int64_t addresses_conv_12 = addresses_vals[m];
20255 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
20256 CHECK_ACCESS(addresses_conv_12_ptr);
20257 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
20258 addresses_constr.data[m] = addresses_conv_12_conv;
20260 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
20261 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
20264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
20265 LDKChannelManager this_arg_conv;
20266 this_arg_conv.inner = (void*)(this_arg & (~1));
20267 this_arg_conv.is_owned = false;
20268 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
20271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20272 LDKChannelManager this_arg_conv;
20273 this_arg_conv.inner = (void*)(this_arg & (~1));
20274 this_arg_conv.is_owned = false;
20275 ChannelManager_timer_tick_occurred(&this_arg_conv);
20278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
20279 LDKChannelManager this_arg_conv;
20280 this_arg_conv.inner = (void*)(this_arg & (~1));
20281 this_arg_conv.is_owned = false;
20282 unsigned char payment_hash_arr[32];
20283 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20284 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
20285 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
20286 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
20290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
20291 LDKChannelManager this_arg_conv;
20292 this_arg_conv.inner = (void*)(this_arg & (~1));
20293 this_arg_conv.is_owned = false;
20294 LDKThirtyTwoBytes payment_preimage_ref;
20295 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
20296 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
20297 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
20301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
20302 LDKChannelManager this_arg_conv;
20303 this_arg_conv.inner = (void*)(this_arg & (~1));
20304 this_arg_conv.is_owned = false;
20305 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20306 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
20310 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) {
20311 LDKChannelManager this_arg_conv;
20312 this_arg_conv.inner = (void*)(this_arg & (~1));
20313 this_arg_conv.is_owned = false;
20314 LDKOutPoint funding_txo_conv;
20315 funding_txo_conv.inner = (void*)(funding_txo & (~1));
20316 funding_txo_conv.is_owned = false;
20317 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
20320 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) {
20321 LDKChannelManager this_arg_conv;
20322 this_arg_conv.inner = (void*)(this_arg & (~1));
20323 this_arg_conv.is_owned = false;
20324 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
20325 CHECK_ACCESS(min_value_msat_ptr);
20326 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
20327 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
20328 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20329 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
20330 return ((uint64_t)ret_conv);
20333 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) {
20334 LDKChannelManager this_arg_conv;
20335 this_arg_conv.inner = (void*)(this_arg & (~1));
20336 this_arg_conv.is_owned = false;
20337 LDKThirtyTwoBytes payment_hash_ref;
20338 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
20339 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
20340 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
20341 CHECK_ACCESS(min_value_msat_ptr);
20342 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
20343 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
20344 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20345 *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);
20346 return (uint64_t)ret_conv;
20349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20350 LDKChannelManager this_arg_conv;
20351 this_arg_conv.inner = (void*)(this_arg & (~1));
20352 this_arg_conv.is_owned = false;
20353 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20354 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
20355 return (uint64_t)ret_ret;
20358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20359 LDKChannelManager this_arg_conv;
20360 this_arg_conv.inner = (void*)(this_arg & (~1));
20361 this_arg_conv.is_owned = false;
20362 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
20363 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
20364 return (uint64_t)ret_ret;
20367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
20368 LDKChannelManager this_arg_conv;
20369 this_arg_conv.inner = (void*)(this_arg & (~1));
20370 this_arg_conv.is_owned = false;
20371 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
20372 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
20373 return (uint64_t)ret_ret;
20376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
20377 LDKChannelManager this_arg_conv;
20378 this_arg_conv.inner = (void*)(this_arg & (~1));
20379 this_arg_conv.is_owned = false;
20380 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
20381 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
20382 return (uint64_t)ret_ret;
20385 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) {
20386 LDKChannelManager this_arg_conv;
20387 this_arg_conv.inner = (void*)(this_arg & (~1));
20388 this_arg_conv.is_owned = false;
20389 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
20393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
20394 LDKChannelManager this_arg_conv;
20395 this_arg_conv.inner = (void*)(this_arg & (~1));
20396 this_arg_conv.is_owned = false;
20397 ChannelManager_await_persistable_update(&this_arg_conv);
20400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
20401 LDKChannelManager this_arg_conv;
20402 this_arg_conv.inner = (void*)(this_arg & (~1));
20403 this_arg_conv.is_owned = false;
20404 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
20405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20407 uint64_t ret_ref = (uint64_t)ret_var.inner;
20408 if (ret_var.is_owned) {
20414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20415 LDKChannelManager this_arg_conv;
20416 this_arg_conv.inner = (void*)(this_arg & (~1));
20417 this_arg_conv.is_owned = false;
20418 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20419 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
20420 return (uint64_t)ret_ret;
20423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
20424 LDKChannelManager obj_conv;
20425 obj_conv.inner = (void*)(obj & (~1));
20426 obj_conv.is_owned = false;
20427 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
20428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20430 CVec_u8Z_free(ret_var);
20434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20435 LDKChannelManagerReadArgs this_obj_conv;
20436 this_obj_conv.inner = (void*)(this_obj & (~1));
20437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20438 ChannelManagerReadArgs_free(this_obj_conv);
20441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
20442 LDKChannelManagerReadArgs this_ptr_conv;
20443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20444 this_ptr_conv.is_owned = false;
20445 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
20449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20450 LDKChannelManagerReadArgs this_ptr_conv;
20451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20452 this_ptr_conv.is_owned = false;
20453 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20454 CHECK_ACCESS(val_ptr);
20455 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
20456 if (val_conv.free == LDKKeysInterface_JCalls_free) {
20457 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20458 LDKKeysInterface_JCalls_cloned(&val_conv);
20460 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
20463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
20464 LDKChannelManagerReadArgs this_ptr_conv;
20465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20466 this_ptr_conv.is_owned = false;
20467 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
20471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20472 LDKChannelManagerReadArgs this_ptr_conv;
20473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20474 this_ptr_conv.is_owned = false;
20475 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20476 CHECK_ACCESS(val_ptr);
20477 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
20478 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
20479 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20480 LDKFeeEstimator_JCalls_cloned(&val_conv);
20482 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
20485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
20486 LDKChannelManagerReadArgs this_ptr_conv;
20487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20488 this_ptr_conv.is_owned = false;
20489 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
20493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20494 LDKChannelManagerReadArgs this_ptr_conv;
20495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20496 this_ptr_conv.is_owned = false;
20497 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20498 CHECK_ACCESS(val_ptr);
20499 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
20500 if (val_conv.free == LDKWatch_JCalls_free) {
20501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20502 LDKWatch_JCalls_cloned(&val_conv);
20504 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
20507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
20508 LDKChannelManagerReadArgs this_ptr_conv;
20509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20510 this_ptr_conv.is_owned = false;
20511 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
20515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20516 LDKChannelManagerReadArgs this_ptr_conv;
20517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20518 this_ptr_conv.is_owned = false;
20519 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20520 CHECK_ACCESS(val_ptr);
20521 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
20522 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
20523 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20524 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
20526 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
20529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
20530 LDKChannelManagerReadArgs this_ptr_conv;
20531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20532 this_ptr_conv.is_owned = false;
20533 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
20537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20538 LDKChannelManagerReadArgs this_ptr_conv;
20539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20540 this_ptr_conv.is_owned = false;
20541 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20542 CHECK_ACCESS(val_ptr);
20543 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
20544 if (val_conv.free == LDKLogger_JCalls_free) {
20545 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20546 LDKLogger_JCalls_cloned(&val_conv);
20548 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
20551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
20552 LDKChannelManagerReadArgs this_ptr_conv;
20553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20554 this_ptr_conv.is_owned = false;
20555 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
20556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20558 uint64_t ret_ref = (uint64_t)ret_var.inner;
20559 if (ret_var.is_owned) {
20565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20566 LDKChannelManagerReadArgs this_ptr_conv;
20567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20568 this_ptr_conv.is_owned = false;
20569 LDKUserConfig val_conv;
20570 val_conv.inner = (void*)(val & (~1));
20571 val_conv.is_owned = (val & 1) || (val == 0);
20572 val_conv = UserConfig_clone(&val_conv);
20573 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
20576 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) {
20577 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
20578 CHECK_ACCESS(keys_manager_ptr);
20579 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
20580 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
20581 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20582 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
20584 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
20585 CHECK_ACCESS(fee_estimator_ptr);
20586 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
20587 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
20588 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20589 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
20591 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
20592 CHECK_ACCESS(chain_monitor_ptr);
20593 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
20594 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
20595 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20596 LDKWatch_JCalls_cloned(&chain_monitor_conv);
20598 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
20599 CHECK_ACCESS(tx_broadcaster_ptr);
20600 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
20601 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
20602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20603 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
20605 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
20606 CHECK_ACCESS(logger_ptr);
20607 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
20608 if (logger_conv.free == LDKLogger_JCalls_free) {
20609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20610 LDKLogger_JCalls_cloned(&logger_conv);
20612 LDKUserConfig default_config_conv;
20613 default_config_conv.inner = (void*)(default_config & (~1));
20614 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
20615 default_config_conv = UserConfig_clone(&default_config_conv);
20616 LDKCVec_ChannelMonitorZ channel_monitors_constr;
20617 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
20618 if (channel_monitors_constr.datalen > 0)
20619 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20621 channel_monitors_constr.data = NULL;
20622 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
20623 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
20624 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
20625 LDKChannelMonitor channel_monitors_conv_16_conv;
20626 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
20627 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
20628 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
20630 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
20631 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);
20632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20634 uint64_t ret_ref = (uint64_t)ret_var.inner;
20635 if (ret_var.is_owned) {
20641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
20642 LDKu8slice ser_ref;
20643 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20644 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20645 LDKChannelManagerReadArgs arg_conv;
20646 arg_conv.inner = (void*)(arg & (~1));
20647 arg_conv.is_owned = (arg & 1) || (arg == 0);
20648 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
20649 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20650 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
20651 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20652 return (uint64_t)ret_conv;
20655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20656 LDKDecodeError this_obj_conv;
20657 this_obj_conv.inner = (void*)(this_obj & (~1));
20658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20659 DecodeError_free(this_obj_conv);
20662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20663 LDKDecodeError orig_conv;
20664 orig_conv.inner = (void*)(orig & (~1));
20665 orig_conv.is_owned = false;
20666 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
20667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20669 uint64_t ret_ref = (uint64_t)ret_var.inner;
20670 if (ret_var.is_owned) {
20676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20677 LDKInit this_obj_conv;
20678 this_obj_conv.inner = (void*)(this_obj & (~1));
20679 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20680 Init_free(this_obj_conv);
20683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20684 LDKInit this_ptr_conv;
20685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20686 this_ptr_conv.is_owned = false;
20687 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
20688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20690 uint64_t ret_ref = (uint64_t)ret_var.inner;
20691 if (ret_var.is_owned) {
20697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20698 LDKInit this_ptr_conv;
20699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20700 this_ptr_conv.is_owned = false;
20701 LDKInitFeatures val_conv;
20702 val_conv.inner = (void*)(val & (~1));
20703 val_conv.is_owned = (val & 1) || (val == 0);
20704 val_conv = InitFeatures_clone(&val_conv);
20705 Init_set_features(&this_ptr_conv, val_conv);
20708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
20709 LDKInitFeatures features_arg_conv;
20710 features_arg_conv.inner = (void*)(features_arg & (~1));
20711 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20712 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20713 LDKInit ret_var = Init_new(features_arg_conv);
20714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20716 uint64_t ret_ref = (uint64_t)ret_var.inner;
20717 if (ret_var.is_owned) {
20723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20725 orig_conv.inner = (void*)(orig & (~1));
20726 orig_conv.is_owned = false;
20727 LDKInit ret_var = Init_clone(&orig_conv);
20728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20730 uint64_t ret_ref = (uint64_t)ret_var.inner;
20731 if (ret_var.is_owned) {
20737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20738 LDKErrorMessage this_obj_conv;
20739 this_obj_conv.inner = (void*)(this_obj & (~1));
20740 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20741 ErrorMessage_free(this_obj_conv);
20744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20745 LDKErrorMessage this_ptr_conv;
20746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20747 this_ptr_conv.is_owned = false;
20748 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20749 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
20753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20754 LDKErrorMessage this_ptr_conv;
20755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20756 this_ptr_conv.is_owned = false;
20757 LDKThirtyTwoBytes val_ref;
20758 CHECK((*env)->GetArrayLength(env, val) == 32);
20759 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20760 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
20763 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
20764 LDKErrorMessage this_ptr_conv;
20765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20766 this_ptr_conv.is_owned = false;
20767 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
20768 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20774 LDKErrorMessage this_ptr_conv;
20775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20776 this_ptr_conv.is_owned = false;
20777 LDKStr val_conv = java_to_owned_str(env, val);
20778 ErrorMessage_set_data(&this_ptr_conv, val_conv);
20781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
20782 LDKThirtyTwoBytes channel_id_arg_ref;
20783 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20784 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20785 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
20786 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
20787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20789 uint64_t ret_ref = (uint64_t)ret_var.inner;
20790 if (ret_var.is_owned) {
20796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20797 LDKErrorMessage orig_conv;
20798 orig_conv.inner = (void*)(orig & (~1));
20799 orig_conv.is_owned = false;
20800 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
20801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20803 uint64_t ret_ref = (uint64_t)ret_var.inner;
20804 if (ret_var.is_owned) {
20810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20811 LDKPing this_obj_conv;
20812 this_obj_conv.inner = (void*)(this_obj & (~1));
20813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20814 Ping_free(this_obj_conv);
20817 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20818 LDKPing this_ptr_conv;
20819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20820 this_ptr_conv.is_owned = false;
20821 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
20825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20826 LDKPing this_ptr_conv;
20827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20828 this_ptr_conv.is_owned = false;
20829 Ping_set_ponglen(&this_ptr_conv, val);
20832 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20833 LDKPing this_ptr_conv;
20834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20835 this_ptr_conv.is_owned = false;
20836 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
20840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20841 LDKPing this_ptr_conv;
20842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20843 this_ptr_conv.is_owned = false;
20844 Ping_set_byteslen(&this_ptr_conv, val);
20847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
20848 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
20849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20851 uint64_t ret_ref = (uint64_t)ret_var.inner;
20852 if (ret_var.is_owned) {
20858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20860 orig_conv.inner = (void*)(orig & (~1));
20861 orig_conv.is_owned = false;
20862 LDKPing ret_var = Ping_clone(&orig_conv);
20863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20865 uint64_t ret_ref = (uint64_t)ret_var.inner;
20866 if (ret_var.is_owned) {
20872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20873 LDKPong this_obj_conv;
20874 this_obj_conv.inner = (void*)(this_obj & (~1));
20875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20876 Pong_free(this_obj_conv);
20879 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
20880 LDKPong this_ptr_conv;
20881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20882 this_ptr_conv.is_owned = false;
20883 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
20887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20888 LDKPong this_ptr_conv;
20889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20890 this_ptr_conv.is_owned = false;
20891 Pong_set_byteslen(&this_ptr_conv, val);
20894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
20895 LDKPong ret_var = Pong_new(byteslen_arg);
20896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20898 uint64_t ret_ref = (uint64_t)ret_var.inner;
20899 if (ret_var.is_owned) {
20905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20907 orig_conv.inner = (void*)(orig & (~1));
20908 orig_conv.is_owned = false;
20909 LDKPong ret_var = Pong_clone(&orig_conv);
20910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20912 uint64_t ret_ref = (uint64_t)ret_var.inner;
20913 if (ret_var.is_owned) {
20919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20920 LDKOpenChannel this_obj_conv;
20921 this_obj_conv.inner = (void*)(this_obj & (~1));
20922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20923 OpenChannel_free(this_obj_conv);
20926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20927 LDKOpenChannel this_ptr_conv;
20928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20929 this_ptr_conv.is_owned = false;
20930 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20931 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
20935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20936 LDKOpenChannel this_ptr_conv;
20937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20938 this_ptr_conv.is_owned = false;
20939 LDKThirtyTwoBytes val_ref;
20940 CHECK((*env)->GetArrayLength(env, val) == 32);
20941 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20942 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
20945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20946 LDKOpenChannel this_ptr_conv;
20947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20948 this_ptr_conv.is_owned = false;
20949 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
20954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20955 LDKOpenChannel this_ptr_conv;
20956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20957 this_ptr_conv.is_owned = false;
20958 LDKThirtyTwoBytes val_ref;
20959 CHECK((*env)->GetArrayLength(env, val) == 32);
20960 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20961 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
20964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20965 LDKOpenChannel this_ptr_conv;
20966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20967 this_ptr_conv.is_owned = false;
20968 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
20972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20973 LDKOpenChannel this_ptr_conv;
20974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20975 this_ptr_conv.is_owned = false;
20976 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
20979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20980 LDKOpenChannel this_ptr_conv;
20981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20982 this_ptr_conv.is_owned = false;
20983 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
20987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20988 LDKOpenChannel this_ptr_conv;
20989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20990 this_ptr_conv.is_owned = false;
20991 OpenChannel_set_push_msat(&this_ptr_conv, val);
20994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20995 LDKOpenChannel this_ptr_conv;
20996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20997 this_ptr_conv.is_owned = false;
20998 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
21002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21003 LDKOpenChannel this_ptr_conv;
21004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21005 this_ptr_conv.is_owned = false;
21006 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
21009 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) {
21010 LDKOpenChannel this_ptr_conv;
21011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21012 this_ptr_conv.is_owned = false;
21013 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
21017 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) {
21018 LDKOpenChannel this_ptr_conv;
21019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21020 this_ptr_conv.is_owned = false;
21021 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21025 LDKOpenChannel this_ptr_conv;
21026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21027 this_ptr_conv.is_owned = false;
21028 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
21032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21033 LDKOpenChannel this_ptr_conv;
21034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21035 this_ptr_conv.is_owned = false;
21036 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
21039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21040 LDKOpenChannel this_ptr_conv;
21041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21042 this_ptr_conv.is_owned = false;
21043 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
21047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21048 LDKOpenChannel this_ptr_conv;
21049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21050 this_ptr_conv.is_owned = false;
21051 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
21054 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
21055 LDKOpenChannel this_ptr_conv;
21056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21057 this_ptr_conv.is_owned = false;
21058 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
21062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21063 LDKOpenChannel this_ptr_conv;
21064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21065 this_ptr_conv.is_owned = false;
21066 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
21069 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21070 LDKOpenChannel this_ptr_conv;
21071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21072 this_ptr_conv.is_owned = false;
21073 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
21077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21078 LDKOpenChannel this_ptr_conv;
21079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21080 this_ptr_conv.is_owned = false;
21081 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
21084 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
21085 LDKOpenChannel this_ptr_conv;
21086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21087 this_ptr_conv.is_owned = false;
21088 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
21092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21093 LDKOpenChannel this_ptr_conv;
21094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21095 this_ptr_conv.is_owned = false;
21096 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
21099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21100 LDKOpenChannel this_ptr_conv;
21101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21102 this_ptr_conv.is_owned = false;
21103 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
21108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21109 LDKOpenChannel this_ptr_conv;
21110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21111 this_ptr_conv.is_owned = false;
21112 LDKPublicKey val_ref;
21113 CHECK((*env)->GetArrayLength(env, val) == 33);
21114 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21115 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
21118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21119 LDKOpenChannel this_ptr_conv;
21120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21121 this_ptr_conv.is_owned = false;
21122 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21128 LDKOpenChannel this_ptr_conv;
21129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21130 this_ptr_conv.is_owned = false;
21131 LDKPublicKey val_ref;
21132 CHECK((*env)->GetArrayLength(env, val) == 33);
21133 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21134 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
21137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21138 LDKOpenChannel this_ptr_conv;
21139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21140 this_ptr_conv.is_owned = false;
21141 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21142 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
21146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21147 LDKOpenChannel this_ptr_conv;
21148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21149 this_ptr_conv.is_owned = false;
21150 LDKPublicKey val_ref;
21151 CHECK((*env)->GetArrayLength(env, val) == 33);
21152 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21153 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
21156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21157 LDKOpenChannel this_ptr_conv;
21158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21159 this_ptr_conv.is_owned = false;
21160 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21161 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21166 LDKOpenChannel this_ptr_conv;
21167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21168 this_ptr_conv.is_owned = false;
21169 LDKPublicKey val_ref;
21170 CHECK((*env)->GetArrayLength(env, val) == 33);
21171 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21172 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21176 LDKOpenChannel this_ptr_conv;
21177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21178 this_ptr_conv.is_owned = false;
21179 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21185 LDKOpenChannel this_ptr_conv;
21186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21187 this_ptr_conv.is_owned = false;
21188 LDKPublicKey val_ref;
21189 CHECK((*env)->GetArrayLength(env, val) == 33);
21190 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21191 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
21194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21195 LDKOpenChannel this_ptr_conv;
21196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21197 this_ptr_conv.is_owned = false;
21198 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
21203 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) {
21204 LDKOpenChannel this_ptr_conv;
21205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21206 this_ptr_conv.is_owned = false;
21207 LDKPublicKey val_ref;
21208 CHECK((*env)->GetArrayLength(env, val) == 33);
21209 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21210 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
21213 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
21214 LDKOpenChannel this_ptr_conv;
21215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21216 this_ptr_conv.is_owned = false;
21217 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
21221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
21222 LDKOpenChannel this_ptr_conv;
21223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21224 this_ptr_conv.is_owned = false;
21225 OpenChannel_set_channel_flags(&this_ptr_conv, val);
21228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21229 LDKOpenChannel orig_conv;
21230 orig_conv.inner = (void*)(orig & (~1));
21231 orig_conv.is_owned = false;
21232 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
21233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21235 uint64_t ret_ref = (uint64_t)ret_var.inner;
21236 if (ret_var.is_owned) {
21242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21243 LDKAcceptChannel this_obj_conv;
21244 this_obj_conv.inner = (void*)(this_obj & (~1));
21245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21246 AcceptChannel_free(this_obj_conv);
21249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21250 LDKAcceptChannel this_ptr_conv;
21251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21252 this_ptr_conv.is_owned = false;
21253 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21254 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
21258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21259 LDKAcceptChannel this_ptr_conv;
21260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21261 this_ptr_conv.is_owned = false;
21262 LDKThirtyTwoBytes val_ref;
21263 CHECK((*env)->GetArrayLength(env, val) == 32);
21264 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21265 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
21268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21269 LDKAcceptChannel this_ptr_conv;
21270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21271 this_ptr_conv.is_owned = false;
21272 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
21276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21277 LDKAcceptChannel this_ptr_conv;
21278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21279 this_ptr_conv.is_owned = false;
21280 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
21283 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) {
21284 LDKAcceptChannel this_ptr_conv;
21285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21286 this_ptr_conv.is_owned = false;
21287 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
21291 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) {
21292 LDKAcceptChannel this_ptr_conv;
21293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21294 this_ptr_conv.is_owned = false;
21295 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
21298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21299 LDKAcceptChannel this_ptr_conv;
21300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21301 this_ptr_conv.is_owned = false;
21302 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
21306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21307 LDKAcceptChannel this_ptr_conv;
21308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21309 this_ptr_conv.is_owned = false;
21310 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
21313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21314 LDKAcceptChannel this_ptr_conv;
21315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21316 this_ptr_conv.is_owned = false;
21317 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
21321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21322 LDKAcceptChannel this_ptr_conv;
21323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21324 this_ptr_conv.is_owned = false;
21325 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
21328 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
21329 LDKAcceptChannel this_ptr_conv;
21330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21331 this_ptr_conv.is_owned = false;
21332 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
21336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21337 LDKAcceptChannel this_ptr_conv;
21338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21339 this_ptr_conv.is_owned = false;
21340 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
21343 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21344 LDKAcceptChannel this_ptr_conv;
21345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21346 this_ptr_conv.is_owned = false;
21347 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
21351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21352 LDKAcceptChannel this_ptr_conv;
21353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21354 this_ptr_conv.is_owned = false;
21355 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
21358 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
21359 LDKAcceptChannel this_ptr_conv;
21360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21361 this_ptr_conv.is_owned = false;
21362 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
21366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21367 LDKAcceptChannel this_ptr_conv;
21368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21369 this_ptr_conv.is_owned = false;
21370 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
21373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21374 LDKAcceptChannel this_ptr_conv;
21375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21376 this_ptr_conv.is_owned = false;
21377 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21378 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
21382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21383 LDKAcceptChannel this_ptr_conv;
21384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21385 this_ptr_conv.is_owned = false;
21386 LDKPublicKey val_ref;
21387 CHECK((*env)->GetArrayLength(env, val) == 33);
21388 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21389 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
21392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21393 LDKAcceptChannel this_ptr_conv;
21394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21395 this_ptr_conv.is_owned = false;
21396 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21397 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21402 LDKAcceptChannel this_ptr_conv;
21403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21404 this_ptr_conv.is_owned = false;
21405 LDKPublicKey val_ref;
21406 CHECK((*env)->GetArrayLength(env, val) == 33);
21407 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21408 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
21411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21412 LDKAcceptChannel this_ptr_conv;
21413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21414 this_ptr_conv.is_owned = false;
21415 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
21420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21421 LDKAcceptChannel this_ptr_conv;
21422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21423 this_ptr_conv.is_owned = false;
21424 LDKPublicKey val_ref;
21425 CHECK((*env)->GetArrayLength(env, val) == 33);
21426 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21427 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
21430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21431 LDKAcceptChannel this_ptr_conv;
21432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21433 this_ptr_conv.is_owned = false;
21434 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21440 LDKAcceptChannel this_ptr_conv;
21441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21442 this_ptr_conv.is_owned = false;
21443 LDKPublicKey val_ref;
21444 CHECK((*env)->GetArrayLength(env, val) == 33);
21445 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21446 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21450 LDKAcceptChannel this_ptr_conv;
21451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21452 this_ptr_conv.is_owned = false;
21453 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21459 LDKAcceptChannel this_ptr_conv;
21460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21461 this_ptr_conv.is_owned = false;
21462 LDKPublicKey val_ref;
21463 CHECK((*env)->GetArrayLength(env, val) == 33);
21464 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21465 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
21468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21469 LDKAcceptChannel this_ptr_conv;
21470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21471 this_ptr_conv.is_owned = false;
21472 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
21477 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) {
21478 LDKAcceptChannel this_ptr_conv;
21479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21480 this_ptr_conv.is_owned = false;
21481 LDKPublicKey val_ref;
21482 CHECK((*env)->GetArrayLength(env, val) == 33);
21483 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21484 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
21487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21488 LDKAcceptChannel orig_conv;
21489 orig_conv.inner = (void*)(orig & (~1));
21490 orig_conv.is_owned = false;
21491 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
21492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21494 uint64_t ret_ref = (uint64_t)ret_var.inner;
21495 if (ret_var.is_owned) {
21501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21502 LDKFundingCreated this_obj_conv;
21503 this_obj_conv.inner = (void*)(this_obj & (~1));
21504 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21505 FundingCreated_free(this_obj_conv);
21508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21509 LDKFundingCreated this_ptr_conv;
21510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21511 this_ptr_conv.is_owned = false;
21512 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21513 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
21517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21518 LDKFundingCreated this_ptr_conv;
21519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21520 this_ptr_conv.is_owned = false;
21521 LDKThirtyTwoBytes val_ref;
21522 CHECK((*env)->GetArrayLength(env, val) == 32);
21523 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21524 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
21527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
21528 LDKFundingCreated this_ptr_conv;
21529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21530 this_ptr_conv.is_owned = false;
21531 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21532 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
21536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21537 LDKFundingCreated this_ptr_conv;
21538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21539 this_ptr_conv.is_owned = false;
21540 LDKThirtyTwoBytes val_ref;
21541 CHECK((*env)->GetArrayLength(env, val) == 32);
21542 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21543 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
21546 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21547 LDKFundingCreated this_ptr_conv;
21548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21549 this_ptr_conv.is_owned = false;
21550 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
21554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21555 LDKFundingCreated this_ptr_conv;
21556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21557 this_ptr_conv.is_owned = false;
21558 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
21561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21562 LDKFundingCreated this_ptr_conv;
21563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21564 this_ptr_conv.is_owned = false;
21565 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21566 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
21570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21571 LDKFundingCreated this_ptr_conv;
21572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21573 this_ptr_conv.is_owned = false;
21574 LDKSignature val_ref;
21575 CHECK((*env)->GetArrayLength(env, val) == 64);
21576 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21577 FundingCreated_set_signature(&this_ptr_conv, val_ref);
21580 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) {
21581 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
21582 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
21583 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
21584 LDKThirtyTwoBytes funding_txid_arg_ref;
21585 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
21586 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
21587 LDKSignature signature_arg_ref;
21588 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21589 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21590 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
21591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21593 uint64_t ret_ref = (uint64_t)ret_var.inner;
21594 if (ret_var.is_owned) {
21600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21601 LDKFundingCreated orig_conv;
21602 orig_conv.inner = (void*)(orig & (~1));
21603 orig_conv.is_owned = false;
21604 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
21605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21607 uint64_t ret_ref = (uint64_t)ret_var.inner;
21608 if (ret_var.is_owned) {
21614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21615 LDKFundingSigned this_obj_conv;
21616 this_obj_conv.inner = (void*)(this_obj & (~1));
21617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21618 FundingSigned_free(this_obj_conv);
21621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21622 LDKFundingSigned this_ptr_conv;
21623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21624 this_ptr_conv.is_owned = false;
21625 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21626 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
21630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21631 LDKFundingSigned this_ptr_conv;
21632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21633 this_ptr_conv.is_owned = false;
21634 LDKThirtyTwoBytes val_ref;
21635 CHECK((*env)->GetArrayLength(env, val) == 32);
21636 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21637 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
21640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21641 LDKFundingSigned this_ptr_conv;
21642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21643 this_ptr_conv.is_owned = false;
21644 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21645 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
21649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21650 LDKFundingSigned this_ptr_conv;
21651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21652 this_ptr_conv.is_owned = false;
21653 LDKSignature val_ref;
21654 CHECK((*env)->GetArrayLength(env, val) == 64);
21655 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21656 FundingSigned_set_signature(&this_ptr_conv, val_ref);
21659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
21660 LDKThirtyTwoBytes channel_id_arg_ref;
21661 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21662 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21663 LDKSignature signature_arg_ref;
21664 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21665 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21666 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
21667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21669 uint64_t ret_ref = (uint64_t)ret_var.inner;
21670 if (ret_var.is_owned) {
21676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21677 LDKFundingSigned orig_conv;
21678 orig_conv.inner = (void*)(orig & (~1));
21679 orig_conv.is_owned = false;
21680 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
21681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21683 uint64_t ret_ref = (uint64_t)ret_var.inner;
21684 if (ret_var.is_owned) {
21690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21691 LDKFundingLocked this_obj_conv;
21692 this_obj_conv.inner = (void*)(this_obj & (~1));
21693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21694 FundingLocked_free(this_obj_conv);
21697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21698 LDKFundingLocked this_ptr_conv;
21699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21700 this_ptr_conv.is_owned = false;
21701 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21702 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
21706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21707 LDKFundingLocked this_ptr_conv;
21708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21709 this_ptr_conv.is_owned = false;
21710 LDKThirtyTwoBytes val_ref;
21711 CHECK((*env)->GetArrayLength(env, val) == 32);
21712 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21713 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
21716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21717 LDKFundingLocked this_ptr_conv;
21718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21719 this_ptr_conv.is_owned = false;
21720 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21721 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21725 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) {
21726 LDKFundingLocked this_ptr_conv;
21727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21728 this_ptr_conv.is_owned = false;
21729 LDKPublicKey val_ref;
21730 CHECK((*env)->GetArrayLength(env, val) == 33);
21731 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21732 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21735 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) {
21736 LDKThirtyTwoBytes channel_id_arg_ref;
21737 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21738 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21739 LDKPublicKey next_per_commitment_point_arg_ref;
21740 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21741 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21742 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
21743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21745 uint64_t ret_ref = (uint64_t)ret_var.inner;
21746 if (ret_var.is_owned) {
21752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21753 LDKFundingLocked orig_conv;
21754 orig_conv.inner = (void*)(orig & (~1));
21755 orig_conv.is_owned = false;
21756 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
21757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21759 uint64_t ret_ref = (uint64_t)ret_var.inner;
21760 if (ret_var.is_owned) {
21766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21767 LDKShutdown this_obj_conv;
21768 this_obj_conv.inner = (void*)(this_obj & (~1));
21769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21770 Shutdown_free(this_obj_conv);
21773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21774 LDKShutdown this_ptr_conv;
21775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21776 this_ptr_conv.is_owned = false;
21777 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21778 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
21782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21783 LDKShutdown this_ptr_conv;
21784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21785 this_ptr_conv.is_owned = false;
21786 LDKThirtyTwoBytes val_ref;
21787 CHECK((*env)->GetArrayLength(env, val) == 32);
21788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21789 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
21792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21793 LDKShutdown this_ptr_conv;
21794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21795 this_ptr_conv.is_owned = false;
21796 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
21797 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21798 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21803 LDKShutdown this_ptr_conv;
21804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21805 this_ptr_conv.is_owned = false;
21806 LDKCVec_u8Z val_ref;
21807 val_ref.datalen = (*env)->GetArrayLength(env, val);
21808 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21809 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
21810 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
21813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
21814 LDKThirtyTwoBytes channel_id_arg_ref;
21815 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21816 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21817 LDKCVec_u8Z scriptpubkey_arg_ref;
21818 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
21819 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21820 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
21821 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
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 int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21832 LDKShutdown orig_conv;
21833 orig_conv.inner = (void*)(orig & (~1));
21834 orig_conv.is_owned = false;
21835 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
21836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21837 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21838 uint64_t ret_ref = (uint64_t)ret_var.inner;
21839 if (ret_var.is_owned) {
21845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21846 LDKClosingSignedFeeRange this_obj_conv;
21847 this_obj_conv.inner = (void*)(this_obj & (~1));
21848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21849 ClosingSignedFeeRange_free(this_obj_conv);
21852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21853 LDKClosingSignedFeeRange this_ptr_conv;
21854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21855 this_ptr_conv.is_owned = false;
21856 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
21860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21861 LDKClosingSignedFeeRange this_ptr_conv;
21862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21863 this_ptr_conv.is_owned = false;
21864 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
21867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21868 LDKClosingSignedFeeRange this_ptr_conv;
21869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21870 this_ptr_conv.is_owned = false;
21871 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
21875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21876 LDKClosingSignedFeeRange this_ptr_conv;
21877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21878 this_ptr_conv.is_owned = false;
21879 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
21882 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) {
21883 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
21884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21886 uint64_t ret_ref = (uint64_t)ret_var.inner;
21887 if (ret_var.is_owned) {
21893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21894 LDKClosingSignedFeeRange orig_conv;
21895 orig_conv.inner = (void*)(orig & (~1));
21896 orig_conv.is_owned = false;
21897 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
21898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21900 uint64_t ret_ref = (uint64_t)ret_var.inner;
21901 if (ret_var.is_owned) {
21907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21908 LDKClosingSigned this_obj_conv;
21909 this_obj_conv.inner = (void*)(this_obj & (~1));
21910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21911 ClosingSigned_free(this_obj_conv);
21914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21915 LDKClosingSigned this_ptr_conv;
21916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21917 this_ptr_conv.is_owned = false;
21918 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
21923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21924 LDKClosingSigned this_ptr_conv;
21925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21926 this_ptr_conv.is_owned = false;
21927 LDKThirtyTwoBytes val_ref;
21928 CHECK((*env)->GetArrayLength(env, val) == 32);
21929 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21930 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
21933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21934 LDKClosingSigned this_ptr_conv;
21935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21936 this_ptr_conv.is_owned = false;
21937 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
21941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21942 LDKClosingSigned this_ptr_conv;
21943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21944 this_ptr_conv.is_owned = false;
21945 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
21948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21949 LDKClosingSigned this_ptr_conv;
21950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21951 this_ptr_conv.is_owned = false;
21952 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21953 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
21957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21958 LDKClosingSigned this_ptr_conv;
21959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21960 this_ptr_conv.is_owned = false;
21961 LDKSignature val_ref;
21962 CHECK((*env)->GetArrayLength(env, val) == 64);
21963 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21964 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
21967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
21968 LDKClosingSigned this_ptr_conv;
21969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21970 this_ptr_conv.is_owned = false;
21971 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
21972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21974 uint64_t ret_ref = (uint64_t)ret_var.inner;
21975 if (ret_var.is_owned) {
21981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21982 LDKClosingSigned this_ptr_conv;
21983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21984 this_ptr_conv.is_owned = false;
21985 LDKClosingSignedFeeRange val_conv;
21986 val_conv.inner = (void*)(val & (~1));
21987 val_conv.is_owned = (val & 1) || (val == 0);
21988 val_conv = ClosingSignedFeeRange_clone(&val_conv);
21989 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
21992 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) {
21993 LDKThirtyTwoBytes channel_id_arg_ref;
21994 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21995 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21996 LDKSignature signature_arg_ref;
21997 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21998 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21999 LDKClosingSignedFeeRange fee_range_arg_conv;
22000 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
22001 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
22002 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
22003 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
22004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22006 uint64_t ret_ref = (uint64_t)ret_var.inner;
22007 if (ret_var.is_owned) {
22013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22014 LDKClosingSigned orig_conv;
22015 orig_conv.inner = (void*)(orig & (~1));
22016 orig_conv.is_owned = false;
22017 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
22018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22020 uint64_t ret_ref = (uint64_t)ret_var.inner;
22021 if (ret_var.is_owned) {
22027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22028 LDKUpdateAddHTLC this_obj_conv;
22029 this_obj_conv.inner = (void*)(this_obj & (~1));
22030 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22031 UpdateAddHTLC_free(this_obj_conv);
22034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22035 LDKUpdateAddHTLC this_ptr_conv;
22036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22037 this_ptr_conv.is_owned = false;
22038 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22039 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
22043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22044 LDKUpdateAddHTLC this_ptr_conv;
22045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22046 this_ptr_conv.is_owned = false;
22047 LDKThirtyTwoBytes val_ref;
22048 CHECK((*env)->GetArrayLength(env, val) == 32);
22049 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22050 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
22053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22054 LDKUpdateAddHTLC this_ptr_conv;
22055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22056 this_ptr_conv.is_owned = false;
22057 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
22061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22062 LDKUpdateAddHTLC this_ptr_conv;
22063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22064 this_ptr_conv.is_owned = false;
22065 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
22068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22069 LDKUpdateAddHTLC this_ptr_conv;
22070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22071 this_ptr_conv.is_owned = false;
22072 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
22076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22077 LDKUpdateAddHTLC this_ptr_conv;
22078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22079 this_ptr_conv.is_owned = false;
22080 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
22083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22084 LDKUpdateAddHTLC this_ptr_conv;
22085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22086 this_ptr_conv.is_owned = false;
22087 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22088 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
22092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22093 LDKUpdateAddHTLC this_ptr_conv;
22094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22095 this_ptr_conv.is_owned = false;
22096 LDKThirtyTwoBytes val_ref;
22097 CHECK((*env)->GetArrayLength(env, val) == 32);
22098 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22099 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
22102 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
22103 LDKUpdateAddHTLC this_ptr_conv;
22104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22105 this_ptr_conv.is_owned = false;
22106 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
22110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22111 LDKUpdateAddHTLC this_ptr_conv;
22112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22113 this_ptr_conv.is_owned = false;
22114 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
22117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22118 LDKUpdateAddHTLC orig_conv;
22119 orig_conv.inner = (void*)(orig & (~1));
22120 orig_conv.is_owned = false;
22121 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
22122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22124 uint64_t ret_ref = (uint64_t)ret_var.inner;
22125 if (ret_var.is_owned) {
22131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22132 LDKUpdateFulfillHTLC this_obj_conv;
22133 this_obj_conv.inner = (void*)(this_obj & (~1));
22134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22135 UpdateFulfillHTLC_free(this_obj_conv);
22138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22139 LDKUpdateFulfillHTLC this_ptr_conv;
22140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22141 this_ptr_conv.is_owned = false;
22142 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22143 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
22147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22148 LDKUpdateFulfillHTLC this_ptr_conv;
22149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22150 this_ptr_conv.is_owned = false;
22151 LDKThirtyTwoBytes val_ref;
22152 CHECK((*env)->GetArrayLength(env, val) == 32);
22153 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22154 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
22157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22158 LDKUpdateFulfillHTLC this_ptr_conv;
22159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22160 this_ptr_conv.is_owned = false;
22161 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
22165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22166 LDKUpdateFulfillHTLC this_ptr_conv;
22167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22168 this_ptr_conv.is_owned = false;
22169 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
22172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
22173 LDKUpdateFulfillHTLC this_ptr_conv;
22174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22175 this_ptr_conv.is_owned = false;
22176 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22177 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
22181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22182 LDKUpdateFulfillHTLC this_ptr_conv;
22183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22184 this_ptr_conv.is_owned = false;
22185 LDKThirtyTwoBytes val_ref;
22186 CHECK((*env)->GetArrayLength(env, val) == 32);
22187 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22188 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
22191 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) {
22192 LDKThirtyTwoBytes channel_id_arg_ref;
22193 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22194 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22195 LDKThirtyTwoBytes payment_preimage_arg_ref;
22196 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
22197 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
22198 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
22199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22201 uint64_t ret_ref = (uint64_t)ret_var.inner;
22202 if (ret_var.is_owned) {
22208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22209 LDKUpdateFulfillHTLC orig_conv;
22210 orig_conv.inner = (void*)(orig & (~1));
22211 orig_conv.is_owned = false;
22212 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
22213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22215 uint64_t ret_ref = (uint64_t)ret_var.inner;
22216 if (ret_var.is_owned) {
22222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22223 LDKUpdateFailHTLC this_obj_conv;
22224 this_obj_conv.inner = (void*)(this_obj & (~1));
22225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22226 UpdateFailHTLC_free(this_obj_conv);
22229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22230 LDKUpdateFailHTLC this_ptr_conv;
22231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22232 this_ptr_conv.is_owned = false;
22233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
22238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22239 LDKUpdateFailHTLC this_ptr_conv;
22240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22241 this_ptr_conv.is_owned = false;
22242 LDKThirtyTwoBytes val_ref;
22243 CHECK((*env)->GetArrayLength(env, val) == 32);
22244 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22245 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
22248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22249 LDKUpdateFailHTLC this_ptr_conv;
22250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22251 this_ptr_conv.is_owned = false;
22252 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
22256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22257 LDKUpdateFailHTLC this_ptr_conv;
22258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22259 this_ptr_conv.is_owned = false;
22260 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
22263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22264 LDKUpdateFailHTLC orig_conv;
22265 orig_conv.inner = (void*)(orig & (~1));
22266 orig_conv.is_owned = false;
22267 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
22268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22270 uint64_t ret_ref = (uint64_t)ret_var.inner;
22271 if (ret_var.is_owned) {
22277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22278 LDKUpdateFailMalformedHTLC this_obj_conv;
22279 this_obj_conv.inner = (void*)(this_obj & (~1));
22280 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22281 UpdateFailMalformedHTLC_free(this_obj_conv);
22284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22285 LDKUpdateFailMalformedHTLC this_ptr_conv;
22286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22287 this_ptr_conv.is_owned = false;
22288 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22289 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
22293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22294 LDKUpdateFailMalformedHTLC this_ptr_conv;
22295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22296 this_ptr_conv.is_owned = false;
22297 LDKThirtyTwoBytes val_ref;
22298 CHECK((*env)->GetArrayLength(env, val) == 32);
22299 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22300 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
22303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22304 LDKUpdateFailMalformedHTLC this_ptr_conv;
22305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22306 this_ptr_conv.is_owned = false;
22307 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
22311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22312 LDKUpdateFailMalformedHTLC this_ptr_conv;
22313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22314 this_ptr_conv.is_owned = false;
22315 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
22318 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
22319 LDKUpdateFailMalformedHTLC this_ptr_conv;
22320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22321 this_ptr_conv.is_owned = false;
22322 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
22326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22327 LDKUpdateFailMalformedHTLC this_ptr_conv;
22328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22329 this_ptr_conv.is_owned = false;
22330 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
22333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22334 LDKUpdateFailMalformedHTLC orig_conv;
22335 orig_conv.inner = (void*)(orig & (~1));
22336 orig_conv.is_owned = false;
22337 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
22338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22340 uint64_t ret_ref = (uint64_t)ret_var.inner;
22341 if (ret_var.is_owned) {
22347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22348 LDKCommitmentSigned this_obj_conv;
22349 this_obj_conv.inner = (void*)(this_obj & (~1));
22350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22351 CommitmentSigned_free(this_obj_conv);
22354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22355 LDKCommitmentSigned this_ptr_conv;
22356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22357 this_ptr_conv.is_owned = false;
22358 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
22363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22364 LDKCommitmentSigned this_ptr_conv;
22365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22366 this_ptr_conv.is_owned = false;
22367 LDKThirtyTwoBytes val_ref;
22368 CHECK((*env)->GetArrayLength(env, val) == 32);
22369 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22370 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
22373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22374 LDKCommitmentSigned this_ptr_conv;
22375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22376 this_ptr_conv.is_owned = false;
22377 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22378 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
22382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22383 LDKCommitmentSigned this_ptr_conv;
22384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22385 this_ptr_conv.is_owned = false;
22386 LDKSignature val_ref;
22387 CHECK((*env)->GetArrayLength(env, val) == 64);
22388 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22389 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
22392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22393 LDKCommitmentSigned this_ptr_conv;
22394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22395 this_ptr_conv.is_owned = false;
22396 LDKCVec_SignatureZ val_constr;
22397 val_constr.datalen = (*env)->GetArrayLength(env, val);
22398 if (val_constr.datalen > 0)
22399 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22401 val_constr.data = NULL;
22402 for (size_t i = 0; i < val_constr.datalen; i++) {
22403 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
22404 LDKSignature val_conv_8_ref;
22405 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
22406 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
22407 val_constr.data[i] = val_conv_8_ref;
22409 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
22412 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) {
22413 LDKThirtyTwoBytes channel_id_arg_ref;
22414 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22415 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22416 LDKSignature signature_arg_ref;
22417 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22418 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22419 LDKCVec_SignatureZ htlc_signatures_arg_constr;
22420 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
22421 if (htlc_signatures_arg_constr.datalen > 0)
22422 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22424 htlc_signatures_arg_constr.data = NULL;
22425 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
22426 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
22427 LDKSignature htlc_signatures_arg_conv_8_ref;
22428 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
22429 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
22430 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
22432 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
22433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22435 uint64_t ret_ref = (uint64_t)ret_var.inner;
22436 if (ret_var.is_owned) {
22442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22443 LDKCommitmentSigned orig_conv;
22444 orig_conv.inner = (void*)(orig & (~1));
22445 orig_conv.is_owned = false;
22446 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
22447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22449 uint64_t ret_ref = (uint64_t)ret_var.inner;
22450 if (ret_var.is_owned) {
22456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22457 LDKRevokeAndACK this_obj_conv;
22458 this_obj_conv.inner = (void*)(this_obj & (~1));
22459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22460 RevokeAndACK_free(this_obj_conv);
22463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22464 LDKRevokeAndACK this_ptr_conv;
22465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22466 this_ptr_conv.is_owned = false;
22467 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
22472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22473 LDKRevokeAndACK this_ptr_conv;
22474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22475 this_ptr_conv.is_owned = false;
22476 LDKThirtyTwoBytes val_ref;
22477 CHECK((*env)->GetArrayLength(env, val) == 32);
22478 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22479 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
22482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
22483 LDKRevokeAndACK this_ptr_conv;
22484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22485 this_ptr_conv.is_owned = false;
22486 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22487 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
22491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22492 LDKRevokeAndACK this_ptr_conv;
22493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22494 this_ptr_conv.is_owned = false;
22495 LDKThirtyTwoBytes val_ref;
22496 CHECK((*env)->GetArrayLength(env, val) == 32);
22497 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22498 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
22501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22502 LDKRevokeAndACK this_ptr_conv;
22503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22504 this_ptr_conv.is_owned = false;
22505 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
22510 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) {
22511 LDKRevokeAndACK this_ptr_conv;
22512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22513 this_ptr_conv.is_owned = false;
22514 LDKPublicKey val_ref;
22515 CHECK((*env)->GetArrayLength(env, val) == 33);
22516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22517 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
22520 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) {
22521 LDKThirtyTwoBytes channel_id_arg_ref;
22522 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22523 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22524 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
22525 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
22526 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
22527 LDKPublicKey next_per_commitment_point_arg_ref;
22528 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
22529 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
22530 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
22531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22533 uint64_t ret_ref = (uint64_t)ret_var.inner;
22534 if (ret_var.is_owned) {
22540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22541 LDKRevokeAndACK orig_conv;
22542 orig_conv.inner = (void*)(orig & (~1));
22543 orig_conv.is_owned = false;
22544 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
22545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22547 uint64_t ret_ref = (uint64_t)ret_var.inner;
22548 if (ret_var.is_owned) {
22554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22555 LDKUpdateFee this_obj_conv;
22556 this_obj_conv.inner = (void*)(this_obj & (~1));
22557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22558 UpdateFee_free(this_obj_conv);
22561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22562 LDKUpdateFee this_ptr_conv;
22563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22564 this_ptr_conv.is_owned = false;
22565 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22566 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
22570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22571 LDKUpdateFee this_ptr_conv;
22572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22573 this_ptr_conv.is_owned = false;
22574 LDKThirtyTwoBytes val_ref;
22575 CHECK((*env)->GetArrayLength(env, val) == 32);
22576 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22577 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
22580 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
22581 LDKUpdateFee this_ptr_conv;
22582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22583 this_ptr_conv.is_owned = false;
22584 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
22588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22589 LDKUpdateFee this_ptr_conv;
22590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22591 this_ptr_conv.is_owned = false;
22592 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
22595 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) {
22596 LDKThirtyTwoBytes channel_id_arg_ref;
22597 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22598 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22599 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
22600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22602 uint64_t ret_ref = (uint64_t)ret_var.inner;
22603 if (ret_var.is_owned) {
22609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22610 LDKUpdateFee orig_conv;
22611 orig_conv.inner = (void*)(orig & (~1));
22612 orig_conv.is_owned = false;
22613 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
22614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22616 uint64_t ret_ref = (uint64_t)ret_var.inner;
22617 if (ret_var.is_owned) {
22623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22624 LDKDataLossProtect this_obj_conv;
22625 this_obj_conv.inner = (void*)(this_obj & (~1));
22626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22627 DataLossProtect_free(this_obj_conv);
22630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
22631 LDKDataLossProtect this_ptr_conv;
22632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22633 this_ptr_conv.is_owned = false;
22634 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22635 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
22639 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) {
22640 LDKDataLossProtect this_ptr_conv;
22641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22642 this_ptr_conv.is_owned = false;
22643 LDKThirtyTwoBytes val_ref;
22644 CHECK((*env)->GetArrayLength(env, val) == 32);
22645 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22646 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
22649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22650 LDKDataLossProtect this_ptr_conv;
22651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22652 this_ptr_conv.is_owned = false;
22653 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22654 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
22658 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) {
22659 LDKDataLossProtect this_ptr_conv;
22660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22661 this_ptr_conv.is_owned = false;
22662 LDKPublicKey val_ref;
22663 CHECK((*env)->GetArrayLength(env, val) == 33);
22664 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22665 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
22668 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) {
22669 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
22670 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
22671 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
22672 LDKPublicKey my_current_per_commitment_point_arg_ref;
22673 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
22674 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
22675 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
22676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22678 uint64_t ret_ref = (uint64_t)ret_var.inner;
22679 if (ret_var.is_owned) {
22685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22686 LDKDataLossProtect orig_conv;
22687 orig_conv.inner = (void*)(orig & (~1));
22688 orig_conv.is_owned = false;
22689 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
22690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22692 uint64_t ret_ref = (uint64_t)ret_var.inner;
22693 if (ret_var.is_owned) {
22699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22700 LDKChannelReestablish this_obj_conv;
22701 this_obj_conv.inner = (void*)(this_obj & (~1));
22702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22703 ChannelReestablish_free(this_obj_conv);
22706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22707 LDKChannelReestablish this_ptr_conv;
22708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22709 this_ptr_conv.is_owned = false;
22710 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
22715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22716 LDKChannelReestablish this_ptr_conv;
22717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22718 this_ptr_conv.is_owned = false;
22719 LDKThirtyTwoBytes val_ref;
22720 CHECK((*env)->GetArrayLength(env, val) == 32);
22721 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22722 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
22725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
22726 LDKChannelReestablish this_ptr_conv;
22727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22728 this_ptr_conv.is_owned = false;
22729 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
22733 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) {
22734 LDKChannelReestablish this_ptr_conv;
22735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22736 this_ptr_conv.is_owned = false;
22737 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
22740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
22741 LDKChannelReestablish this_ptr_conv;
22742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22743 this_ptr_conv.is_owned = false;
22744 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
22748 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) {
22749 LDKChannelReestablish this_ptr_conv;
22750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22751 this_ptr_conv.is_owned = false;
22752 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
22755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22756 LDKChannelReestablish orig_conv;
22757 orig_conv.inner = (void*)(orig & (~1));
22758 orig_conv.is_owned = false;
22759 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
22760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22762 uint64_t ret_ref = (uint64_t)ret_var.inner;
22763 if (ret_var.is_owned) {
22769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22770 LDKAnnouncementSignatures this_obj_conv;
22771 this_obj_conv.inner = (void*)(this_obj & (~1));
22772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22773 AnnouncementSignatures_free(this_obj_conv);
22776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22777 LDKAnnouncementSignatures this_ptr_conv;
22778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22779 this_ptr_conv.is_owned = false;
22780 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
22785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22786 LDKAnnouncementSignatures this_ptr_conv;
22787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22788 this_ptr_conv.is_owned = false;
22789 LDKThirtyTwoBytes val_ref;
22790 CHECK((*env)->GetArrayLength(env, val) == 32);
22791 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22792 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
22795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22796 LDKAnnouncementSignatures this_ptr_conv;
22797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22798 this_ptr_conv.is_owned = false;
22799 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
22803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22804 LDKAnnouncementSignatures this_ptr_conv;
22805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22806 this_ptr_conv.is_owned = false;
22807 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
22810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22811 LDKAnnouncementSignatures this_ptr_conv;
22812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22813 this_ptr_conv.is_owned = false;
22814 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22815 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
22819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22820 LDKAnnouncementSignatures this_ptr_conv;
22821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22822 this_ptr_conv.is_owned = false;
22823 LDKSignature val_ref;
22824 CHECK((*env)->GetArrayLength(env, val) == 64);
22825 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22826 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
22829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22830 LDKAnnouncementSignatures this_ptr_conv;
22831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22832 this_ptr_conv.is_owned = false;
22833 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22834 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
22838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22839 LDKAnnouncementSignatures this_ptr_conv;
22840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22841 this_ptr_conv.is_owned = false;
22842 LDKSignature val_ref;
22843 CHECK((*env)->GetArrayLength(env, val) == 64);
22844 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22845 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
22848 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) {
22849 LDKThirtyTwoBytes channel_id_arg_ref;
22850 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22851 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22852 LDKSignature node_signature_arg_ref;
22853 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
22854 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
22855 LDKSignature bitcoin_signature_arg_ref;
22856 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
22857 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
22858 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
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 int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22869 LDKAnnouncementSignatures orig_conv;
22870 orig_conv.inner = (void*)(orig & (~1));
22871 orig_conv.is_owned = false;
22872 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
22873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22875 uint64_t ret_ref = (uint64_t)ret_var.inner;
22876 if (ret_var.is_owned) {
22882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22883 if ((this_ptr & 1) != 0) return;
22884 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
22885 CHECK_ACCESS(this_ptr_ptr);
22886 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
22887 FREE((void*)this_ptr);
22888 NetAddress_free(this_ptr_conv);
22891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22892 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
22893 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22894 *ret_copy = NetAddress_clone(orig_conv);
22895 uint64_t ret_ref = (uint64_t)ret_copy;
22899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22900 LDKFourBytes addr_ref;
22901 CHECK((*env)->GetArrayLength(env, addr) == 4);
22902 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
22903 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22904 *ret_copy = NetAddress_ipv4(addr_ref, port);
22905 uint64_t ret_ref = (uint64_t)ret_copy;
22909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22910 LDKSixteenBytes addr_ref;
22911 CHECK((*env)->GetArrayLength(env, addr) == 16);
22912 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
22913 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22914 *ret_copy = NetAddress_ipv6(addr_ref, port);
22915 uint64_t ret_ref = (uint64_t)ret_copy;
22919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
22920 LDKTenBytes addr_ref;
22921 CHECK((*env)->GetArrayLength(env, addr) == 10);
22922 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
22923 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22924 *ret_copy = NetAddress_onion_v2(addr_ref, port);
22925 uint64_t ret_ref = (uint64_t)ret_copy;
22929 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) {
22930 LDKThirtyTwoBytes ed25519_pubkey_ref;
22931 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
22932 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
22933 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
22934 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
22935 uint64_t ret_ref = (uint64_t)ret_copy;
22939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
22940 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
22941 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
22942 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22943 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22944 CVec_u8Z_free(ret_var);
22948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22949 LDKu8slice ser_ref;
22950 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22951 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22952 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
22953 *ret_conv = Result_read(ser_ref);
22954 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22955 return (uint64_t)ret_conv;
22958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22959 LDKu8slice ser_ref;
22960 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22961 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22962 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22963 *ret_conv = NetAddress_read(ser_ref);
22964 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22965 return (uint64_t)ret_conv;
22968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22969 LDKUnsignedNodeAnnouncement this_obj_conv;
22970 this_obj_conv.inner = (void*)(this_obj & (~1));
22971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22972 UnsignedNodeAnnouncement_free(this_obj_conv);
22975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22976 LDKUnsignedNodeAnnouncement this_ptr_conv;
22977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22978 this_ptr_conv.is_owned = false;
22979 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
22980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22982 uint64_t ret_ref = (uint64_t)ret_var.inner;
22983 if (ret_var.is_owned) {
22989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22990 LDKUnsignedNodeAnnouncement this_ptr_conv;
22991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22992 this_ptr_conv.is_owned = false;
22993 LDKNodeFeatures val_conv;
22994 val_conv.inner = (void*)(val & (~1));
22995 val_conv.is_owned = (val & 1) || (val == 0);
22996 val_conv = NodeFeatures_clone(&val_conv);
22997 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
23000 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
23001 LDKUnsignedNodeAnnouncement this_ptr_conv;
23002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23003 this_ptr_conv.is_owned = false;
23004 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
23008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23009 LDKUnsignedNodeAnnouncement this_ptr_conv;
23010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23011 this_ptr_conv.is_owned = false;
23012 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
23015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23016 LDKUnsignedNodeAnnouncement this_ptr_conv;
23017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23018 this_ptr_conv.is_owned = false;
23019 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
23024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23025 LDKUnsignedNodeAnnouncement this_ptr_conv;
23026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23027 this_ptr_conv.is_owned = false;
23028 LDKPublicKey val_ref;
23029 CHECK((*env)->GetArrayLength(env, val) == 33);
23030 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23031 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
23034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
23035 LDKUnsignedNodeAnnouncement this_ptr_conv;
23036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23037 this_ptr_conv.is_owned = false;
23038 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
23039 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
23043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23044 LDKUnsignedNodeAnnouncement this_ptr_conv;
23045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23046 this_ptr_conv.is_owned = false;
23047 LDKThreeBytes val_ref;
23048 CHECK((*env)->GetArrayLength(env, val) == 3);
23049 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
23050 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
23053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
23054 LDKUnsignedNodeAnnouncement this_ptr_conv;
23055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23056 this_ptr_conv.is_owned = false;
23057 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23058 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
23062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23063 LDKUnsignedNodeAnnouncement this_ptr_conv;
23064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23065 this_ptr_conv.is_owned = false;
23066 LDKThirtyTwoBytes val_ref;
23067 CHECK((*env)->GetArrayLength(env, val) == 32);
23068 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23069 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
23072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23073 LDKUnsignedNodeAnnouncement this_ptr_conv;
23074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23075 this_ptr_conv.is_owned = false;
23076 LDKCVec_NetAddressZ val_constr;
23077 val_constr.datalen = (*env)->GetArrayLength(env, val);
23078 if (val_constr.datalen > 0)
23079 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23081 val_constr.data = NULL;
23082 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23083 for (size_t m = 0; m < val_constr.datalen; m++) {
23084 int64_t val_conv_12 = val_vals[m];
23085 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
23086 CHECK_ACCESS(val_conv_12_ptr);
23087 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
23088 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23089 val_constr.data[m] = val_conv_12_conv;
23091 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23092 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
23095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23096 LDKUnsignedNodeAnnouncement orig_conv;
23097 orig_conv.inner = (void*)(orig & (~1));
23098 orig_conv.is_owned = false;
23099 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
23100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23102 uint64_t ret_ref = (uint64_t)ret_var.inner;
23103 if (ret_var.is_owned) {
23109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23110 LDKNodeAnnouncement this_obj_conv;
23111 this_obj_conv.inner = (void*)(this_obj & (~1));
23112 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23113 NodeAnnouncement_free(this_obj_conv);
23116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23117 LDKNodeAnnouncement this_ptr_conv;
23118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23119 this_ptr_conv.is_owned = false;
23120 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23121 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
23125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23126 LDKNodeAnnouncement this_ptr_conv;
23127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23128 this_ptr_conv.is_owned = false;
23129 LDKSignature val_ref;
23130 CHECK((*env)->GetArrayLength(env, val) == 64);
23131 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23132 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
23135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
23136 LDKNodeAnnouncement this_ptr_conv;
23137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23138 this_ptr_conv.is_owned = false;
23139 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
23140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23142 uint64_t ret_ref = (uint64_t)ret_var.inner;
23143 if (ret_var.is_owned) {
23149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23150 LDKNodeAnnouncement this_ptr_conv;
23151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23152 this_ptr_conv.is_owned = false;
23153 LDKUnsignedNodeAnnouncement val_conv;
23154 val_conv.inner = (void*)(val & (~1));
23155 val_conv.is_owned = (val & 1) || (val == 0);
23156 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
23157 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
23160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
23161 LDKSignature signature_arg_ref;
23162 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23163 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23164 LDKUnsignedNodeAnnouncement contents_arg_conv;
23165 contents_arg_conv.inner = (void*)(contents_arg & (~1));
23166 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
23167 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
23168 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
23169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23171 uint64_t ret_ref = (uint64_t)ret_var.inner;
23172 if (ret_var.is_owned) {
23178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23179 LDKNodeAnnouncement orig_conv;
23180 orig_conv.inner = (void*)(orig & (~1));
23181 orig_conv.is_owned = false;
23182 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
23183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23185 uint64_t ret_ref = (uint64_t)ret_var.inner;
23186 if (ret_var.is_owned) {
23192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23193 LDKUnsignedChannelAnnouncement this_obj_conv;
23194 this_obj_conv.inner = (void*)(this_obj & (~1));
23195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23196 UnsignedChannelAnnouncement_free(this_obj_conv);
23199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23200 LDKUnsignedChannelAnnouncement this_ptr_conv;
23201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23202 this_ptr_conv.is_owned = false;
23203 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
23204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23206 uint64_t ret_ref = (uint64_t)ret_var.inner;
23207 if (ret_var.is_owned) {
23213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23214 LDKUnsignedChannelAnnouncement this_ptr_conv;
23215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23216 this_ptr_conv.is_owned = false;
23217 LDKChannelFeatures val_conv;
23218 val_conv.inner = (void*)(val & (~1));
23219 val_conv.is_owned = (val & 1) || (val == 0);
23220 val_conv = ChannelFeatures_clone(&val_conv);
23221 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
23224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23225 LDKUnsignedChannelAnnouncement this_ptr_conv;
23226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23227 this_ptr_conv.is_owned = false;
23228 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23229 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
23233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23234 LDKUnsignedChannelAnnouncement this_ptr_conv;
23235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23236 this_ptr_conv.is_owned = false;
23237 LDKThirtyTwoBytes val_ref;
23238 CHECK((*env)->GetArrayLength(env, val) == 32);
23239 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23240 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
23243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23244 LDKUnsignedChannelAnnouncement this_ptr_conv;
23245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23246 this_ptr_conv.is_owned = false;
23247 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
23251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23252 LDKUnsignedChannelAnnouncement this_ptr_conv;
23253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23254 this_ptr_conv.is_owned = false;
23255 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
23258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
23259 LDKUnsignedChannelAnnouncement this_ptr_conv;
23260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23261 this_ptr_conv.is_owned = false;
23262 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
23267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23268 LDKUnsignedChannelAnnouncement this_ptr_conv;
23269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23270 this_ptr_conv.is_owned = false;
23271 LDKPublicKey val_ref;
23272 CHECK((*env)->GetArrayLength(env, val) == 33);
23273 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23274 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
23277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
23278 LDKUnsignedChannelAnnouncement this_ptr_conv;
23279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23280 this_ptr_conv.is_owned = false;
23281 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
23286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23287 LDKUnsignedChannelAnnouncement this_ptr_conv;
23288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23289 this_ptr_conv.is_owned = false;
23290 LDKPublicKey val_ref;
23291 CHECK((*env)->GetArrayLength(env, val) == 33);
23292 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23293 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
23296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
23297 LDKUnsignedChannelAnnouncement this_ptr_conv;
23298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23299 this_ptr_conv.is_owned = false;
23300 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23301 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
23305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23306 LDKUnsignedChannelAnnouncement this_ptr_conv;
23307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23308 this_ptr_conv.is_owned = false;
23309 LDKPublicKey val_ref;
23310 CHECK((*env)->GetArrayLength(env, val) == 33);
23311 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23312 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
23315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
23316 LDKUnsignedChannelAnnouncement this_ptr_conv;
23317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23318 this_ptr_conv.is_owned = false;
23319 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23320 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
23324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23325 LDKUnsignedChannelAnnouncement this_ptr_conv;
23326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23327 this_ptr_conv.is_owned = false;
23328 LDKPublicKey val_ref;
23329 CHECK((*env)->GetArrayLength(env, val) == 33);
23330 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23331 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
23334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23335 LDKUnsignedChannelAnnouncement orig_conv;
23336 orig_conv.inner = (void*)(orig & (~1));
23337 orig_conv.is_owned = false;
23338 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
23339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23341 uint64_t ret_ref = (uint64_t)ret_var.inner;
23342 if (ret_var.is_owned) {
23348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23349 LDKChannelAnnouncement this_obj_conv;
23350 this_obj_conv.inner = (void*)(this_obj & (~1));
23351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23352 ChannelAnnouncement_free(this_obj_conv);
23355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
23356 LDKChannelAnnouncement this_ptr_conv;
23357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23358 this_ptr_conv.is_owned = false;
23359 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23360 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
23364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23365 LDKChannelAnnouncement this_ptr_conv;
23366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23367 this_ptr_conv.is_owned = false;
23368 LDKSignature val_ref;
23369 CHECK((*env)->GetArrayLength(env, val) == 64);
23370 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23371 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
23374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
23375 LDKChannelAnnouncement this_ptr_conv;
23376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23377 this_ptr_conv.is_owned = false;
23378 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23379 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
23383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23384 LDKChannelAnnouncement this_ptr_conv;
23385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23386 this_ptr_conv.is_owned = false;
23387 LDKSignature val_ref;
23388 CHECK((*env)->GetArrayLength(env, val) == 64);
23389 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23390 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
23393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
23394 LDKChannelAnnouncement this_ptr_conv;
23395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23396 this_ptr_conv.is_owned = false;
23397 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23398 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
23402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23403 LDKChannelAnnouncement this_ptr_conv;
23404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23405 this_ptr_conv.is_owned = false;
23406 LDKSignature val_ref;
23407 CHECK((*env)->GetArrayLength(env, val) == 64);
23408 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23409 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
23412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
23413 LDKChannelAnnouncement this_ptr_conv;
23414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23415 this_ptr_conv.is_owned = false;
23416 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23417 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
23421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23422 LDKChannelAnnouncement this_ptr_conv;
23423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23424 this_ptr_conv.is_owned = false;
23425 LDKSignature val_ref;
23426 CHECK((*env)->GetArrayLength(env, val) == 64);
23427 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23428 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
23431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
23432 LDKChannelAnnouncement this_ptr_conv;
23433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23434 this_ptr_conv.is_owned = false;
23435 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
23436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23438 uint64_t ret_ref = (uint64_t)ret_var.inner;
23439 if (ret_var.is_owned) {
23445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23446 LDKChannelAnnouncement this_ptr_conv;
23447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23448 this_ptr_conv.is_owned = false;
23449 LDKUnsignedChannelAnnouncement val_conv;
23450 val_conv.inner = (void*)(val & (~1));
23451 val_conv.is_owned = (val & 1) || (val == 0);
23452 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
23453 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
23456 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) {
23457 LDKSignature node_signature_1_arg_ref;
23458 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
23459 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
23460 LDKSignature node_signature_2_arg_ref;
23461 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
23462 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
23463 LDKSignature bitcoin_signature_1_arg_ref;
23464 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
23465 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
23466 LDKSignature bitcoin_signature_2_arg_ref;
23467 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
23468 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
23469 LDKUnsignedChannelAnnouncement contents_arg_conv;
23470 contents_arg_conv.inner = (void*)(contents_arg & (~1));
23471 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
23472 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
23473 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);
23474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23476 uint64_t ret_ref = (uint64_t)ret_var.inner;
23477 if (ret_var.is_owned) {
23483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23484 LDKChannelAnnouncement orig_conv;
23485 orig_conv.inner = (void*)(orig & (~1));
23486 orig_conv.is_owned = false;
23487 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
23488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23490 uint64_t ret_ref = (uint64_t)ret_var.inner;
23491 if (ret_var.is_owned) {
23497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23498 LDKUnsignedChannelUpdate this_obj_conv;
23499 this_obj_conv.inner = (void*)(this_obj & (~1));
23500 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23501 UnsignedChannelUpdate_free(this_obj_conv);
23504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23505 LDKUnsignedChannelUpdate this_ptr_conv;
23506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23507 this_ptr_conv.is_owned = false;
23508 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23509 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
23513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23514 LDKUnsignedChannelUpdate this_ptr_conv;
23515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23516 this_ptr_conv.is_owned = false;
23517 LDKThirtyTwoBytes val_ref;
23518 CHECK((*env)->GetArrayLength(env, val) == 32);
23519 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23520 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
23523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23524 LDKUnsignedChannelUpdate this_ptr_conv;
23525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23526 this_ptr_conv.is_owned = false;
23527 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
23531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23532 LDKUnsignedChannelUpdate this_ptr_conv;
23533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23534 this_ptr_conv.is_owned = false;
23535 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
23538 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
23539 LDKUnsignedChannelUpdate this_ptr_conv;
23540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23541 this_ptr_conv.is_owned = false;
23542 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
23546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23547 LDKUnsignedChannelUpdate this_ptr_conv;
23548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23549 this_ptr_conv.is_owned = false;
23550 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
23553 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
23554 LDKUnsignedChannelUpdate this_ptr_conv;
23555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23556 this_ptr_conv.is_owned = false;
23557 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
23561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
23562 LDKUnsignedChannelUpdate this_ptr_conv;
23563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23564 this_ptr_conv.is_owned = false;
23565 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
23568 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23569 LDKUnsignedChannelUpdate this_ptr_conv;
23570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23571 this_ptr_conv.is_owned = false;
23572 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
23576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23577 LDKUnsignedChannelUpdate this_ptr_conv;
23578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23579 this_ptr_conv.is_owned = false;
23580 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
23583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23584 LDKUnsignedChannelUpdate this_ptr_conv;
23585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23586 this_ptr_conv.is_owned = false;
23587 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
23591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23592 LDKUnsignedChannelUpdate this_ptr_conv;
23593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23594 this_ptr_conv.is_owned = false;
23595 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
23598 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23599 LDKUnsignedChannelUpdate this_ptr_conv;
23600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23601 this_ptr_conv.is_owned = false;
23602 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
23606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23607 LDKUnsignedChannelUpdate this_ptr_conv;
23608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23609 this_ptr_conv.is_owned = false;
23610 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
23613 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
23614 LDKUnsignedChannelUpdate this_ptr_conv;
23615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23616 this_ptr_conv.is_owned = false;
23617 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
23621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23622 LDKUnsignedChannelUpdate this_ptr_conv;
23623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23624 this_ptr_conv.is_owned = false;
23625 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
23628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23629 LDKUnsignedChannelUpdate orig_conv;
23630 orig_conv.inner = (void*)(orig & (~1));
23631 orig_conv.is_owned = false;
23632 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
23633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23635 uint64_t ret_ref = (uint64_t)ret_var.inner;
23636 if (ret_var.is_owned) {
23642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23643 LDKChannelUpdate this_obj_conv;
23644 this_obj_conv.inner = (void*)(this_obj & (~1));
23645 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23646 ChannelUpdate_free(this_obj_conv);
23649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23650 LDKChannelUpdate this_ptr_conv;
23651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23652 this_ptr_conv.is_owned = false;
23653 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23654 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
23658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23659 LDKChannelUpdate this_ptr_conv;
23660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23661 this_ptr_conv.is_owned = false;
23662 LDKSignature val_ref;
23663 CHECK((*env)->GetArrayLength(env, val) == 64);
23664 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23665 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
23668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
23669 LDKChannelUpdate this_ptr_conv;
23670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23671 this_ptr_conv.is_owned = false;
23672 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
23673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23675 uint64_t ret_ref = (uint64_t)ret_var.inner;
23676 if (ret_var.is_owned) {
23682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23683 LDKChannelUpdate this_ptr_conv;
23684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23685 this_ptr_conv.is_owned = false;
23686 LDKUnsignedChannelUpdate val_conv;
23687 val_conv.inner = (void*)(val & (~1));
23688 val_conv.is_owned = (val & 1) || (val == 0);
23689 val_conv = UnsignedChannelUpdate_clone(&val_conv);
23690 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
23693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
23694 LDKSignature signature_arg_ref;
23695 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23696 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23697 LDKUnsignedChannelUpdate contents_arg_conv;
23698 contents_arg_conv.inner = (void*)(contents_arg & (~1));
23699 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
23700 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
23701 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
23702 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23703 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23704 uint64_t ret_ref = (uint64_t)ret_var.inner;
23705 if (ret_var.is_owned) {
23711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23712 LDKChannelUpdate orig_conv;
23713 orig_conv.inner = (void*)(orig & (~1));
23714 orig_conv.is_owned = false;
23715 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
23716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23718 uint64_t ret_ref = (uint64_t)ret_var.inner;
23719 if (ret_var.is_owned) {
23725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23726 LDKQueryChannelRange this_obj_conv;
23727 this_obj_conv.inner = (void*)(this_obj & (~1));
23728 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23729 QueryChannelRange_free(this_obj_conv);
23732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23733 LDKQueryChannelRange this_ptr_conv;
23734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23735 this_ptr_conv.is_owned = false;
23736 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23737 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
23741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23742 LDKQueryChannelRange this_ptr_conv;
23743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23744 this_ptr_conv.is_owned = false;
23745 LDKThirtyTwoBytes val_ref;
23746 CHECK((*env)->GetArrayLength(env, val) == 32);
23747 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23748 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
23751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
23752 LDKQueryChannelRange this_ptr_conv;
23753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23754 this_ptr_conv.is_owned = false;
23755 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
23759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23760 LDKQueryChannelRange this_ptr_conv;
23761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23762 this_ptr_conv.is_owned = false;
23763 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
23766 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
23767 LDKQueryChannelRange this_ptr_conv;
23768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23769 this_ptr_conv.is_owned = false;
23770 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
23774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23775 LDKQueryChannelRange this_ptr_conv;
23776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23777 this_ptr_conv.is_owned = false;
23778 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
23781 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) {
23782 LDKThirtyTwoBytes chain_hash_arg_ref;
23783 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23784 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23785 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
23786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23788 uint64_t ret_ref = (uint64_t)ret_var.inner;
23789 if (ret_var.is_owned) {
23795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23796 LDKQueryChannelRange orig_conv;
23797 orig_conv.inner = (void*)(orig & (~1));
23798 orig_conv.is_owned = false;
23799 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
23800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23802 uint64_t ret_ref = (uint64_t)ret_var.inner;
23803 if (ret_var.is_owned) {
23809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23810 LDKReplyChannelRange this_obj_conv;
23811 this_obj_conv.inner = (void*)(this_obj & (~1));
23812 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23813 ReplyChannelRange_free(this_obj_conv);
23816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23817 LDKReplyChannelRange this_ptr_conv;
23818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23819 this_ptr_conv.is_owned = false;
23820 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
23825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23826 LDKReplyChannelRange this_ptr_conv;
23827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23828 this_ptr_conv.is_owned = false;
23829 LDKThirtyTwoBytes val_ref;
23830 CHECK((*env)->GetArrayLength(env, val) == 32);
23831 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23832 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
23835 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
23836 LDKReplyChannelRange this_ptr_conv;
23837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23838 this_ptr_conv.is_owned = false;
23839 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
23843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23844 LDKReplyChannelRange this_ptr_conv;
23845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23846 this_ptr_conv.is_owned = false;
23847 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
23850 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
23851 LDKReplyChannelRange this_ptr_conv;
23852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23853 this_ptr_conv.is_owned = false;
23854 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
23858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23859 LDKReplyChannelRange this_ptr_conv;
23860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23861 this_ptr_conv.is_owned = false;
23862 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
23865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
23866 LDKReplyChannelRange this_ptr_conv;
23867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23868 this_ptr_conv.is_owned = false;
23869 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
23873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23874 LDKReplyChannelRange this_ptr_conv;
23875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23876 this_ptr_conv.is_owned = false;
23877 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
23880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23881 LDKReplyChannelRange this_ptr_conv;
23882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23883 this_ptr_conv.is_owned = false;
23884 LDKCVec_u64Z val_constr;
23885 val_constr.datalen = (*env)->GetArrayLength(env, val);
23886 if (val_constr.datalen > 0)
23887 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23889 val_constr.data = NULL;
23890 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23891 for (size_t g = 0; g < val_constr.datalen; g++) {
23892 int64_t val_conv_6 = val_vals[g];
23893 val_constr.data[g] = val_conv_6;
23895 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23896 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
23899 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) {
23900 LDKThirtyTwoBytes chain_hash_arg_ref;
23901 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23902 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23903 LDKCVec_u64Z short_channel_ids_arg_constr;
23904 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
23905 if (short_channel_ids_arg_constr.datalen > 0)
23906 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23908 short_channel_ids_arg_constr.data = NULL;
23909 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
23910 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
23911 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
23912 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
23914 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
23915 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
23916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23918 uint64_t ret_ref = (uint64_t)ret_var.inner;
23919 if (ret_var.is_owned) {
23925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23926 LDKReplyChannelRange orig_conv;
23927 orig_conv.inner = (void*)(orig & (~1));
23928 orig_conv.is_owned = false;
23929 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
23930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23932 uint64_t ret_ref = (uint64_t)ret_var.inner;
23933 if (ret_var.is_owned) {
23939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23940 LDKQueryShortChannelIds this_obj_conv;
23941 this_obj_conv.inner = (void*)(this_obj & (~1));
23942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23943 QueryShortChannelIds_free(this_obj_conv);
23946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23947 LDKQueryShortChannelIds this_ptr_conv;
23948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23949 this_ptr_conv.is_owned = false;
23950 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23951 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
23955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23956 LDKQueryShortChannelIds this_ptr_conv;
23957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23958 this_ptr_conv.is_owned = false;
23959 LDKThirtyTwoBytes val_ref;
23960 CHECK((*env)->GetArrayLength(env, val) == 32);
23961 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23962 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
23965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23966 LDKQueryShortChannelIds this_ptr_conv;
23967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23968 this_ptr_conv.is_owned = false;
23969 LDKCVec_u64Z val_constr;
23970 val_constr.datalen = (*env)->GetArrayLength(env, val);
23971 if (val_constr.datalen > 0)
23972 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23974 val_constr.data = NULL;
23975 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23976 for (size_t g = 0; g < val_constr.datalen; g++) {
23977 int64_t val_conv_6 = val_vals[g];
23978 val_constr.data[g] = val_conv_6;
23980 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23981 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
23984 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) {
23985 LDKThirtyTwoBytes chain_hash_arg_ref;
23986 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
23987 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
23988 LDKCVec_u64Z short_channel_ids_arg_constr;
23989 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
23990 if (short_channel_ids_arg_constr.datalen > 0)
23991 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23993 short_channel_ids_arg_constr.data = NULL;
23994 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
23995 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
23996 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
23997 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
23999 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
24000 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
24001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24003 uint64_t ret_ref = (uint64_t)ret_var.inner;
24004 if (ret_var.is_owned) {
24010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24011 LDKQueryShortChannelIds orig_conv;
24012 orig_conv.inner = (void*)(orig & (~1));
24013 orig_conv.is_owned = false;
24014 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
24015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24017 uint64_t ret_ref = (uint64_t)ret_var.inner;
24018 if (ret_var.is_owned) {
24024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24025 LDKReplyShortChannelIdsEnd this_obj_conv;
24026 this_obj_conv.inner = (void*)(this_obj & (~1));
24027 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24028 ReplyShortChannelIdsEnd_free(this_obj_conv);
24031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24032 LDKReplyShortChannelIdsEnd this_ptr_conv;
24033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24034 this_ptr_conv.is_owned = false;
24035 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24036 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
24040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24041 LDKReplyShortChannelIdsEnd this_ptr_conv;
24042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24043 this_ptr_conv.is_owned = false;
24044 LDKThirtyTwoBytes val_ref;
24045 CHECK((*env)->GetArrayLength(env, val) == 32);
24046 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24047 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
24050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
24051 LDKReplyShortChannelIdsEnd this_ptr_conv;
24052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24053 this_ptr_conv.is_owned = false;
24054 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
24058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24059 LDKReplyShortChannelIdsEnd this_ptr_conv;
24060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24061 this_ptr_conv.is_owned = false;
24062 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
24065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
24066 LDKThirtyTwoBytes chain_hash_arg_ref;
24067 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
24068 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
24069 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
24070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24072 uint64_t ret_ref = (uint64_t)ret_var.inner;
24073 if (ret_var.is_owned) {
24079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24080 LDKReplyShortChannelIdsEnd orig_conv;
24081 orig_conv.inner = (void*)(orig & (~1));
24082 orig_conv.is_owned = false;
24083 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
24084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24086 uint64_t ret_ref = (uint64_t)ret_var.inner;
24087 if (ret_var.is_owned) {
24093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24094 LDKGossipTimestampFilter this_obj_conv;
24095 this_obj_conv.inner = (void*)(this_obj & (~1));
24096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24097 GossipTimestampFilter_free(this_obj_conv);
24100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24101 LDKGossipTimestampFilter this_ptr_conv;
24102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24103 this_ptr_conv.is_owned = false;
24104 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24105 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
24109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24110 LDKGossipTimestampFilter this_ptr_conv;
24111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24112 this_ptr_conv.is_owned = false;
24113 LDKThirtyTwoBytes val_ref;
24114 CHECK((*env)->GetArrayLength(env, val) == 32);
24115 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24116 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
24119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24120 LDKGossipTimestampFilter this_ptr_conv;
24121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24122 this_ptr_conv.is_owned = false;
24123 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
24127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24128 LDKGossipTimestampFilter this_ptr_conv;
24129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24130 this_ptr_conv.is_owned = false;
24131 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
24134 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
24135 LDKGossipTimestampFilter this_ptr_conv;
24136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24137 this_ptr_conv.is_owned = false;
24138 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
24142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24143 LDKGossipTimestampFilter this_ptr_conv;
24144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24145 this_ptr_conv.is_owned = false;
24146 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
24149 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) {
24150 LDKThirtyTwoBytes chain_hash_arg_ref;
24151 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
24152 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
24153 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
24154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24156 uint64_t ret_ref = (uint64_t)ret_var.inner;
24157 if (ret_var.is_owned) {
24163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24164 LDKGossipTimestampFilter orig_conv;
24165 orig_conv.inner = (void*)(orig & (~1));
24166 orig_conv.is_owned = false;
24167 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
24168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24170 uint64_t ret_ref = (uint64_t)ret_var.inner;
24171 if (ret_var.is_owned) {
24177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24178 if ((this_ptr & 1) != 0) return;
24179 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24180 CHECK_ACCESS(this_ptr_ptr);
24181 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
24182 FREE((void*)this_ptr);
24183 ErrorAction_free(this_ptr_conv);
24186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24187 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
24188 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24189 *ret_copy = ErrorAction_clone(orig_conv);
24190 uint64_t ret_ref = (uint64_t)ret_copy;
24194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
24195 LDKErrorMessage msg_conv;
24196 msg_conv.inner = (void*)(msg & (~1));
24197 msg_conv.is_owned = (msg & 1) || (msg == 0);
24198 msg_conv = ErrorMessage_clone(&msg_conv);
24199 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24200 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
24201 uint64_t ret_ref = (uint64_t)ret_copy;
24205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
24206 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24207 *ret_copy = ErrorAction_ignore_error();
24208 uint64_t ret_ref = (uint64_t)ret_copy;
24212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
24213 LDKLevel a_conv = LDKLevel_from_java(env, a);
24214 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24215 *ret_copy = ErrorAction_ignore_and_log(a_conv);
24216 uint64_t ret_ref = (uint64_t)ret_copy;
24220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
24221 LDKErrorMessage msg_conv;
24222 msg_conv.inner = (void*)(msg & (~1));
24223 msg_conv.is_owned = (msg & 1) || (msg == 0);
24224 msg_conv = ErrorMessage_clone(&msg_conv);
24225 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24226 *ret_copy = ErrorAction_send_error_message(msg_conv);
24227 uint64_t ret_ref = (uint64_t)ret_copy;
24231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24232 LDKLightningError this_obj_conv;
24233 this_obj_conv.inner = (void*)(this_obj & (~1));
24234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24235 LightningError_free(this_obj_conv);
24238 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
24239 LDKLightningError this_ptr_conv;
24240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24241 this_ptr_conv.is_owned = false;
24242 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
24243 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24249 LDKLightningError this_ptr_conv;
24250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24251 this_ptr_conv.is_owned = false;
24252 LDKStr val_conv = java_to_owned_str(env, val);
24253 LightningError_set_err(&this_ptr_conv, val_conv);
24256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
24257 LDKLightningError this_ptr_conv;
24258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24259 this_ptr_conv.is_owned = false;
24260 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
24261 *ret_copy = LightningError_get_action(&this_ptr_conv);
24262 uint64_t ret_ref = (uint64_t)ret_copy;
24266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24267 LDKLightningError this_ptr_conv;
24268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24269 this_ptr_conv.is_owned = false;
24270 void* val_ptr = (void*)(((uint64_t)val) & ~1);
24271 CHECK_ACCESS(val_ptr);
24272 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
24273 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
24274 LightningError_set_action(&this_ptr_conv, val_conv);
24277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
24278 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
24279 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
24280 CHECK_ACCESS(action_arg_ptr);
24281 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
24282 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
24283 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
24284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24286 uint64_t ret_ref = (uint64_t)ret_var.inner;
24287 if (ret_var.is_owned) {
24293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24294 LDKLightningError orig_conv;
24295 orig_conv.inner = (void*)(orig & (~1));
24296 orig_conv.is_owned = false;
24297 LDKLightningError ret_var = LightningError_clone(&orig_conv);
24298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24300 uint64_t ret_ref = (uint64_t)ret_var.inner;
24301 if (ret_var.is_owned) {
24307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24308 LDKCommitmentUpdate this_obj_conv;
24309 this_obj_conv.inner = (void*)(this_obj & (~1));
24310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24311 CommitmentUpdate_free(this_obj_conv);
24314 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24315 LDKCommitmentUpdate this_ptr_conv;
24316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24317 this_ptr_conv.is_owned = false;
24318 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
24319 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24320 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24321 for (size_t p = 0; p < ret_var.datalen; p++) {
24322 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
24323 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24324 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24325 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
24326 if (ret_conv_15_var.is_owned) {
24327 ret_conv_15_ref |= 1;
24329 ret_arr_ptr[p] = ret_conv_15_ref;
24331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24332 FREE(ret_var.data);
24336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24337 LDKCommitmentUpdate this_ptr_conv;
24338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24339 this_ptr_conv.is_owned = false;
24340 LDKCVec_UpdateAddHTLCZ val_constr;
24341 val_constr.datalen = (*env)->GetArrayLength(env, val);
24342 if (val_constr.datalen > 0)
24343 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
24345 val_constr.data = NULL;
24346 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24347 for (size_t p = 0; p < val_constr.datalen; p++) {
24348 int64_t val_conv_15 = val_vals[p];
24349 LDKUpdateAddHTLC val_conv_15_conv;
24350 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
24351 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
24352 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
24353 val_constr.data[p] = val_conv_15_conv;
24355 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24356 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
24359 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24360 LDKCommitmentUpdate this_ptr_conv;
24361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24362 this_ptr_conv.is_owned = false;
24363 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
24364 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24365 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24366 for (size_t t = 0; t < ret_var.datalen; t++) {
24367 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
24368 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24369 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24370 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
24371 if (ret_conv_19_var.is_owned) {
24372 ret_conv_19_ref |= 1;
24374 ret_arr_ptr[t] = ret_conv_19_ref;
24376 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24377 FREE(ret_var.data);
24381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24382 LDKCommitmentUpdate this_ptr_conv;
24383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24384 this_ptr_conv.is_owned = false;
24385 LDKCVec_UpdateFulfillHTLCZ val_constr;
24386 val_constr.datalen = (*env)->GetArrayLength(env, val);
24387 if (val_constr.datalen > 0)
24388 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
24390 val_constr.data = NULL;
24391 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24392 for (size_t t = 0; t < val_constr.datalen; t++) {
24393 int64_t val_conv_19 = val_vals[t];
24394 LDKUpdateFulfillHTLC val_conv_19_conv;
24395 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
24396 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
24397 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
24398 val_constr.data[t] = val_conv_19_conv;
24400 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24401 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
24404 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24405 LDKCommitmentUpdate this_ptr_conv;
24406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24407 this_ptr_conv.is_owned = false;
24408 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
24409 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24410 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24411 for (size_t q = 0; q < ret_var.datalen; q++) {
24412 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
24413 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24414 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24415 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
24416 if (ret_conv_16_var.is_owned) {
24417 ret_conv_16_ref |= 1;
24419 ret_arr_ptr[q] = ret_conv_16_ref;
24421 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24422 FREE(ret_var.data);
24426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24427 LDKCommitmentUpdate this_ptr_conv;
24428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24429 this_ptr_conv.is_owned = false;
24430 LDKCVec_UpdateFailHTLCZ val_constr;
24431 val_constr.datalen = (*env)->GetArrayLength(env, val);
24432 if (val_constr.datalen > 0)
24433 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
24435 val_constr.data = NULL;
24436 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24437 for (size_t q = 0; q < val_constr.datalen; q++) {
24438 int64_t val_conv_16 = val_vals[q];
24439 LDKUpdateFailHTLC val_conv_16_conv;
24440 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
24441 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
24442 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
24443 val_constr.data[q] = val_conv_16_conv;
24445 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24446 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
24449 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24450 LDKCommitmentUpdate this_ptr_conv;
24451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24452 this_ptr_conv.is_owned = false;
24453 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
24454 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24455 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24456 for (size_t z = 0; z < ret_var.datalen; z++) {
24457 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
24458 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24459 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24460 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
24461 if (ret_conv_25_var.is_owned) {
24462 ret_conv_25_ref |= 1;
24464 ret_arr_ptr[z] = ret_conv_25_ref;
24466 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24467 FREE(ret_var.data);
24471 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) {
24472 LDKCommitmentUpdate this_ptr_conv;
24473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24474 this_ptr_conv.is_owned = false;
24475 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
24476 val_constr.datalen = (*env)->GetArrayLength(env, val);
24477 if (val_constr.datalen > 0)
24478 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
24480 val_constr.data = NULL;
24481 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24482 for (size_t z = 0; z < val_constr.datalen; z++) {
24483 int64_t val_conv_25 = val_vals[z];
24484 LDKUpdateFailMalformedHTLC val_conv_25_conv;
24485 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
24486 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
24487 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
24488 val_constr.data[z] = val_conv_25_conv;
24490 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24491 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
24494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
24495 LDKCommitmentUpdate this_ptr_conv;
24496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24497 this_ptr_conv.is_owned = false;
24498 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
24499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24501 uint64_t ret_ref = (uint64_t)ret_var.inner;
24502 if (ret_var.is_owned) {
24508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24509 LDKCommitmentUpdate this_ptr_conv;
24510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24511 this_ptr_conv.is_owned = false;
24512 LDKUpdateFee val_conv;
24513 val_conv.inner = (void*)(val & (~1));
24514 val_conv.is_owned = (val & 1) || (val == 0);
24515 val_conv = UpdateFee_clone(&val_conv);
24516 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
24519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
24520 LDKCommitmentUpdate this_ptr_conv;
24521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24522 this_ptr_conv.is_owned = false;
24523 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
24524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24526 uint64_t ret_ref = (uint64_t)ret_var.inner;
24527 if (ret_var.is_owned) {
24533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24534 LDKCommitmentUpdate this_ptr_conv;
24535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24536 this_ptr_conv.is_owned = false;
24537 LDKCommitmentSigned val_conv;
24538 val_conv.inner = (void*)(val & (~1));
24539 val_conv.is_owned = (val & 1) || (val == 0);
24540 val_conv = CommitmentSigned_clone(&val_conv);
24541 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
24544 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) {
24545 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
24546 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
24547 if (update_add_htlcs_arg_constr.datalen > 0)
24548 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
24550 update_add_htlcs_arg_constr.data = NULL;
24551 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
24552 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
24553 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
24554 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
24555 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
24556 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
24557 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
24558 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
24560 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
24561 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
24562 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
24563 if (update_fulfill_htlcs_arg_constr.datalen > 0)
24564 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
24566 update_fulfill_htlcs_arg_constr.data = NULL;
24567 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
24568 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
24569 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
24570 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
24571 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
24572 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
24573 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
24574 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
24576 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
24577 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
24578 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
24579 if (update_fail_htlcs_arg_constr.datalen > 0)
24580 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
24582 update_fail_htlcs_arg_constr.data = NULL;
24583 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
24584 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
24585 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
24586 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
24587 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
24588 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
24589 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
24590 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
24592 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
24593 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
24594 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
24595 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
24596 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
24598 update_fail_malformed_htlcs_arg_constr.data = NULL;
24599 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
24600 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
24601 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
24602 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
24603 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
24604 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);
24605 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
24606 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
24608 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
24609 LDKUpdateFee update_fee_arg_conv;
24610 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
24611 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
24612 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
24613 LDKCommitmentSigned commitment_signed_arg_conv;
24614 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
24615 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
24616 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
24617 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);
24618 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24619 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24620 uint64_t ret_ref = (uint64_t)ret_var.inner;
24621 if (ret_var.is_owned) {
24627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24628 LDKCommitmentUpdate orig_conv;
24629 orig_conv.inner = (void*)(orig & (~1));
24630 orig_conv.is_owned = false;
24631 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
24632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24634 uint64_t ret_ref = (uint64_t)ret_var.inner;
24635 if (ret_var.is_owned) {
24641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24642 if ((this_ptr & 1) != 0) return;
24643 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24644 CHECK_ACCESS(this_ptr_ptr);
24645 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
24646 FREE((void*)this_ptr);
24647 ChannelMessageHandler_free(this_ptr_conv);
24650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24651 if ((this_ptr & 1) != 0) return;
24652 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24653 CHECK_ACCESS(this_ptr_ptr);
24654 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
24655 FREE((void*)this_ptr);
24656 RoutingMessageHandler_free(this_ptr_conv);
24659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
24660 LDKAcceptChannel obj_conv;
24661 obj_conv.inner = (void*)(obj & (~1));
24662 obj_conv.is_owned = false;
24663 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
24664 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24665 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24666 CVec_u8Z_free(ret_var);
24670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24671 LDKu8slice ser_ref;
24672 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24673 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24674 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24675 *ret_conv = AcceptChannel_read(ser_ref);
24676 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24677 return (uint64_t)ret_conv;
24680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24681 LDKAnnouncementSignatures obj_conv;
24682 obj_conv.inner = (void*)(obj & (~1));
24683 obj_conv.is_owned = false;
24684 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
24685 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24686 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24687 CVec_u8Z_free(ret_var);
24691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24692 LDKu8slice ser_ref;
24693 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24694 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24695 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24696 *ret_conv = AnnouncementSignatures_read(ser_ref);
24697 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24698 return (uint64_t)ret_conv;
24701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
24702 LDKChannelReestablish obj_conv;
24703 obj_conv.inner = (void*)(obj & (~1));
24704 obj_conv.is_owned = false;
24705 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
24706 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24707 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24708 CVec_u8Z_free(ret_var);
24712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24713 LDKu8slice ser_ref;
24714 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24715 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24716 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24717 *ret_conv = ChannelReestablish_read(ser_ref);
24718 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24719 return (uint64_t)ret_conv;
24722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24723 LDKClosingSigned obj_conv;
24724 obj_conv.inner = (void*)(obj & (~1));
24725 obj_conv.is_owned = false;
24726 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
24727 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24728 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24729 CVec_u8Z_free(ret_var);
24733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24734 LDKu8slice ser_ref;
24735 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24736 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24737 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24738 *ret_conv = ClosingSigned_read(ser_ref);
24739 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24740 return (uint64_t)ret_conv;
24743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
24744 LDKClosingSignedFeeRange obj_conv;
24745 obj_conv.inner = (void*)(obj & (~1));
24746 obj_conv.is_owned = false;
24747 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
24748 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24749 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24750 CVec_u8Z_free(ret_var);
24754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24755 LDKu8slice ser_ref;
24756 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24757 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24758 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24759 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
24760 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24761 return (uint64_t)ret_conv;
24764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24765 LDKCommitmentSigned obj_conv;
24766 obj_conv.inner = (void*)(obj & (~1));
24767 obj_conv.is_owned = false;
24768 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
24769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24771 CVec_u8Z_free(ret_var);
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24776 LDKu8slice ser_ref;
24777 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24778 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24779 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24780 *ret_conv = CommitmentSigned_read(ser_ref);
24781 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24782 return (uint64_t)ret_conv;
24785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
24786 LDKFundingCreated obj_conv;
24787 obj_conv.inner = (void*)(obj & (~1));
24788 obj_conv.is_owned = false;
24789 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
24790 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24791 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24792 CVec_u8Z_free(ret_var);
24796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24797 LDKu8slice ser_ref;
24798 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24799 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24800 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24801 *ret_conv = FundingCreated_read(ser_ref);
24802 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24803 return (uint64_t)ret_conv;
24806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
24807 LDKFundingSigned obj_conv;
24808 obj_conv.inner = (void*)(obj & (~1));
24809 obj_conv.is_owned = false;
24810 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
24811 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24812 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24813 CVec_u8Z_free(ret_var);
24817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24818 LDKu8slice ser_ref;
24819 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24820 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24821 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24822 *ret_conv = FundingSigned_read(ser_ref);
24823 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24824 return (uint64_t)ret_conv;
24827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
24828 LDKFundingLocked obj_conv;
24829 obj_conv.inner = (void*)(obj & (~1));
24830 obj_conv.is_owned = false;
24831 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
24832 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24833 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24834 CVec_u8Z_free(ret_var);
24838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24839 LDKu8slice ser_ref;
24840 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24841 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24842 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
24843 *ret_conv = FundingLocked_read(ser_ref);
24844 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24845 return (uint64_t)ret_conv;
24848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
24850 obj_conv.inner = (void*)(obj & (~1));
24851 obj_conv.is_owned = false;
24852 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
24853 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24854 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24855 CVec_u8Z_free(ret_var);
24859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24860 LDKu8slice ser_ref;
24861 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24862 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24863 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
24864 *ret_conv = Init_read(ser_ref);
24865 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24866 return (uint64_t)ret_conv;
24869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
24870 LDKOpenChannel obj_conv;
24871 obj_conv.inner = (void*)(obj & (~1));
24872 obj_conv.is_owned = false;
24873 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
24874 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24875 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24876 CVec_u8Z_free(ret_var);
24880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24881 LDKu8slice ser_ref;
24882 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24883 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24884 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
24885 *ret_conv = OpenChannel_read(ser_ref);
24886 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24887 return (uint64_t)ret_conv;
24890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
24891 LDKRevokeAndACK obj_conv;
24892 obj_conv.inner = (void*)(obj & (~1));
24893 obj_conv.is_owned = false;
24894 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
24895 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24896 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24897 CVec_u8Z_free(ret_var);
24901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24902 LDKu8slice ser_ref;
24903 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24904 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24905 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
24906 *ret_conv = RevokeAndACK_read(ser_ref);
24907 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24908 return (uint64_t)ret_conv;
24911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
24912 LDKShutdown obj_conv;
24913 obj_conv.inner = (void*)(obj & (~1));
24914 obj_conv.is_owned = false;
24915 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
24916 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24917 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24918 CVec_u8Z_free(ret_var);
24922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24923 LDKu8slice ser_ref;
24924 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24925 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24926 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
24927 *ret_conv = Shutdown_read(ser_ref);
24928 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24929 return (uint64_t)ret_conv;
24932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24933 LDKUpdateFailHTLC obj_conv;
24934 obj_conv.inner = (void*)(obj & (~1));
24935 obj_conv.is_owned = false;
24936 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
24937 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24938 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24939 CVec_u8Z_free(ret_var);
24943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24944 LDKu8slice ser_ref;
24945 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24946 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24947 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
24948 *ret_conv = UpdateFailHTLC_read(ser_ref);
24949 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24950 return (uint64_t)ret_conv;
24953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24954 LDKUpdateFailMalformedHTLC obj_conv;
24955 obj_conv.inner = (void*)(obj & (~1));
24956 obj_conv.is_owned = false;
24957 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
24958 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24959 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24960 CVec_u8Z_free(ret_var);
24964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24965 LDKu8slice ser_ref;
24966 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24967 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24968 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
24969 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
24970 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24971 return (uint64_t)ret_conv;
24974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
24975 LDKUpdateFee obj_conv;
24976 obj_conv.inner = (void*)(obj & (~1));
24977 obj_conv.is_owned = false;
24978 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
24979 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24980 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24981 CVec_u8Z_free(ret_var);
24985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24986 LDKu8slice ser_ref;
24987 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24988 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24989 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
24990 *ret_conv = UpdateFee_read(ser_ref);
24991 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24992 return (uint64_t)ret_conv;
24995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
24996 LDKUpdateFulfillHTLC obj_conv;
24997 obj_conv.inner = (void*)(obj & (~1));
24998 obj_conv.is_owned = false;
24999 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
25000 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25001 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25002 CVec_u8Z_free(ret_var);
25006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25007 LDKu8slice ser_ref;
25008 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25009 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25010 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25011 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
25012 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25013 return (uint64_t)ret_conv;
25016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
25017 LDKUpdateAddHTLC obj_conv;
25018 obj_conv.inner = (void*)(obj & (~1));
25019 obj_conv.is_owned = false;
25020 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
25021 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25022 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25023 CVec_u8Z_free(ret_var);
25027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25028 LDKu8slice ser_ref;
25029 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25030 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25031 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25032 *ret_conv = UpdateAddHTLC_read(ser_ref);
25033 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25034 return (uint64_t)ret_conv;
25037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
25039 obj_conv.inner = (void*)(obj & (~1));
25040 obj_conv.is_owned = false;
25041 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
25042 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25043 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25044 CVec_u8Z_free(ret_var);
25048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25049 LDKu8slice ser_ref;
25050 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25051 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25052 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25053 *ret_conv = Ping_read(ser_ref);
25054 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25055 return (uint64_t)ret_conv;
25058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
25060 obj_conv.inner = (void*)(obj & (~1));
25061 obj_conv.is_owned = false;
25062 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
25063 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25064 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25065 CVec_u8Z_free(ret_var);
25069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25070 LDKu8slice ser_ref;
25071 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25072 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25073 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25074 *ret_conv = Pong_read(ser_ref);
25075 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25076 return (uint64_t)ret_conv;
25079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
25080 LDKUnsignedChannelAnnouncement obj_conv;
25081 obj_conv.inner = (void*)(obj & (~1));
25082 obj_conv.is_owned = false;
25083 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
25084 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25085 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25086 CVec_u8Z_free(ret_var);
25090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25091 LDKu8slice ser_ref;
25092 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25093 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25094 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25095 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
25096 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25097 return (uint64_t)ret_conv;
25100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
25101 LDKChannelAnnouncement obj_conv;
25102 obj_conv.inner = (void*)(obj & (~1));
25103 obj_conv.is_owned = false;
25104 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
25105 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25106 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25107 CVec_u8Z_free(ret_var);
25111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25112 LDKu8slice ser_ref;
25113 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25114 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25115 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25116 *ret_conv = ChannelAnnouncement_read(ser_ref);
25117 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25118 return (uint64_t)ret_conv;
25121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25122 LDKUnsignedChannelUpdate obj_conv;
25123 obj_conv.inner = (void*)(obj & (~1));
25124 obj_conv.is_owned = false;
25125 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
25126 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25127 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25128 CVec_u8Z_free(ret_var);
25132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25133 LDKu8slice ser_ref;
25134 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25135 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25136 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25137 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
25138 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25139 return (uint64_t)ret_conv;
25142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25143 LDKChannelUpdate obj_conv;
25144 obj_conv.inner = (void*)(obj & (~1));
25145 obj_conv.is_owned = false;
25146 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
25147 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25148 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25149 CVec_u8Z_free(ret_var);
25153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25154 LDKu8slice ser_ref;
25155 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25156 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25157 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25158 *ret_conv = ChannelUpdate_read(ser_ref);
25159 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25160 return (uint64_t)ret_conv;
25163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
25164 LDKErrorMessage obj_conv;
25165 obj_conv.inner = (void*)(obj & (~1));
25166 obj_conv.is_owned = false;
25167 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
25168 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25169 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25170 CVec_u8Z_free(ret_var);
25174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25175 LDKu8slice ser_ref;
25176 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25177 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25178 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25179 *ret_conv = ErrorMessage_read(ser_ref);
25180 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25181 return (uint64_t)ret_conv;
25184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
25185 LDKUnsignedNodeAnnouncement obj_conv;
25186 obj_conv.inner = (void*)(obj & (~1));
25187 obj_conv.is_owned = false;
25188 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
25189 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25190 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25191 CVec_u8Z_free(ret_var);
25195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25196 LDKu8slice ser_ref;
25197 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25198 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25199 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
25200 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
25201 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25202 return (uint64_t)ret_conv;
25205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
25206 LDKNodeAnnouncement obj_conv;
25207 obj_conv.inner = (void*)(obj & (~1));
25208 obj_conv.is_owned = false;
25209 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
25210 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25211 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25212 CVec_u8Z_free(ret_var);
25216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25217 LDKu8slice ser_ref;
25218 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25219 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25220 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
25221 *ret_conv = NodeAnnouncement_read(ser_ref);
25222 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25223 return (uint64_t)ret_conv;
25226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25227 LDKu8slice ser_ref;
25228 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25229 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25230 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
25231 *ret_conv = QueryShortChannelIds_read(ser_ref);
25232 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25233 return (uint64_t)ret_conv;
25236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
25237 LDKQueryShortChannelIds obj_conv;
25238 obj_conv.inner = (void*)(obj & (~1));
25239 obj_conv.is_owned = false;
25240 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
25241 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25242 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25243 CVec_u8Z_free(ret_var);
25247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
25248 LDKReplyShortChannelIdsEnd obj_conv;
25249 obj_conv.inner = (void*)(obj & (~1));
25250 obj_conv.is_owned = false;
25251 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
25252 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25253 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25254 CVec_u8Z_free(ret_var);
25258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25259 LDKu8slice ser_ref;
25260 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25261 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25262 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
25263 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
25264 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25265 return (uint64_t)ret_conv;
25268 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
25269 LDKQueryChannelRange this_arg_conv;
25270 this_arg_conv.inner = (void*)(this_arg & (~1));
25271 this_arg_conv.is_owned = false;
25272 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
25276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
25277 LDKQueryChannelRange obj_conv;
25278 obj_conv.inner = (void*)(obj & (~1));
25279 obj_conv.is_owned = false;
25280 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
25281 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25282 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25283 CVec_u8Z_free(ret_var);
25287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25288 LDKu8slice ser_ref;
25289 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25290 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25291 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
25292 *ret_conv = QueryChannelRange_read(ser_ref);
25293 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25294 return (uint64_t)ret_conv;
25297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25298 LDKu8slice ser_ref;
25299 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25300 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25301 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
25302 *ret_conv = ReplyChannelRange_read(ser_ref);
25303 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25304 return (uint64_t)ret_conv;
25307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
25308 LDKReplyChannelRange obj_conv;
25309 obj_conv.inner = (void*)(obj & (~1));
25310 obj_conv.is_owned = false;
25311 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
25312 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25313 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25314 CVec_u8Z_free(ret_var);
25318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
25319 LDKGossipTimestampFilter obj_conv;
25320 obj_conv.inner = (void*)(obj & (~1));
25321 obj_conv.is_owned = false;
25322 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
25323 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25324 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25325 CVec_u8Z_free(ret_var);
25329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25330 LDKu8slice ser_ref;
25331 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25332 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25333 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
25334 *ret_conv = GossipTimestampFilter_read(ser_ref);
25335 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25336 return (uint64_t)ret_conv;
25339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25340 if ((this_ptr & 1) != 0) return;
25341 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25342 CHECK_ACCESS(this_ptr_ptr);
25343 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
25344 FREE((void*)this_ptr);
25345 CustomMessageHandler_free(this_ptr_conv);
25348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25349 LDKIgnoringMessageHandler this_obj_conv;
25350 this_obj_conv.inner = (void*)(this_obj & (~1));
25351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25352 IgnoringMessageHandler_free(this_obj_conv);
25355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
25356 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
25357 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25358 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25359 uint64_t ret_ref = (uint64_t)ret_var.inner;
25360 if (ret_var.is_owned) {
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25367 LDKIgnoringMessageHandler this_arg_conv;
25368 this_arg_conv.inner = (void*)(this_arg & (~1));
25369 this_arg_conv.is_owned = false;
25370 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25371 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
25372 return (uint64_t)ret_ret;
25375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25376 LDKIgnoringMessageHandler this_arg_conv;
25377 this_arg_conv.inner = (void*)(this_arg & (~1));
25378 this_arg_conv.is_owned = false;
25379 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
25380 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
25381 return (uint64_t)ret_ret;
25384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
25385 LDKIgnoringMessageHandler this_arg_conv;
25386 this_arg_conv.inner = (void*)(this_arg & (~1));
25387 this_arg_conv.is_owned = false;
25388 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
25389 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
25390 return (uint64_t)ret_ret;
25393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25394 LDKIgnoringMessageHandler this_arg_conv;
25395 this_arg_conv.inner = (void*)(this_arg & (~1));
25396 this_arg_conv.is_owned = false;
25397 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
25398 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
25399 return (uint64_t)ret_ret;
25402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25403 LDKErroringMessageHandler this_obj_conv;
25404 this_obj_conv.inner = (void*)(this_obj & (~1));
25405 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25406 ErroringMessageHandler_free(this_obj_conv);
25409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
25410 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
25411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25413 uint64_t ret_ref = (uint64_t)ret_var.inner;
25414 if (ret_var.is_owned) {
25420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25421 LDKErroringMessageHandler this_arg_conv;
25422 this_arg_conv.inner = (void*)(this_arg & (~1));
25423 this_arg_conv.is_owned = false;
25424 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25425 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
25426 return (uint64_t)ret_ret;
25429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25430 LDKErroringMessageHandler this_arg_conv;
25431 this_arg_conv.inner = (void*)(this_arg & (~1));
25432 this_arg_conv.is_owned = false;
25433 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
25434 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
25435 return (uint64_t)ret_ret;
25438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25439 LDKMessageHandler this_obj_conv;
25440 this_obj_conv.inner = (void*)(this_obj & (~1));
25441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25442 MessageHandler_free(this_obj_conv);
25445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
25446 LDKMessageHandler this_ptr_conv;
25447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25448 this_ptr_conv.is_owned = false;
25449 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
25453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25454 LDKMessageHandler this_ptr_conv;
25455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25456 this_ptr_conv.is_owned = false;
25457 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25458 CHECK_ACCESS(val_ptr);
25459 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
25460 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
25461 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25462 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
25464 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
25467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
25468 LDKMessageHandler this_ptr_conv;
25469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25470 this_ptr_conv.is_owned = false;
25471 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
25475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25476 LDKMessageHandler this_ptr_conv;
25477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25478 this_ptr_conv.is_owned = false;
25479 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25480 CHECK_ACCESS(val_ptr);
25481 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
25482 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
25483 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25484 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
25486 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
25489 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) {
25490 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
25491 CHECK_ACCESS(chan_handler_arg_ptr);
25492 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
25493 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
25494 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25495 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
25497 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
25498 CHECK_ACCESS(route_handler_arg_ptr);
25499 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
25500 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
25501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25502 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
25504 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
25505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25507 uint64_t ret_ref = (uint64_t)ret_var.inner;
25508 if (ret_var.is_owned) {
25514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25515 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
25516 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
25517 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
25518 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
25519 *ret_ret = SocketDescriptor_clone(orig_conv);
25520 return (uint64_t)ret_ret;
25523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25524 if ((this_ptr & 1) != 0) return;
25525 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25526 CHECK_ACCESS(this_ptr_ptr);
25527 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
25528 FREE((void*)this_ptr);
25529 SocketDescriptor_free(this_ptr_conv);
25532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25533 LDKPeerHandleError this_obj_conv;
25534 this_obj_conv.inner = (void*)(this_obj & (~1));
25535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25536 PeerHandleError_free(this_obj_conv);
25539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
25540 LDKPeerHandleError this_ptr_conv;
25541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25542 this_ptr_conv.is_owned = false;
25543 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
25547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25548 LDKPeerHandleError this_ptr_conv;
25549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25550 this_ptr_conv.is_owned = false;
25551 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
25554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
25555 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
25556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25558 uint64_t ret_ref = (uint64_t)ret_var.inner;
25559 if (ret_var.is_owned) {
25565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25566 LDKPeerHandleError orig_conv;
25567 orig_conv.inner = (void*)(orig & (~1));
25568 orig_conv.is_owned = false;
25569 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
25570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25572 uint64_t ret_ref = (uint64_t)ret_var.inner;
25573 if (ret_var.is_owned) {
25579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25580 LDKPeerManager this_obj_conv;
25581 this_obj_conv.inner = (void*)(this_obj & (~1));
25582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25583 PeerManager_free(this_obj_conv);
25586 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) {
25587 LDKMessageHandler message_handler_conv;
25588 message_handler_conv.inner = (void*)(message_handler & (~1));
25589 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
25590 // Warning: we need a move here but no clone is available for LDKMessageHandler
25591 LDKSecretKey our_node_secret_ref;
25592 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
25593 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
25594 unsigned char ephemeral_random_data_arr[32];
25595 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
25596 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
25597 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
25598 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
25599 CHECK_ACCESS(logger_ptr);
25600 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25601 if (logger_conv.free == LDKLogger_JCalls_free) {
25602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25603 LDKLogger_JCalls_cloned(&logger_conv);
25605 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
25606 CHECK_ACCESS(custom_message_handler_ptr);
25607 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
25608 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
25609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25610 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
25612 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
25613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25615 uint64_t ret_ref = (uint64_t)ret_var.inner;
25616 if (ret_var.is_owned) {
25622 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
25623 LDKPeerManager this_arg_conv;
25624 this_arg_conv.inner = (void*)(this_arg & (~1));
25625 this_arg_conv.is_owned = false;
25626 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
25627 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
25629 for (size_t i = 0; i < ret_var.datalen; i++) {
25630 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
25631 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
25632 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
25634 FREE(ret_var.data);
25638 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) {
25639 LDKPeerManager this_arg_conv;
25640 this_arg_conv.inner = (void*)(this_arg & (~1));
25641 this_arg_conv.is_owned = false;
25642 LDKPublicKey their_node_id_ref;
25643 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
25644 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
25645 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
25646 CHECK_ACCESS(descriptor_ptr);
25647 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
25648 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
25649 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25650 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
25652 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
25653 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
25654 return (uint64_t)ret_conv;
25657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
25658 LDKPeerManager this_arg_conv;
25659 this_arg_conv.inner = (void*)(this_arg & (~1));
25660 this_arg_conv.is_owned = false;
25661 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
25662 CHECK_ACCESS(descriptor_ptr);
25663 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
25664 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
25665 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25666 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
25668 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
25669 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
25670 return (uint64_t)ret_conv;
25673 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) {
25674 LDKPeerManager this_arg_conv;
25675 this_arg_conv.inner = (void*)(this_arg & (~1));
25676 this_arg_conv.is_owned = false;
25677 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
25678 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
25679 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
25680 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
25681 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
25682 return (uint64_t)ret_conv;
25685 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) {
25686 LDKPeerManager this_arg_conv;
25687 this_arg_conv.inner = (void*)(this_arg & (~1));
25688 this_arg_conv.is_owned = false;
25689 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
25690 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
25691 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
25692 LDKu8slice data_ref;
25693 data_ref.datalen = (*env)->GetArrayLength(env, data);
25694 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
25695 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
25696 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
25697 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
25698 return (uint64_t)ret_conv;
25701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25702 LDKPeerManager this_arg_conv;
25703 this_arg_conv.inner = (void*)(this_arg & (~1));
25704 this_arg_conv.is_owned = false;
25705 PeerManager_process_events(&this_arg_conv);
25708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
25709 LDKPeerManager this_arg_conv;
25710 this_arg_conv.inner = (void*)(this_arg & (~1));
25711 this_arg_conv.is_owned = false;
25712 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
25713 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
25714 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
25715 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
25718 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) {
25719 LDKPeerManager this_arg_conv;
25720 this_arg_conv.inner = (void*)(this_arg & (~1));
25721 this_arg_conv.is_owned = false;
25722 LDKPublicKey node_id_ref;
25723 CHECK((*env)->GetArrayLength(env, node_id) == 33);
25724 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25725 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
25728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
25729 LDKPeerManager this_arg_conv;
25730 this_arg_conv.inner = (void*)(this_arg & (~1));
25731 this_arg_conv.is_owned = false;
25732 PeerManager_timer_tick_occurred(&this_arg_conv);
25735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
25736 unsigned char commitment_seed_arr[32];
25737 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
25738 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
25739 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
25740 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25741 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
25745 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) {
25746 LDKCVec_u8Z to_holder_script_ref;
25747 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
25748 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25749 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
25750 LDKCVec_u8Z to_counterparty_script_ref;
25751 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
25752 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25753 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
25754 LDKOutPoint funding_outpoint_conv;
25755 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25756 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25757 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25758 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);
25759 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25760 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25761 Transaction_free(ret_var);
25765 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) {
25766 LDKPublicKey per_commitment_point_ref;
25767 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25768 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25769 unsigned char base_secret_arr[32];
25770 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
25771 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
25772 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
25773 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
25774 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
25775 return (uint64_t)ret_conv;
25778 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) {
25779 LDKPublicKey per_commitment_point_ref;
25780 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25781 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25782 LDKPublicKey base_point_ref;
25783 CHECK((*env)->GetArrayLength(env, base_point) == 33);
25784 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
25785 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25786 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
25787 return (uint64_t)ret_conv;
25790 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) {
25791 unsigned char per_commitment_secret_arr[32];
25792 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
25793 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
25794 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
25795 unsigned char countersignatory_revocation_base_secret_arr[32];
25796 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
25797 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
25798 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
25799 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
25800 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
25801 return (uint64_t)ret_conv;
25804 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) {
25805 LDKPublicKey per_commitment_point_ref;
25806 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
25807 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
25808 LDKPublicKey countersignatory_revocation_base_point_ref;
25809 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
25810 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
25811 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25812 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
25813 return (uint64_t)ret_conv;
25816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25817 LDKTxCreationKeys this_obj_conv;
25818 this_obj_conv.inner = (void*)(this_obj & (~1));
25819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25820 TxCreationKeys_free(this_obj_conv);
25823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
25824 LDKTxCreationKeys this_ptr_conv;
25825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25826 this_ptr_conv.is_owned = false;
25827 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25828 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
25832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25833 LDKTxCreationKeys this_ptr_conv;
25834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25835 this_ptr_conv.is_owned = false;
25836 LDKPublicKey val_ref;
25837 CHECK((*env)->GetArrayLength(env, val) == 33);
25838 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25839 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
25842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25843 LDKTxCreationKeys this_ptr_conv;
25844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25845 this_ptr_conv.is_owned = false;
25846 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
25851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25852 LDKTxCreationKeys this_ptr_conv;
25853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25854 this_ptr_conv.is_owned = false;
25855 LDKPublicKey val_ref;
25856 CHECK((*env)->GetArrayLength(env, val) == 33);
25857 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25858 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
25861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25862 LDKTxCreationKeys this_ptr_conv;
25863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25864 this_ptr_conv.is_owned = false;
25865 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
25870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25871 LDKTxCreationKeys this_ptr_conv;
25872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25873 this_ptr_conv.is_owned = false;
25874 LDKPublicKey val_ref;
25875 CHECK((*env)->GetArrayLength(env, val) == 33);
25876 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25877 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
25880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25881 LDKTxCreationKeys this_ptr_conv;
25882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25883 this_ptr_conv.is_owned = false;
25884 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25885 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
25889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25890 LDKTxCreationKeys this_ptr_conv;
25891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25892 this_ptr_conv.is_owned = false;
25893 LDKPublicKey val_ref;
25894 CHECK((*env)->GetArrayLength(env, val) == 33);
25895 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25896 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
25899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25900 LDKTxCreationKeys this_ptr_conv;
25901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25902 this_ptr_conv.is_owned = false;
25903 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25904 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
25908 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) {
25909 LDKTxCreationKeys this_ptr_conv;
25910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25911 this_ptr_conv.is_owned = false;
25912 LDKPublicKey val_ref;
25913 CHECK((*env)->GetArrayLength(env, val) == 33);
25914 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25915 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
25918 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) {
25919 LDKPublicKey per_commitment_point_arg_ref;
25920 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
25921 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
25922 LDKPublicKey revocation_key_arg_ref;
25923 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
25924 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
25925 LDKPublicKey broadcaster_htlc_key_arg_ref;
25926 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
25927 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
25928 LDKPublicKey countersignatory_htlc_key_arg_ref;
25929 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
25930 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
25931 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
25932 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
25933 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
25934 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);
25935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25937 uint64_t ret_ref = (uint64_t)ret_var.inner;
25938 if (ret_var.is_owned) {
25944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25945 LDKTxCreationKeys orig_conv;
25946 orig_conv.inner = (void*)(orig & (~1));
25947 orig_conv.is_owned = false;
25948 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
25949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25951 uint64_t ret_ref = (uint64_t)ret_var.inner;
25952 if (ret_var.is_owned) {
25958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
25959 LDKTxCreationKeys obj_conv;
25960 obj_conv.inner = (void*)(obj & (~1));
25961 obj_conv.is_owned = false;
25962 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
25963 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25964 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25965 CVec_u8Z_free(ret_var);
25969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25970 LDKu8slice ser_ref;
25971 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25972 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25973 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
25974 *ret_conv = TxCreationKeys_read(ser_ref);
25975 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25976 return (uint64_t)ret_conv;
25979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25980 LDKChannelPublicKeys this_obj_conv;
25981 this_obj_conv.inner = (void*)(this_obj & (~1));
25982 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25983 ChannelPublicKeys_free(this_obj_conv);
25986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25987 LDKChannelPublicKeys this_ptr_conv;
25988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25989 this_ptr_conv.is_owned = false;
25990 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25991 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
25995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25996 LDKChannelPublicKeys this_ptr_conv;
25997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25998 this_ptr_conv.is_owned = false;
25999 LDKPublicKey val_ref;
26000 CHECK((*env)->GetArrayLength(env, val) == 33);
26001 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26002 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
26005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26006 LDKChannelPublicKeys this_ptr_conv;
26007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26008 this_ptr_conv.is_owned = false;
26009 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26010 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
26014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26015 LDKChannelPublicKeys this_ptr_conv;
26016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26017 this_ptr_conv.is_owned = false;
26018 LDKPublicKey val_ref;
26019 CHECK((*env)->GetArrayLength(env, val) == 33);
26020 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26021 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
26024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26025 LDKChannelPublicKeys this_ptr_conv;
26026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26027 this_ptr_conv.is_owned = false;
26028 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26029 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
26033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26034 LDKChannelPublicKeys this_ptr_conv;
26035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26036 this_ptr_conv.is_owned = false;
26037 LDKPublicKey val_ref;
26038 CHECK((*env)->GetArrayLength(env, val) == 33);
26039 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26040 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
26043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26044 LDKChannelPublicKeys this_ptr_conv;
26045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26046 this_ptr_conv.is_owned = false;
26047 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26048 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
26052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26053 LDKChannelPublicKeys this_ptr_conv;
26054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26055 this_ptr_conv.is_owned = false;
26056 LDKPublicKey val_ref;
26057 CHECK((*env)->GetArrayLength(env, val) == 33);
26058 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26059 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26063 LDKChannelPublicKeys this_ptr_conv;
26064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26065 this_ptr_conv.is_owned = false;
26066 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26067 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
26071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26072 LDKChannelPublicKeys this_ptr_conv;
26073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26074 this_ptr_conv.is_owned = false;
26075 LDKPublicKey val_ref;
26076 CHECK((*env)->GetArrayLength(env, val) == 33);
26077 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26078 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
26081 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) {
26082 LDKPublicKey funding_pubkey_arg_ref;
26083 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
26084 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
26085 LDKPublicKey revocation_basepoint_arg_ref;
26086 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
26087 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
26088 LDKPublicKey payment_point_arg_ref;
26089 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
26090 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
26091 LDKPublicKey delayed_payment_basepoint_arg_ref;
26092 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
26093 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
26094 LDKPublicKey htlc_basepoint_arg_ref;
26095 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
26096 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
26097 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);
26098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26100 uint64_t ret_ref = (uint64_t)ret_var.inner;
26101 if (ret_var.is_owned) {
26107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26108 LDKChannelPublicKeys orig_conv;
26109 orig_conv.inner = (void*)(orig & (~1));
26110 orig_conv.is_owned = false;
26111 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
26112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26114 uint64_t ret_ref = (uint64_t)ret_var.inner;
26115 if (ret_var.is_owned) {
26121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
26122 LDKChannelPublicKeys obj_conv;
26123 obj_conv.inner = (void*)(obj & (~1));
26124 obj_conv.is_owned = false;
26125 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
26126 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26127 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26128 CVec_u8Z_free(ret_var);
26132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26133 LDKu8slice ser_ref;
26134 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26135 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26136 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
26137 *ret_conv = ChannelPublicKeys_read(ser_ref);
26138 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26139 return (uint64_t)ret_conv;
26142 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) {
26143 LDKPublicKey per_commitment_point_ref;
26144 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
26145 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
26146 LDKPublicKey broadcaster_delayed_payment_base_ref;
26147 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
26148 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
26149 LDKPublicKey broadcaster_htlc_base_ref;
26150 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
26151 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
26152 LDKPublicKey countersignatory_revocation_base_ref;
26153 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
26154 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
26155 LDKPublicKey countersignatory_htlc_base_ref;
26156 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
26157 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
26158 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
26159 *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);
26160 return (uint64_t)ret_conv;
26163 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) {
26164 LDKPublicKey per_commitment_point_ref;
26165 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
26166 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
26167 LDKChannelPublicKeys broadcaster_keys_conv;
26168 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
26169 broadcaster_keys_conv.is_owned = false;
26170 LDKChannelPublicKeys countersignatory_keys_conv;
26171 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
26172 countersignatory_keys_conv.is_owned = false;
26173 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
26174 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
26175 return (uint64_t)ret_conv;
26178 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) {
26179 LDKPublicKey revocation_key_ref;
26180 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
26181 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
26182 LDKPublicKey broadcaster_delayed_payment_key_ref;
26183 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
26184 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
26185 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
26186 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26187 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26188 CVec_u8Z_free(ret_var);
26192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26193 LDKHTLCOutputInCommitment this_obj_conv;
26194 this_obj_conv.inner = (void*)(this_obj & (~1));
26195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26196 HTLCOutputInCommitment_free(this_obj_conv);
26199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
26200 LDKHTLCOutputInCommitment this_ptr_conv;
26201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26202 this_ptr_conv.is_owned = false;
26203 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
26207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26208 LDKHTLCOutputInCommitment this_ptr_conv;
26209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26210 this_ptr_conv.is_owned = false;
26211 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
26214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26215 LDKHTLCOutputInCommitment this_ptr_conv;
26216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26217 this_ptr_conv.is_owned = false;
26218 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
26222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26223 LDKHTLCOutputInCommitment this_ptr_conv;
26224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26225 this_ptr_conv.is_owned = false;
26226 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
26229 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
26230 LDKHTLCOutputInCommitment this_ptr_conv;
26231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26232 this_ptr_conv.is_owned = false;
26233 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
26237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26238 LDKHTLCOutputInCommitment this_ptr_conv;
26239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26240 this_ptr_conv.is_owned = false;
26241 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
26244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
26245 LDKHTLCOutputInCommitment this_ptr_conv;
26246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26247 this_ptr_conv.is_owned = false;
26248 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26249 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
26253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26254 LDKHTLCOutputInCommitment this_ptr_conv;
26255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26256 this_ptr_conv.is_owned = false;
26257 LDKThirtyTwoBytes val_ref;
26258 CHECK((*env)->GetArrayLength(env, val) == 32);
26259 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26260 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
26263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26264 LDKHTLCOutputInCommitment this_ptr_conv;
26265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26266 this_ptr_conv.is_owned = false;
26267 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26268 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
26269 uint64_t ret_ref = (uint64_t)ret_copy;
26273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26274 LDKHTLCOutputInCommitment this_ptr_conv;
26275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26276 this_ptr_conv.is_owned = false;
26277 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26278 CHECK_ACCESS(val_ptr);
26279 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26280 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
26281 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
26284 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) {
26285 LDKThirtyTwoBytes payment_hash_arg_ref;
26286 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
26287 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
26288 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
26289 CHECK_ACCESS(transaction_output_index_arg_ptr);
26290 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
26291 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
26292 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
26293 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26294 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26295 uint64_t ret_ref = (uint64_t)ret_var.inner;
26296 if (ret_var.is_owned) {
26302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26303 LDKHTLCOutputInCommitment orig_conv;
26304 orig_conv.inner = (void*)(orig & (~1));
26305 orig_conv.is_owned = false;
26306 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
26307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26309 uint64_t ret_ref = (uint64_t)ret_var.inner;
26310 if (ret_var.is_owned) {
26316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
26317 LDKHTLCOutputInCommitment obj_conv;
26318 obj_conv.inner = (void*)(obj & (~1));
26319 obj_conv.is_owned = false;
26320 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
26321 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26322 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26323 CVec_u8Z_free(ret_var);
26327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26328 LDKu8slice ser_ref;
26329 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26330 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26331 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
26332 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
26333 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26334 return (uint64_t)ret_conv;
26337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
26338 LDKHTLCOutputInCommitment htlc_conv;
26339 htlc_conv.inner = (void*)(htlc & (~1));
26340 htlc_conv.is_owned = false;
26341 LDKTxCreationKeys keys_conv;
26342 keys_conv.inner = (void*)(keys & (~1));
26343 keys_conv.is_owned = false;
26344 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
26345 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26346 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26347 CVec_u8Z_free(ret_var);
26351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
26352 LDKPublicKey broadcaster_ref;
26353 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
26354 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
26355 LDKPublicKey countersignatory_ref;
26356 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
26357 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
26358 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
26359 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26360 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26361 CVec_u8Z_free(ret_var);
26365 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) {
26366 unsigned char commitment_txid_arr[32];
26367 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
26368 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
26369 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
26370 LDKHTLCOutputInCommitment htlc_conv;
26371 htlc_conv.inner = (void*)(htlc & (~1));
26372 htlc_conv.is_owned = false;
26373 LDKPublicKey broadcaster_delayed_payment_key_ref;
26374 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
26375 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
26376 LDKPublicKey revocation_key_ref;
26377 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
26378 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
26379 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
26380 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26381 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26382 Transaction_free(ret_var);
26386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26387 LDKChannelTransactionParameters this_obj_conv;
26388 this_obj_conv.inner = (void*)(this_obj & (~1));
26389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26390 ChannelTransactionParameters_free(this_obj_conv);
26393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
26394 LDKChannelTransactionParameters this_ptr_conv;
26395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26396 this_ptr_conv.is_owned = false;
26397 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
26398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26400 uint64_t ret_ref = (uint64_t)ret_var.inner;
26401 if (ret_var.is_owned) {
26407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26408 LDKChannelTransactionParameters this_ptr_conv;
26409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26410 this_ptr_conv.is_owned = false;
26411 LDKChannelPublicKeys val_conv;
26412 val_conv.inner = (void*)(val & (~1));
26413 val_conv.is_owned = (val & 1) || (val == 0);
26414 val_conv = ChannelPublicKeys_clone(&val_conv);
26415 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
26418 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26419 LDKChannelTransactionParameters this_ptr_conv;
26420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26421 this_ptr_conv.is_owned = false;
26422 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
26426 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) {
26427 LDKChannelTransactionParameters this_ptr_conv;
26428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26429 this_ptr_conv.is_owned = false;
26430 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
26433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
26434 LDKChannelTransactionParameters this_ptr_conv;
26435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26436 this_ptr_conv.is_owned = false;
26437 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
26441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26442 LDKChannelTransactionParameters this_ptr_conv;
26443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26444 this_ptr_conv.is_owned = false;
26445 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
26448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
26449 LDKChannelTransactionParameters this_ptr_conv;
26450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26451 this_ptr_conv.is_owned = false;
26452 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
26453 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26454 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26455 uint64_t ret_ref = (uint64_t)ret_var.inner;
26456 if (ret_var.is_owned) {
26462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26463 LDKChannelTransactionParameters this_ptr_conv;
26464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26465 this_ptr_conv.is_owned = false;
26466 LDKCounterpartyChannelTransactionParameters val_conv;
26467 val_conv.inner = (void*)(val & (~1));
26468 val_conv.is_owned = (val & 1) || (val == 0);
26469 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
26470 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
26473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26474 LDKChannelTransactionParameters this_ptr_conv;
26475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26476 this_ptr_conv.is_owned = false;
26477 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
26478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26480 uint64_t ret_ref = (uint64_t)ret_var.inner;
26481 if (ret_var.is_owned) {
26487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26488 LDKChannelTransactionParameters this_ptr_conv;
26489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26490 this_ptr_conv.is_owned = false;
26491 LDKOutPoint val_conv;
26492 val_conv.inner = (void*)(val & (~1));
26493 val_conv.is_owned = (val & 1) || (val == 0);
26494 val_conv = OutPoint_clone(&val_conv);
26495 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
26498 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) {
26499 LDKChannelPublicKeys holder_pubkeys_arg_conv;
26500 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
26501 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
26502 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
26503 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
26504 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
26505 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
26506 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
26507 LDKOutPoint funding_outpoint_arg_conv;
26508 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
26509 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
26510 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
26511 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);
26512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26514 uint64_t ret_ref = (uint64_t)ret_var.inner;
26515 if (ret_var.is_owned) {
26521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26522 LDKChannelTransactionParameters orig_conv;
26523 orig_conv.inner = (void*)(orig & (~1));
26524 orig_conv.is_owned = false;
26525 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
26526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26528 uint64_t ret_ref = (uint64_t)ret_var.inner;
26529 if (ret_var.is_owned) {
26535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26536 LDKCounterpartyChannelTransactionParameters this_obj_conv;
26537 this_obj_conv.inner = (void*)(this_obj & (~1));
26538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26539 CounterpartyChannelTransactionParameters_free(this_obj_conv);
26542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
26543 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
26544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26545 this_ptr_conv.is_owned = false;
26546 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
26547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26549 uint64_t ret_ref = (uint64_t)ret_var.inner;
26550 if (ret_var.is_owned) {
26556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26557 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
26558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26559 this_ptr_conv.is_owned = false;
26560 LDKChannelPublicKeys val_conv;
26561 val_conv.inner = (void*)(val & (~1));
26562 val_conv.is_owned = (val & 1) || (val == 0);
26563 val_conv = ChannelPublicKeys_clone(&val_conv);
26564 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
26567 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26568 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
26569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26570 this_ptr_conv.is_owned = false;
26571 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
26575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26576 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
26577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26578 this_ptr_conv.is_owned = false;
26579 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
26582 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) {
26583 LDKChannelPublicKeys pubkeys_arg_conv;
26584 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
26585 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
26586 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
26587 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
26588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26590 uint64_t ret_ref = (uint64_t)ret_var.inner;
26591 if (ret_var.is_owned) {
26597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26598 LDKCounterpartyChannelTransactionParameters orig_conv;
26599 orig_conv.inner = (void*)(orig & (~1));
26600 orig_conv.is_owned = false;
26601 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_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 jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
26612 LDKChannelTransactionParameters this_arg_conv;
26613 this_arg_conv.inner = (void*)(this_arg & (~1));
26614 this_arg_conv.is_owned = false;
26615 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
26619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
26620 LDKChannelTransactionParameters this_arg_conv;
26621 this_arg_conv.inner = (void*)(this_arg & (~1));
26622 this_arg_conv.is_owned = false;
26623 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
26624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26626 uint64_t ret_ref = (uint64_t)ret_var.inner;
26627 if (ret_var.is_owned) {
26633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
26634 LDKChannelTransactionParameters this_arg_conv;
26635 this_arg_conv.inner = (void*)(this_arg & (~1));
26636 this_arg_conv.is_owned = false;
26637 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
26638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26640 uint64_t ret_ref = (uint64_t)ret_var.inner;
26641 if (ret_var.is_owned) {
26647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
26648 LDKCounterpartyChannelTransactionParameters obj_conv;
26649 obj_conv.inner = (void*)(obj & (~1));
26650 obj_conv.is_owned = false;
26651 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
26652 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26653 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26654 CVec_u8Z_free(ret_var);
26658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26659 LDKu8slice ser_ref;
26660 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26661 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26662 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
26663 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
26664 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26665 return (uint64_t)ret_conv;
26668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
26669 LDKChannelTransactionParameters obj_conv;
26670 obj_conv.inner = (void*)(obj & (~1));
26671 obj_conv.is_owned = false;
26672 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
26673 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26674 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26675 CVec_u8Z_free(ret_var);
26679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26680 LDKu8slice ser_ref;
26681 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26682 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26683 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
26684 *ret_conv = ChannelTransactionParameters_read(ser_ref);
26685 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26686 return (uint64_t)ret_conv;
26689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26690 LDKDirectedChannelTransactionParameters this_obj_conv;
26691 this_obj_conv.inner = (void*)(this_obj & (~1));
26692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26693 DirectedChannelTransactionParameters_free(this_obj_conv);
26696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26697 LDKDirectedChannelTransactionParameters this_arg_conv;
26698 this_arg_conv.inner = (void*)(this_arg & (~1));
26699 this_arg_conv.is_owned = false;
26700 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_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_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26711 LDKDirectedChannelTransactionParameters this_arg_conv;
26712 this_arg_conv.inner = (void*)(this_arg & (~1));
26713 this_arg_conv.is_owned = false;
26714 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_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 int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
26725 LDKDirectedChannelTransactionParameters this_arg_conv;
26726 this_arg_conv.inner = (void*)(this_arg & (~1));
26727 this_arg_conv.is_owned = false;
26728 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
26732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
26733 LDKDirectedChannelTransactionParameters this_arg_conv;
26734 this_arg_conv.inner = (void*)(this_arg & (~1));
26735 this_arg_conv.is_owned = false;
26736 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
26740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
26741 LDKDirectedChannelTransactionParameters this_arg_conv;
26742 this_arg_conv.inner = (void*)(this_arg & (~1));
26743 this_arg_conv.is_owned = false;
26744 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
26745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26747 uint64_t ret_ref = (uint64_t)ret_var.inner;
26748 if (ret_var.is_owned) {
26754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26755 LDKHolderCommitmentTransaction this_obj_conv;
26756 this_obj_conv.inner = (void*)(this_obj & (~1));
26757 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26758 HolderCommitmentTransaction_free(this_obj_conv);
26761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
26762 LDKHolderCommitmentTransaction this_ptr_conv;
26763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26764 this_ptr_conv.is_owned = false;
26765 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
26766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
26770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26771 LDKHolderCommitmentTransaction this_ptr_conv;
26772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26773 this_ptr_conv.is_owned = false;
26774 LDKSignature val_ref;
26775 CHECK((*env)->GetArrayLength(env, val) == 64);
26776 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
26777 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
26780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
26781 LDKHolderCommitmentTransaction this_ptr_conv;
26782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26783 this_ptr_conv.is_owned = false;
26784 LDKCVec_SignatureZ val_constr;
26785 val_constr.datalen = (*env)->GetArrayLength(env, val);
26786 if (val_constr.datalen > 0)
26787 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
26789 val_constr.data = NULL;
26790 for (size_t i = 0; i < val_constr.datalen; i++) {
26791 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
26792 LDKSignature val_conv_8_ref;
26793 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
26794 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
26795 val_constr.data[i] = val_conv_8_ref;
26797 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
26800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26801 LDKHolderCommitmentTransaction orig_conv;
26802 orig_conv.inner = (void*)(orig & (~1));
26803 orig_conv.is_owned = false;
26804 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
26805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26807 uint64_t ret_ref = (uint64_t)ret_var.inner;
26808 if (ret_var.is_owned) {
26814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
26815 LDKHolderCommitmentTransaction obj_conv;
26816 obj_conv.inner = (void*)(obj & (~1));
26817 obj_conv.is_owned = false;
26818 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
26819 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26820 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26821 CVec_u8Z_free(ret_var);
26825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26826 LDKu8slice ser_ref;
26827 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26828 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26829 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
26830 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
26831 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26832 return (uint64_t)ret_conv;
26835 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) {
26836 LDKCommitmentTransaction commitment_tx_conv;
26837 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
26838 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
26839 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
26840 LDKSignature counterparty_sig_ref;
26841 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
26842 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
26843 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
26844 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
26845 if (counterparty_htlc_sigs_constr.datalen > 0)
26846 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
26848 counterparty_htlc_sigs_constr.data = NULL;
26849 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
26850 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
26851 LDKSignature counterparty_htlc_sigs_conv_8_ref;
26852 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
26853 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
26854 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
26856 LDKPublicKey holder_funding_key_ref;
26857 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
26858 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
26859 LDKPublicKey counterparty_funding_key_ref;
26860 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
26861 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
26862 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
26863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26865 uint64_t ret_ref = (uint64_t)ret_var.inner;
26866 if (ret_var.is_owned) {
26872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26873 LDKBuiltCommitmentTransaction this_obj_conv;
26874 this_obj_conv.inner = (void*)(this_obj & (~1));
26875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26876 BuiltCommitmentTransaction_free(this_obj_conv);
26879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
26880 LDKBuiltCommitmentTransaction this_ptr_conv;
26881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26882 this_ptr_conv.is_owned = false;
26883 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
26884 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26885 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26886 Transaction_free(ret_var);
26890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26891 LDKBuiltCommitmentTransaction this_ptr_conv;
26892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26893 this_ptr_conv.is_owned = false;
26894 LDKTransaction val_ref;
26895 val_ref.datalen = (*env)->GetArrayLength(env, val);
26896 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
26897 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26898 val_ref.data_is_owned = true;
26899 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
26902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26903 LDKBuiltCommitmentTransaction this_ptr_conv;
26904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26905 this_ptr_conv.is_owned = false;
26906 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26907 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
26911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26912 LDKBuiltCommitmentTransaction this_ptr_conv;
26913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26914 this_ptr_conv.is_owned = false;
26915 LDKThirtyTwoBytes val_ref;
26916 CHECK((*env)->GetArrayLength(env, val) == 32);
26917 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26918 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
26921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
26922 LDKTransaction transaction_arg_ref;
26923 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
26924 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
26925 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
26926 transaction_arg_ref.data_is_owned = true;
26927 LDKThirtyTwoBytes txid_arg_ref;
26928 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26929 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26930 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
26931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26933 uint64_t ret_ref = (uint64_t)ret_var.inner;
26934 if (ret_var.is_owned) {
26940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26941 LDKBuiltCommitmentTransaction orig_conv;
26942 orig_conv.inner = (void*)(orig & (~1));
26943 orig_conv.is_owned = false;
26944 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
26945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26947 uint64_t ret_ref = (uint64_t)ret_var.inner;
26948 if (ret_var.is_owned) {
26954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
26955 LDKBuiltCommitmentTransaction obj_conv;
26956 obj_conv.inner = (void*)(obj & (~1));
26957 obj_conv.is_owned = false;
26958 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
26959 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26960 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26961 CVec_u8Z_free(ret_var);
26965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26966 LDKu8slice ser_ref;
26967 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26968 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26969 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
26970 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
26971 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26972 return (uint64_t)ret_conv;
26975 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) {
26976 LDKBuiltCommitmentTransaction this_arg_conv;
26977 this_arg_conv.inner = (void*)(this_arg & (~1));
26978 this_arg_conv.is_owned = false;
26979 LDKu8slice funding_redeemscript_ref;
26980 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26981 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26982 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
26984 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
26988 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) {
26989 LDKBuiltCommitmentTransaction this_arg_conv;
26990 this_arg_conv.inner = (void*)(this_arg & (~1));
26991 this_arg_conv.is_owned = false;
26992 unsigned char funding_key_arr[32];
26993 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
26994 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
26995 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
26996 LDKu8slice funding_redeemscript_ref;
26997 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
26998 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
26999 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
27000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
27001 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
27005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27006 LDKClosingTransaction this_obj_conv;
27007 this_obj_conv.inner = (void*)(this_obj & (~1));
27008 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27009 ClosingTransaction_free(this_obj_conv);
27012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27013 LDKClosingTransaction orig_conv;
27014 orig_conv.inner = (void*)(orig & (~1));
27015 orig_conv.is_owned = false;
27016 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
27017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27019 uint64_t ret_ref = (uint64_t)ret_var.inner;
27020 if (ret_var.is_owned) {
27026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
27027 LDKClosingTransaction o_conv;
27028 o_conv.inner = (void*)(o & (~1));
27029 o_conv.is_owned = false;
27030 int64_t ret_val = ClosingTransaction_hash(&o_conv);
27034 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) {
27035 LDKCVec_u8Z to_holder_script_ref;
27036 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
27037 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
27038 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
27039 LDKCVec_u8Z to_counterparty_script_ref;
27040 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
27041 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
27042 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
27043 LDKOutPoint funding_outpoint_conv;
27044 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
27045 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
27046 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
27047 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
27048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27050 uint64_t ret_ref = (uint64_t)ret_var.inner;
27051 if (ret_var.is_owned) {
27057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
27058 LDKClosingTransaction this_arg_conv;
27059 this_arg_conv.inner = (void*)(this_arg & (~1));
27060 this_arg_conv.is_owned = false;
27061 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
27062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27064 uint64_t ret_ref = (uint64_t)ret_var.inner;
27065 if (ret_var.is_owned) {
27071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
27072 LDKClosingTransaction this_arg_conv;
27073 this_arg_conv.inner = (void*)(this_arg & (~1));
27074 this_arg_conv.is_owned = false;
27075 LDKOutPoint funding_outpoint_conv;
27076 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
27077 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
27078 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
27079 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
27080 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
27081 return (uint64_t)ret_conv;
27084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
27085 LDKClosingTransaction this_arg_conv;
27086 this_arg_conv.inner = (void*)(this_arg & (~1));
27087 this_arg_conv.is_owned = false;
27088 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
27092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
27093 LDKClosingTransaction this_arg_conv;
27094 this_arg_conv.inner = (void*)(this_arg & (~1));
27095 this_arg_conv.is_owned = false;
27096 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
27100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
27101 LDKClosingTransaction this_arg_conv;
27102 this_arg_conv.inner = (void*)(this_arg & (~1));
27103 this_arg_conv.is_owned = false;
27104 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
27105 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27106 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
27111 LDKClosingTransaction this_arg_conv;
27112 this_arg_conv.inner = (void*)(this_arg & (~1));
27113 this_arg_conv.is_owned = false;
27114 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
27115 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27116 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27121 LDKTrustedClosingTransaction this_obj_conv;
27122 this_obj_conv.inner = (void*)(this_obj & (~1));
27123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27124 TrustedClosingTransaction_free(this_obj_conv);
27127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
27128 LDKTrustedClosingTransaction this_arg_conv;
27129 this_arg_conv.inner = (void*)(this_arg & (~1));
27130 this_arg_conv.is_owned = false;
27131 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
27132 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27133 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27134 Transaction_free(ret_var);
27138 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) {
27139 LDKTrustedClosingTransaction this_arg_conv;
27140 this_arg_conv.inner = (void*)(this_arg & (~1));
27141 this_arg_conv.is_owned = false;
27142 LDKu8slice funding_redeemscript_ref;
27143 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
27144 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
27145 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27146 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
27147 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
27151 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) {
27152 LDKTrustedClosingTransaction this_arg_conv;
27153 this_arg_conv.inner = (void*)(this_arg & (~1));
27154 this_arg_conv.is_owned = false;
27155 unsigned char funding_key_arr[32];
27156 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27157 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
27158 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
27159 LDKu8slice funding_redeemscript_ref;
27160 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
27161 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
27162 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
27163 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
27164 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
27168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27169 LDKCommitmentTransaction this_obj_conv;
27170 this_obj_conv.inner = (void*)(this_obj & (~1));
27171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27172 CommitmentTransaction_free(this_obj_conv);
27175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27176 LDKCommitmentTransaction orig_conv;
27177 orig_conv.inner = (void*)(orig & (~1));
27178 orig_conv.is_owned = false;
27179 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
27180 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27181 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27182 uint64_t ret_ref = (uint64_t)ret_var.inner;
27183 if (ret_var.is_owned) {
27189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
27190 LDKCommitmentTransaction obj_conv;
27191 obj_conv.inner = (void*)(obj & (~1));
27192 obj_conv.is_owned = false;
27193 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
27194 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27195 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27196 CVec_u8Z_free(ret_var);
27200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27201 LDKu8slice ser_ref;
27202 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27203 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27204 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
27205 *ret_conv = CommitmentTransaction_read(ser_ref);
27206 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27207 return (uint64_t)ret_conv;
27210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
27211 LDKCommitmentTransaction this_arg_conv;
27212 this_arg_conv.inner = (void*)(this_arg & (~1));
27213 this_arg_conv.is_owned = false;
27214 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
27218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
27219 LDKCommitmentTransaction this_arg_conv;
27220 this_arg_conv.inner = (void*)(this_arg & (~1));
27221 this_arg_conv.is_owned = false;
27222 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
27226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
27227 LDKCommitmentTransaction this_arg_conv;
27228 this_arg_conv.inner = (void*)(this_arg & (~1));
27229 this_arg_conv.is_owned = false;
27230 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
27234 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
27235 LDKCommitmentTransaction this_arg_conv;
27236 this_arg_conv.inner = (void*)(this_arg & (~1));
27237 this_arg_conv.is_owned = false;
27238 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
27242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
27243 LDKCommitmentTransaction this_arg_conv;
27244 this_arg_conv.inner = (void*)(this_arg & (~1));
27245 this_arg_conv.is_owned = false;
27246 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
27247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27249 uint64_t ret_ref = (uint64_t)ret_var.inner;
27250 if (ret_var.is_owned) {
27256 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) {
27257 LDKCommitmentTransaction this_arg_conv;
27258 this_arg_conv.inner = (void*)(this_arg & (~1));
27259 this_arg_conv.is_owned = false;
27260 LDKDirectedChannelTransactionParameters channel_parameters_conv;
27261 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
27262 channel_parameters_conv.is_owned = false;
27263 LDKChannelPublicKeys broadcaster_keys_conv;
27264 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
27265 broadcaster_keys_conv.is_owned = false;
27266 LDKChannelPublicKeys countersignatory_keys_conv;
27267 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
27268 countersignatory_keys_conv.is_owned = false;
27269 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
27270 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
27271 return (uint64_t)ret_conv;
27274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27275 LDKTrustedCommitmentTransaction this_obj_conv;
27276 this_obj_conv.inner = (void*)(this_obj & (~1));
27277 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27278 TrustedCommitmentTransaction_free(this_obj_conv);
27281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
27282 LDKTrustedCommitmentTransaction this_arg_conv;
27283 this_arg_conv.inner = (void*)(this_arg & (~1));
27284 this_arg_conv.is_owned = false;
27285 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27286 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
27290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
27291 LDKTrustedCommitmentTransaction this_arg_conv;
27292 this_arg_conv.inner = (void*)(this_arg & (~1));
27293 this_arg_conv.is_owned = false;
27294 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
27295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27297 uint64_t ret_ref = (uint64_t)ret_var.inner;
27298 if (ret_var.is_owned) {
27304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
27305 LDKTrustedCommitmentTransaction this_arg_conv;
27306 this_arg_conv.inner = (void*)(this_arg & (~1));
27307 this_arg_conv.is_owned = false;
27308 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
27309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27311 uint64_t ret_ref = (uint64_t)ret_var.inner;
27312 if (ret_var.is_owned) {
27318 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) {
27319 LDKTrustedCommitmentTransaction this_arg_conv;
27320 this_arg_conv.inner = (void*)(this_arg & (~1));
27321 this_arg_conv.is_owned = false;
27322 unsigned char htlc_base_key_arr[32];
27323 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27324 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
27325 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
27326 LDKDirectedChannelTransactionParameters channel_parameters_conv;
27327 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
27328 channel_parameters_conv.is_owned = false;
27329 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
27330 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
27331 return (uint64_t)ret_conv;
27334 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) {
27335 LDKPublicKey broadcaster_payment_basepoint_ref;
27336 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
27337 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
27338 LDKPublicKey countersignatory_payment_basepoint_ref;
27339 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
27340 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
27341 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
27345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27346 LDKInitFeatures a_conv;
27347 a_conv.inner = (void*)(a & (~1));
27348 a_conv.is_owned = false;
27349 LDKInitFeatures b_conv;
27350 b_conv.inner = (void*)(b & (~1));
27351 b_conv.is_owned = false;
27352 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
27356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27357 LDKNodeFeatures a_conv;
27358 a_conv.inner = (void*)(a & (~1));
27359 a_conv.is_owned = false;
27360 LDKNodeFeatures b_conv;
27361 b_conv.inner = (void*)(b & (~1));
27362 b_conv.is_owned = false;
27363 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
27367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27368 LDKChannelFeatures a_conv;
27369 a_conv.inner = (void*)(a & (~1));
27370 a_conv.is_owned = false;
27371 LDKChannelFeatures b_conv;
27372 b_conv.inner = (void*)(b & (~1));
27373 b_conv.is_owned = false;
27374 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
27378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27379 LDKInvoiceFeatures a_conv;
27380 a_conv.inner = (void*)(a & (~1));
27381 a_conv.is_owned = false;
27382 LDKInvoiceFeatures b_conv;
27383 b_conv.inner = (void*)(b & (~1));
27384 b_conv.is_owned = false;
27385 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
27389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27390 LDKInitFeatures orig_conv;
27391 orig_conv.inner = (void*)(orig & (~1));
27392 orig_conv.is_owned = false;
27393 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
27394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27396 uint64_t ret_ref = (uint64_t)ret_var.inner;
27397 if (ret_var.is_owned) {
27403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27404 LDKNodeFeatures orig_conv;
27405 orig_conv.inner = (void*)(orig & (~1));
27406 orig_conv.is_owned = false;
27407 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27418 LDKChannelFeatures orig_conv;
27419 orig_conv.inner = (void*)(orig & (~1));
27420 orig_conv.is_owned = false;
27421 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
27422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27424 uint64_t ret_ref = (uint64_t)ret_var.inner;
27425 if (ret_var.is_owned) {
27431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27432 LDKInvoiceFeatures orig_conv;
27433 orig_conv.inner = (void*)(orig & (~1));
27434 orig_conv.is_owned = false;
27435 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
27436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27438 uint64_t ret_ref = (uint64_t)ret_var.inner;
27439 if (ret_var.is_owned) {
27445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27446 LDKInitFeatures this_obj_conv;
27447 this_obj_conv.inner = (void*)(this_obj & (~1));
27448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27449 InitFeatures_free(this_obj_conv);
27452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27453 LDKNodeFeatures this_obj_conv;
27454 this_obj_conv.inner = (void*)(this_obj & (~1));
27455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27456 NodeFeatures_free(this_obj_conv);
27459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27460 LDKChannelFeatures this_obj_conv;
27461 this_obj_conv.inner = (void*)(this_obj & (~1));
27462 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27463 ChannelFeatures_free(this_obj_conv);
27466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27467 LDKInvoiceFeatures this_obj_conv;
27468 this_obj_conv.inner = (void*)(this_obj & (~1));
27469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27470 InvoiceFeatures_free(this_obj_conv);
27473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
27474 LDKInitFeatures ret_var = InitFeatures_empty();
27475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27477 uint64_t ret_ref = (uint64_t)ret_var.inner;
27478 if (ret_var.is_owned) {
27484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
27485 LDKInitFeatures ret_var = InitFeatures_known();
27486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27488 uint64_t ret_ref = (uint64_t)ret_var.inner;
27489 if (ret_var.is_owned) {
27495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
27496 LDKInitFeatures this_arg_conv;
27497 this_arg_conv.inner = (void*)(this_arg & (~1));
27498 this_arg_conv.is_owned = false;
27499 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
27503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
27504 LDKNodeFeatures ret_var = NodeFeatures_empty();
27505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27507 uint64_t ret_ref = (uint64_t)ret_var.inner;
27508 if (ret_var.is_owned) {
27514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
27515 LDKNodeFeatures ret_var = NodeFeatures_known();
27516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27518 uint64_t ret_ref = (uint64_t)ret_var.inner;
27519 if (ret_var.is_owned) {
27525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
27526 LDKNodeFeatures this_arg_conv;
27527 this_arg_conv.inner = (void*)(this_arg & (~1));
27528 this_arg_conv.is_owned = false;
27529 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
27533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
27534 LDKChannelFeatures ret_var = ChannelFeatures_empty();
27535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27537 uint64_t ret_ref = (uint64_t)ret_var.inner;
27538 if (ret_var.is_owned) {
27544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
27545 LDKChannelFeatures ret_var = ChannelFeatures_known();
27546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27548 uint64_t ret_ref = (uint64_t)ret_var.inner;
27549 if (ret_var.is_owned) {
27555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
27556 LDKChannelFeatures this_arg_conv;
27557 this_arg_conv.inner = (void*)(this_arg & (~1));
27558 this_arg_conv.is_owned = false;
27559 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
27563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
27564 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
27565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27567 uint64_t ret_ref = (uint64_t)ret_var.inner;
27568 if (ret_var.is_owned) {
27574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
27575 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
27576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27578 uint64_t ret_ref = (uint64_t)ret_var.inner;
27579 if (ret_var.is_owned) {
27585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
27586 LDKInvoiceFeatures this_arg_conv;
27587 this_arg_conv.inner = (void*)(this_arg & (~1));
27588 this_arg_conv.is_owned = false;
27589 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
27593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27594 LDKInitFeatures this_arg_conv;
27595 this_arg_conv.inner = (void*)(this_arg & (~1));
27596 this_arg_conv.is_owned = false;
27597 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
27601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27602 LDKNodeFeatures this_arg_conv;
27603 this_arg_conv.inner = (void*)(this_arg & (~1));
27604 this_arg_conv.is_owned = false;
27605 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
27609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27610 LDKInvoiceFeatures this_arg_conv;
27611 this_arg_conv.inner = (void*)(this_arg & (~1));
27612 this_arg_conv.is_owned = false;
27613 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
27617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
27618 LDKInitFeatures obj_conv;
27619 obj_conv.inner = (void*)(obj & (~1));
27620 obj_conv.is_owned = false;
27621 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
27622 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27623 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27624 CVec_u8Z_free(ret_var);
27628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
27629 LDKNodeFeatures obj_conv;
27630 obj_conv.inner = (void*)(obj & (~1));
27631 obj_conv.is_owned = false;
27632 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
27633 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27634 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27635 CVec_u8Z_free(ret_var);
27639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
27640 LDKChannelFeatures obj_conv;
27641 obj_conv.inner = (void*)(obj & (~1));
27642 obj_conv.is_owned = false;
27643 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
27644 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27645 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27646 CVec_u8Z_free(ret_var);
27650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
27651 LDKInvoiceFeatures obj_conv;
27652 obj_conv.inner = (void*)(obj & (~1));
27653 obj_conv.is_owned = false;
27654 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
27655 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27656 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27657 CVec_u8Z_free(ret_var);
27661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27662 LDKu8slice ser_ref;
27663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27665 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27666 *ret_conv = InitFeatures_read(ser_ref);
27667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27668 return (uint64_t)ret_conv;
27671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27672 LDKu8slice ser_ref;
27673 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27674 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27675 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27676 *ret_conv = NodeFeatures_read(ser_ref);
27677 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27678 return (uint64_t)ret_conv;
27681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27682 LDKu8slice ser_ref;
27683 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27684 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27685 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27686 *ret_conv = ChannelFeatures_read(ser_ref);
27687 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27688 return (uint64_t)ret_conv;
27691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27692 LDKu8slice ser_ref;
27693 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27694 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27695 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
27696 *ret_conv = InvoiceFeatures_read(ser_ref);
27697 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27698 return (uint64_t)ret_conv;
27701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27702 LDKShutdownScript this_obj_conv;
27703 this_obj_conv.inner = (void*)(this_obj & (~1));
27704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27705 ShutdownScript_free(this_obj_conv);
27708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27709 LDKShutdownScript orig_conv;
27710 orig_conv.inner = (void*)(orig & (~1));
27711 orig_conv.is_owned = false;
27712 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
27713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27715 uint64_t ret_ref = (uint64_t)ret_var.inner;
27716 if (ret_var.is_owned) {
27722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27723 LDKInvalidShutdownScript this_obj_conv;
27724 this_obj_conv.inner = (void*)(this_obj & (~1));
27725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27726 InvalidShutdownScript_free(this_obj_conv);
27729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
27730 LDKInvalidShutdownScript this_ptr_conv;
27731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27732 this_ptr_conv.is_owned = false;
27733 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
27734 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27735 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27740 LDKInvalidShutdownScript this_ptr_conv;
27741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27742 this_ptr_conv.is_owned = false;
27743 LDKCVec_u8Z val_ref;
27744 val_ref.datalen = (*env)->GetArrayLength(env, val);
27745 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27746 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
27747 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
27750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
27751 LDKCVec_u8Z script_arg_ref;
27752 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
27753 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27754 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
27755 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
27756 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27757 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27758 uint64_t ret_ref = (uint64_t)ret_var.inner;
27759 if (ret_var.is_owned) {
27765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27766 LDKInvalidShutdownScript orig_conv;
27767 orig_conv.inner = (void*)(orig & (~1));
27768 orig_conv.is_owned = false;
27769 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
27770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27772 uint64_t ret_ref = (uint64_t)ret_var.inner;
27773 if (ret_var.is_owned) {
27779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
27780 LDKShutdownScript obj_conv;
27781 obj_conv.inner = (void*)(obj & (~1));
27782 obj_conv.is_owned = false;
27783 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
27784 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27785 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27786 CVec_u8Z_free(ret_var);
27790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27791 LDKu8slice ser_ref;
27792 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27793 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27794 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
27795 *ret_conv = ShutdownScript_read(ser_ref);
27796 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27797 return (uint64_t)ret_conv;
27800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
27801 unsigned char pubkey_hash_arr[20];
27802 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
27803 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
27804 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
27805 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
27806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27808 uint64_t ret_ref = (uint64_t)ret_var.inner;
27809 if (ret_var.is_owned) {
27815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
27816 unsigned char script_hash_arr[32];
27817 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
27818 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
27819 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
27820 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
27821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27823 uint64_t ret_ref = (uint64_t)ret_var.inner;
27824 if (ret_var.is_owned) {
27830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
27831 LDKu8slice program_ref;
27832 program_ref.datalen = (*env)->GetArrayLength(env, program);
27833 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
27834 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
27835 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
27836 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
27837 return (uint64_t)ret_conv;
27840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27841 LDKShutdownScript this_arg_conv;
27842 this_arg_conv.inner = (void*)(this_arg & (~1));
27843 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27844 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
27845 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
27846 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27847 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27848 CVec_u8Z_free(ret_var);
27852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
27853 LDKShutdownScript this_arg_conv;
27854 this_arg_conv.inner = (void*)(this_arg & (~1));
27855 this_arg_conv.is_owned = false;
27856 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
27861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
27862 LDKShutdownScript this_arg_conv;
27863 this_arg_conv.inner = (void*)(this_arg & (~1));
27864 this_arg_conv.is_owned = false;
27865 LDKInitFeatures features_conv;
27866 features_conv.inner = (void*)(features & (~1));
27867 features_conv.is_owned = false;
27868 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
27872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27873 if ((this_ptr & 1) != 0) return;
27874 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27875 CHECK_ACCESS(this_ptr_ptr);
27876 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
27877 FREE((void*)this_ptr);
27878 CustomMessageReader_free(this_ptr_conv);
27881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27882 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
27883 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
27884 LDKType* orig_conv = (LDKType*)orig_ptr;
27885 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
27886 *ret_ret = Type_clone(orig_conv);
27887 return (uint64_t)ret_ret;
27890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27891 if ((this_ptr & 1) != 0) return;
27892 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27893 CHECK_ACCESS(this_ptr_ptr);
27894 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
27895 FREE((void*)this_ptr);
27896 Type_free(this_ptr_conv);
27899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27900 if ((this_ptr & 1) != 0) return;
27901 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27902 CHECK_ACCESS(this_ptr_ptr);
27903 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
27904 FREE((void*)this_ptr);
27905 Score_free(this_ptr_conv);
27908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27909 LDKNodeId this_obj_conv;
27910 this_obj_conv.inner = (void*)(this_obj & (~1));
27911 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27912 NodeId_free(this_obj_conv);
27915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27916 LDKNodeId orig_conv;
27917 orig_conv.inner = (void*)(orig & (~1));
27918 orig_conv.is_owned = false;
27919 LDKNodeId ret_var = NodeId_clone(&orig_conv);
27920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27922 uint64_t ret_ref = (uint64_t)ret_var.inner;
27923 if (ret_var.is_owned) {
27929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
27930 LDKPublicKey pubkey_ref;
27931 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
27932 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
27933 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
27934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27936 uint64_t ret_ref = (uint64_t)ret_var.inner;
27937 if (ret_var.is_owned) {
27943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
27944 LDKNodeId this_arg_conv;
27945 this_arg_conv.inner = (void*)(this_arg & (~1));
27946 this_arg_conv.is_owned = false;
27947 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
27948 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27949 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
27955 o_conv.inner = (void*)(o & (~1));
27956 o_conv.is_owned = false;
27957 int64_t ret_val = NodeId_hash(&o_conv);
27961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
27962 LDKNodeId obj_conv;
27963 obj_conv.inner = (void*)(obj & (~1));
27964 obj_conv.is_owned = false;
27965 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
27966 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27967 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27968 CVec_u8Z_free(ret_var);
27972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27973 LDKu8slice ser_ref;
27974 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27975 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27976 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
27977 *ret_conv = NodeId_read(ser_ref);
27978 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27979 return (uint64_t)ret_conv;
27982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27983 LDKNetworkGraph this_obj_conv;
27984 this_obj_conv.inner = (void*)(this_obj & (~1));
27985 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27986 NetworkGraph_free(this_obj_conv);
27989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27990 LDKNetworkGraph orig_conv;
27991 orig_conv.inner = (void*)(orig & (~1));
27992 orig_conv.is_owned = false;
27993 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
27994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27996 uint64_t ret_ref = (uint64_t)ret_var.inner;
27997 if (ret_var.is_owned) {
28003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28004 LDKReadOnlyNetworkGraph this_obj_conv;
28005 this_obj_conv.inner = (void*)(this_obj & (~1));
28006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28007 ReadOnlyNetworkGraph_free(this_obj_conv);
28010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28011 if ((this_ptr & 1) != 0) return;
28012 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28013 CHECK_ACCESS(this_ptr_ptr);
28014 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
28015 FREE((void*)this_ptr);
28016 NetworkUpdate_free(this_ptr_conv);
28019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28020 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
28021 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
28022 *ret_copy = NetworkUpdate_clone(orig_conv);
28023 uint64_t ret_ref = (uint64_t)ret_copy;
28027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
28028 LDKChannelUpdate msg_conv;
28029 msg_conv.inner = (void*)(msg & (~1));
28030 msg_conv.is_owned = (msg & 1) || (msg == 0);
28031 msg_conv = ChannelUpdate_clone(&msg_conv);
28032 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
28033 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
28034 uint64_t ret_ref = (uint64_t)ret_copy;
28038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
28039 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
28040 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
28041 uint64_t ret_ref = (uint64_t)ret_copy;
28045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
28046 LDKPublicKey node_id_ref;
28047 CHECK((*env)->GetArrayLength(env, node_id) == 33);
28048 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
28049 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
28050 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
28051 uint64_t ret_ref = (uint64_t)ret_copy;
28055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
28056 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
28057 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
28058 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28059 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28060 CVec_u8Z_free(ret_var);
28064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
28065 LDKNetGraphMsgHandler this_arg_conv;
28066 this_arg_conv.inner = (void*)(this_arg & (~1));
28067 this_arg_conv.is_owned = false;
28068 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
28069 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
28070 return (uint64_t)ret_ret;
28073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28074 LDKNetGraphMsgHandler this_obj_conv;
28075 this_obj_conv.inner = (void*)(this_obj & (~1));
28076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28077 NetGraphMsgHandler_free(this_obj_conv);
28080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
28081 LDKNetGraphMsgHandler this_ptr_conv;
28082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28083 this_ptr_conv.is_owned = false;
28084 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
28085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28087 uint64_t ret_ref = (uint64_t)ret_var.inner;
28088 if (ret_var.is_owned) {
28094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28095 LDKNetGraphMsgHandler this_ptr_conv;
28096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28097 this_ptr_conv.is_owned = false;
28098 LDKNetworkGraph val_conv;
28099 val_conv.inner = (void*)(val & (~1));
28100 val_conv.is_owned = (val & 1) || (val == 0);
28101 val_conv = NetworkGraph_clone(&val_conv);
28102 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
28105 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) {
28106 LDKNetworkGraph network_graph_conv;
28107 network_graph_conv.inner = (void*)(network_graph & (~1));
28108 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
28109 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
28110 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
28111 CHECK_ACCESS(chain_access_ptr);
28112 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
28113 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28114 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28115 // Manually implement clone for Java trait instances
28116 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28118 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28121 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28122 CHECK_ACCESS(logger_ptr);
28123 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28124 if (logger_conv.free == LDKLogger_JCalls_free) {
28125 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28126 LDKLogger_JCalls_cloned(&logger_conv);
28128 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
28129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28131 uint64_t ret_ref = (uint64_t)ret_var.inner;
28132 if (ret_var.is_owned) {
28138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
28139 LDKNetGraphMsgHandler this_arg_conv;
28140 this_arg_conv.inner = (void*)(this_arg & (~1));
28141 this_arg_conv.is_owned = false;
28142 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
28143 CHECK_ACCESS(chain_access_ptr);
28144 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
28145 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28146 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28147 // Manually implement clone for Java trait instances
28148 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28149 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28150 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28153 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
28156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
28157 LDKNetGraphMsgHandler this_arg_conv;
28158 this_arg_conv.inner = (void*)(this_arg & (~1));
28159 this_arg_conv.is_owned = false;
28160 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28161 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
28162 return (uint64_t)ret_ret;
28165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
28166 LDKNetGraphMsgHandler this_arg_conv;
28167 this_arg_conv.inner = (void*)(this_arg & (~1));
28168 this_arg_conv.is_owned = false;
28169 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28170 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
28171 return (uint64_t)ret_ret;
28174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28175 LDKDirectionalChannelInfo this_obj_conv;
28176 this_obj_conv.inner = (void*)(this_obj & (~1));
28177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28178 DirectionalChannelInfo_free(this_obj_conv);
28181 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
28182 LDKDirectionalChannelInfo this_ptr_conv;
28183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28184 this_ptr_conv.is_owned = false;
28185 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
28189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28190 LDKDirectionalChannelInfo this_ptr_conv;
28191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28192 this_ptr_conv.is_owned = false;
28193 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
28196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
28197 LDKDirectionalChannelInfo this_ptr_conv;
28198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28199 this_ptr_conv.is_owned = false;
28200 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
28204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28205 LDKDirectionalChannelInfo this_ptr_conv;
28206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28207 this_ptr_conv.is_owned = false;
28208 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
28211 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28212 LDKDirectionalChannelInfo this_ptr_conv;
28213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28214 this_ptr_conv.is_owned = false;
28215 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
28219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28220 LDKDirectionalChannelInfo this_ptr_conv;
28221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28222 this_ptr_conv.is_owned = false;
28223 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28227 LDKDirectionalChannelInfo this_ptr_conv;
28228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28229 this_ptr_conv.is_owned = false;
28230 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
28234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28235 LDKDirectionalChannelInfo this_ptr_conv;
28236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28237 this_ptr_conv.is_owned = false;
28238 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
28241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28242 LDKDirectionalChannelInfo this_ptr_conv;
28243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28244 this_ptr_conv.is_owned = false;
28245 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28246 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
28247 uint64_t ret_ref = (uint64_t)ret_copy;
28251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28252 LDKDirectionalChannelInfo this_ptr_conv;
28253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28254 this_ptr_conv.is_owned = false;
28255 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28256 CHECK_ACCESS(val_ptr);
28257 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28258 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
28259 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
28262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
28263 LDKDirectionalChannelInfo this_ptr_conv;
28264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28265 this_ptr_conv.is_owned = false;
28266 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
28267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28269 uint64_t ret_ref = (uint64_t)ret_var.inner;
28270 if (ret_var.is_owned) {
28276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28277 LDKDirectionalChannelInfo this_ptr_conv;
28278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28279 this_ptr_conv.is_owned = false;
28280 LDKRoutingFees val_conv;
28281 val_conv.inner = (void*)(val & (~1));
28282 val_conv.is_owned = (val & 1) || (val == 0);
28283 val_conv = RoutingFees_clone(&val_conv);
28284 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
28287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
28288 LDKDirectionalChannelInfo this_ptr_conv;
28289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28290 this_ptr_conv.is_owned = false;
28291 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
28292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28294 uint64_t ret_ref = (uint64_t)ret_var.inner;
28295 if (ret_var.is_owned) {
28301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28302 LDKDirectionalChannelInfo this_ptr_conv;
28303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28304 this_ptr_conv.is_owned = false;
28305 LDKChannelUpdate val_conv;
28306 val_conv.inner = (void*)(val & (~1));
28307 val_conv.is_owned = (val & 1) || (val == 0);
28308 val_conv = ChannelUpdate_clone(&val_conv);
28309 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
28312 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) {
28313 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
28314 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
28315 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
28316 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
28317 LDKRoutingFees fees_arg_conv;
28318 fees_arg_conv.inner = (void*)(fees_arg & (~1));
28319 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
28320 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
28321 LDKChannelUpdate last_update_message_arg_conv;
28322 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
28323 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
28324 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
28325 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);
28326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28328 uint64_t ret_ref = (uint64_t)ret_var.inner;
28329 if (ret_var.is_owned) {
28335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28336 LDKDirectionalChannelInfo orig_conv;
28337 orig_conv.inner = (void*)(orig & (~1));
28338 orig_conv.is_owned = false;
28339 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
28340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28342 uint64_t ret_ref = (uint64_t)ret_var.inner;
28343 if (ret_var.is_owned) {
28349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28350 LDKDirectionalChannelInfo obj_conv;
28351 obj_conv.inner = (void*)(obj & (~1));
28352 obj_conv.is_owned = false;
28353 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
28354 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28355 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28356 CVec_u8Z_free(ret_var);
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28361 LDKu8slice ser_ref;
28362 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28363 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28364 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
28365 *ret_conv = DirectionalChannelInfo_read(ser_ref);
28366 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28367 return (uint64_t)ret_conv;
28370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28371 LDKChannelInfo this_obj_conv;
28372 this_obj_conv.inner = (void*)(this_obj & (~1));
28373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28374 ChannelInfo_free(this_obj_conv);
28377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28378 LDKChannelInfo this_ptr_conv;
28379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28380 this_ptr_conv.is_owned = false;
28381 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
28382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28384 uint64_t ret_ref = (uint64_t)ret_var.inner;
28385 if (ret_var.is_owned) {
28391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28392 LDKChannelInfo this_ptr_conv;
28393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28394 this_ptr_conv.is_owned = false;
28395 LDKChannelFeatures val_conv;
28396 val_conv.inner = (void*)(val & (~1));
28397 val_conv.is_owned = (val & 1) || (val == 0);
28398 val_conv = ChannelFeatures_clone(&val_conv);
28399 ChannelInfo_set_features(&this_ptr_conv, val_conv);
28402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
28403 LDKChannelInfo this_ptr_conv;
28404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28405 this_ptr_conv.is_owned = false;
28406 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
28407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28409 uint64_t ret_ref = (uint64_t)ret_var.inner;
28410 if (ret_var.is_owned) {
28416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28417 LDKChannelInfo this_ptr_conv;
28418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28419 this_ptr_conv.is_owned = false;
28420 LDKNodeId val_conv;
28421 val_conv.inner = (void*)(val & (~1));
28422 val_conv.is_owned = (val & 1) || (val == 0);
28423 val_conv = NodeId_clone(&val_conv);
28424 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
28427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
28428 LDKChannelInfo this_ptr_conv;
28429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28430 this_ptr_conv.is_owned = false;
28431 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
28432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28434 uint64_t ret_ref = (uint64_t)ret_var.inner;
28435 if (ret_var.is_owned) {
28441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28442 LDKChannelInfo this_ptr_conv;
28443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28444 this_ptr_conv.is_owned = false;
28445 LDKDirectionalChannelInfo val_conv;
28446 val_conv.inner = (void*)(val & (~1));
28447 val_conv.is_owned = (val & 1) || (val == 0);
28448 val_conv = DirectionalChannelInfo_clone(&val_conv);
28449 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
28452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
28453 LDKChannelInfo this_ptr_conv;
28454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28455 this_ptr_conv.is_owned = false;
28456 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
28457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28459 uint64_t ret_ref = (uint64_t)ret_var.inner;
28460 if (ret_var.is_owned) {
28466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28467 LDKChannelInfo this_ptr_conv;
28468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28469 this_ptr_conv.is_owned = false;
28470 LDKNodeId val_conv;
28471 val_conv.inner = (void*)(val & (~1));
28472 val_conv.is_owned = (val & 1) || (val == 0);
28473 val_conv = NodeId_clone(&val_conv);
28474 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
28477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
28478 LDKChannelInfo this_ptr_conv;
28479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28480 this_ptr_conv.is_owned = false;
28481 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
28482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28484 uint64_t ret_ref = (uint64_t)ret_var.inner;
28485 if (ret_var.is_owned) {
28491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28492 LDKChannelInfo this_ptr_conv;
28493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28494 this_ptr_conv.is_owned = false;
28495 LDKDirectionalChannelInfo val_conv;
28496 val_conv.inner = (void*)(val & (~1));
28497 val_conv.is_owned = (val & 1) || (val == 0);
28498 val_conv = DirectionalChannelInfo_clone(&val_conv);
28499 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
28502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
28503 LDKChannelInfo this_ptr_conv;
28504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28505 this_ptr_conv.is_owned = false;
28506 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28507 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
28508 uint64_t ret_ref = (uint64_t)ret_copy;
28512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28513 LDKChannelInfo this_ptr_conv;
28514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28515 this_ptr_conv.is_owned = false;
28516 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28517 CHECK_ACCESS(val_ptr);
28518 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28519 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
28520 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
28523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
28524 LDKChannelInfo this_ptr_conv;
28525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28526 this_ptr_conv.is_owned = false;
28527 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
28528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28530 uint64_t ret_ref = (uint64_t)ret_var.inner;
28531 if (ret_var.is_owned) {
28537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28538 LDKChannelInfo this_ptr_conv;
28539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28540 this_ptr_conv.is_owned = false;
28541 LDKChannelAnnouncement val_conv;
28542 val_conv.inner = (void*)(val & (~1));
28543 val_conv.is_owned = (val & 1) || (val == 0);
28544 val_conv = ChannelAnnouncement_clone(&val_conv);
28545 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
28548 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) {
28549 LDKChannelFeatures features_arg_conv;
28550 features_arg_conv.inner = (void*)(features_arg & (~1));
28551 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28552 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
28553 LDKNodeId node_one_arg_conv;
28554 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
28555 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
28556 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
28557 LDKDirectionalChannelInfo one_to_two_arg_conv;
28558 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
28559 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
28560 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
28561 LDKNodeId node_two_arg_conv;
28562 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
28563 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
28564 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
28565 LDKDirectionalChannelInfo two_to_one_arg_conv;
28566 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
28567 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
28568 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
28569 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
28570 CHECK_ACCESS(capacity_sats_arg_ptr);
28571 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
28572 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
28573 LDKChannelAnnouncement announcement_message_arg_conv;
28574 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
28575 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
28576 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
28577 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);
28578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28580 uint64_t ret_ref = (uint64_t)ret_var.inner;
28581 if (ret_var.is_owned) {
28587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28588 LDKChannelInfo orig_conv;
28589 orig_conv.inner = (void*)(orig & (~1));
28590 orig_conv.is_owned = false;
28591 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
28592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28594 uint64_t ret_ref = (uint64_t)ret_var.inner;
28595 if (ret_var.is_owned) {
28601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28602 LDKChannelInfo obj_conv;
28603 obj_conv.inner = (void*)(obj & (~1));
28604 obj_conv.is_owned = false;
28605 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
28606 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28607 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28608 CVec_u8Z_free(ret_var);
28612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28613 LDKu8slice ser_ref;
28614 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28615 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28616 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28617 *ret_conv = ChannelInfo_read(ser_ref);
28618 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28619 return (uint64_t)ret_conv;
28622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28623 LDKRoutingFees this_obj_conv;
28624 this_obj_conv.inner = (void*)(this_obj & (~1));
28625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28626 RoutingFees_free(this_obj_conv);
28629 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28630 LDKRoutingFees this_ptr_conv;
28631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28632 this_ptr_conv.is_owned = false;
28633 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
28637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28638 LDKRoutingFees this_ptr_conv;
28639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28640 this_ptr_conv.is_owned = false;
28641 RoutingFees_set_base_msat(&this_ptr_conv, val);
28644 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28645 LDKRoutingFees this_ptr_conv;
28646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28647 this_ptr_conv.is_owned = false;
28648 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
28652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28653 LDKRoutingFees this_ptr_conv;
28654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28655 this_ptr_conv.is_owned = false;
28656 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
28659 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) {
28660 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
28661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28663 uint64_t ret_ref = (uint64_t)ret_var.inner;
28664 if (ret_var.is_owned) {
28670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28671 LDKRoutingFees a_conv;
28672 a_conv.inner = (void*)(a & (~1));
28673 a_conv.is_owned = false;
28674 LDKRoutingFees b_conv;
28675 b_conv.inner = (void*)(b & (~1));
28676 b_conv.is_owned = false;
28677 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
28681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28682 LDKRoutingFees orig_conv;
28683 orig_conv.inner = (void*)(orig & (~1));
28684 orig_conv.is_owned = false;
28685 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
28686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28688 uint64_t ret_ref = (uint64_t)ret_var.inner;
28689 if (ret_var.is_owned) {
28695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
28696 LDKRoutingFees o_conv;
28697 o_conv.inner = (void*)(o & (~1));
28698 o_conv.is_owned = false;
28699 int64_t ret_val = RoutingFees_hash(&o_conv);
28703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
28704 LDKRoutingFees obj_conv;
28705 obj_conv.inner = (void*)(obj & (~1));
28706 obj_conv.is_owned = false;
28707 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
28708 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28709 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28710 CVec_u8Z_free(ret_var);
28714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28715 LDKu8slice ser_ref;
28716 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28717 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28718 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28719 *ret_conv = RoutingFees_read(ser_ref);
28720 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28721 return (uint64_t)ret_conv;
28724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28725 LDKNodeAnnouncementInfo this_obj_conv;
28726 this_obj_conv.inner = (void*)(this_obj & (~1));
28727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28728 NodeAnnouncementInfo_free(this_obj_conv);
28731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28732 LDKNodeAnnouncementInfo this_ptr_conv;
28733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28734 this_ptr_conv.is_owned = false;
28735 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
28736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28738 uint64_t ret_ref = (uint64_t)ret_var.inner;
28739 if (ret_var.is_owned) {
28745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28746 LDKNodeAnnouncementInfo this_ptr_conv;
28747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28748 this_ptr_conv.is_owned = false;
28749 LDKNodeFeatures val_conv;
28750 val_conv.inner = (void*)(val & (~1));
28751 val_conv.is_owned = (val & 1) || (val == 0);
28752 val_conv = NodeFeatures_clone(&val_conv);
28753 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
28756 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
28757 LDKNodeAnnouncementInfo this_ptr_conv;
28758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28759 this_ptr_conv.is_owned = false;
28760 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
28764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28765 LDKNodeAnnouncementInfo this_ptr_conv;
28766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28767 this_ptr_conv.is_owned = false;
28768 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
28771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
28772 LDKNodeAnnouncementInfo this_ptr_conv;
28773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28774 this_ptr_conv.is_owned = false;
28775 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
28776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
28780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28781 LDKNodeAnnouncementInfo this_ptr_conv;
28782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28783 this_ptr_conv.is_owned = false;
28784 LDKThreeBytes val_ref;
28785 CHECK((*env)->GetArrayLength(env, val) == 3);
28786 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
28787 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
28790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28791 LDKNodeAnnouncementInfo this_ptr_conv;
28792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28793 this_ptr_conv.is_owned = false;
28794 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28795 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
28799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28800 LDKNodeAnnouncementInfo this_ptr_conv;
28801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28802 this_ptr_conv.is_owned = false;
28803 LDKThirtyTwoBytes val_ref;
28804 CHECK((*env)->GetArrayLength(env, val) == 32);
28805 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28806 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
28809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28810 LDKNodeAnnouncementInfo this_ptr_conv;
28811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28812 this_ptr_conv.is_owned = false;
28813 LDKCVec_NetAddressZ val_constr;
28814 val_constr.datalen = (*env)->GetArrayLength(env, val);
28815 if (val_constr.datalen > 0)
28816 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28818 val_constr.data = NULL;
28819 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28820 for (size_t m = 0; m < val_constr.datalen; m++) {
28821 int64_t val_conv_12 = val_vals[m];
28822 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
28823 CHECK_ACCESS(val_conv_12_ptr);
28824 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
28825 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
28826 val_constr.data[m] = val_conv_12_conv;
28828 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28829 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
28832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
28833 LDKNodeAnnouncementInfo this_ptr_conv;
28834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28835 this_ptr_conv.is_owned = false;
28836 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
28837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28839 uint64_t ret_ref = (uint64_t)ret_var.inner;
28840 if (ret_var.is_owned) {
28846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28847 LDKNodeAnnouncementInfo this_ptr_conv;
28848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28849 this_ptr_conv.is_owned = false;
28850 LDKNodeAnnouncement val_conv;
28851 val_conv.inner = (void*)(val & (~1));
28852 val_conv.is_owned = (val & 1) || (val == 0);
28853 val_conv = NodeAnnouncement_clone(&val_conv);
28854 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
28857 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) {
28858 LDKNodeFeatures features_arg_conv;
28859 features_arg_conv.inner = (void*)(features_arg & (~1));
28860 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28861 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
28862 LDKThreeBytes rgb_arg_ref;
28863 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
28864 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
28865 LDKThirtyTwoBytes alias_arg_ref;
28866 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
28867 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
28868 LDKCVec_NetAddressZ addresses_arg_constr;
28869 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
28870 if (addresses_arg_constr.datalen > 0)
28871 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28873 addresses_arg_constr.data = NULL;
28874 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
28875 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
28876 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
28877 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
28878 CHECK_ACCESS(addresses_arg_conv_12_ptr);
28879 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
28880 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
28882 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
28883 LDKNodeAnnouncement announcement_message_arg_conv;
28884 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
28885 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
28886 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
28887 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
28888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28890 uint64_t ret_ref = (uint64_t)ret_var.inner;
28891 if (ret_var.is_owned) {
28897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28898 LDKNodeAnnouncementInfo orig_conv;
28899 orig_conv.inner = (void*)(orig & (~1));
28900 orig_conv.is_owned = false;
28901 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
28902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28904 uint64_t ret_ref = (uint64_t)ret_var.inner;
28905 if (ret_var.is_owned) {
28911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28912 LDKNodeAnnouncementInfo obj_conv;
28913 obj_conv.inner = (void*)(obj & (~1));
28914 obj_conv.is_owned = false;
28915 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
28916 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28917 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28918 CVec_u8Z_free(ret_var);
28922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28923 LDKu8slice ser_ref;
28924 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28925 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28926 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28927 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
28928 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28929 return (uint64_t)ret_conv;
28932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28933 LDKNodeInfo this_obj_conv;
28934 this_obj_conv.inner = (void*)(this_obj & (~1));
28935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28936 NodeInfo_free(this_obj_conv);
28939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28940 LDKNodeInfo this_ptr_conv;
28941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28942 this_ptr_conv.is_owned = false;
28943 LDKCVec_u64Z val_constr;
28944 val_constr.datalen = (*env)->GetArrayLength(env, val);
28945 if (val_constr.datalen > 0)
28946 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28948 val_constr.data = NULL;
28949 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28950 for (size_t g = 0; g < val_constr.datalen; g++) {
28951 int64_t val_conv_6 = val_vals[g];
28952 val_constr.data[g] = val_conv_6;
28954 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28955 NodeInfo_set_channels(&this_ptr_conv, val_constr);
28958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
28959 LDKNodeInfo this_ptr_conv;
28960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28961 this_ptr_conv.is_owned = false;
28962 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
28963 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28964 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28965 uint64_t ret_ref = (uint64_t)ret_var.inner;
28966 if (ret_var.is_owned) {
28972 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) {
28973 LDKNodeInfo this_ptr_conv;
28974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28975 this_ptr_conv.is_owned = false;
28976 LDKRoutingFees val_conv;
28977 val_conv.inner = (void*)(val & (~1));
28978 val_conv.is_owned = (val & 1) || (val == 0);
28979 val_conv = RoutingFees_clone(&val_conv);
28980 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
28983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28984 LDKNodeInfo this_ptr_conv;
28985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28986 this_ptr_conv.is_owned = false;
28987 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
28988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28990 uint64_t ret_ref = (uint64_t)ret_var.inner;
28991 if (ret_var.is_owned) {
28997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28998 LDKNodeInfo this_ptr_conv;
28999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29000 this_ptr_conv.is_owned = false;
29001 LDKNodeAnnouncementInfo val_conv;
29002 val_conv.inner = (void*)(val & (~1));
29003 val_conv.is_owned = (val & 1) || (val == 0);
29004 val_conv = NodeAnnouncementInfo_clone(&val_conv);
29005 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
29008 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) {
29009 LDKCVec_u64Z channels_arg_constr;
29010 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29011 if (channels_arg_constr.datalen > 0)
29012 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
29014 channels_arg_constr.data = NULL;
29015 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29016 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
29017 int64_t channels_arg_conv_6 = channels_arg_vals[g];
29018 channels_arg_constr.data[g] = channels_arg_conv_6;
29020 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29021 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
29022 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
29023 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
29024 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
29025 LDKNodeAnnouncementInfo announcement_info_arg_conv;
29026 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
29027 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
29028 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
29029 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
29030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29032 uint64_t ret_ref = (uint64_t)ret_var.inner;
29033 if (ret_var.is_owned) {
29039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29040 LDKNodeInfo orig_conv;
29041 orig_conv.inner = (void*)(orig & (~1));
29042 orig_conv.is_owned = false;
29043 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
29044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29046 uint64_t ret_ref = (uint64_t)ret_var.inner;
29047 if (ret_var.is_owned) {
29053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29054 LDKNodeInfo obj_conv;
29055 obj_conv.inner = (void*)(obj & (~1));
29056 obj_conv.is_owned = false;
29057 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
29058 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29059 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29060 CVec_u8Z_free(ret_var);
29064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29065 LDKu8slice ser_ref;
29066 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29067 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29068 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29069 *ret_conv = NodeInfo_read(ser_ref);
29070 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29071 return (uint64_t)ret_conv;
29074 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
29075 LDKNetworkGraph obj_conv;
29076 obj_conv.inner = (void*)(obj & (~1));
29077 obj_conv.is_owned = false;
29078 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
29079 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29080 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29081 CVec_u8Z_free(ret_var);
29085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29086 LDKu8slice ser_ref;
29087 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29088 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29089 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29090 *ret_conv = NetworkGraph_read(ser_ref);
29091 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29092 return (uint64_t)ret_conv;
29095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
29096 LDKThirtyTwoBytes genesis_hash_ref;
29097 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
29098 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
29099 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
29100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29102 uint64_t ret_ref = (uint64_t)ret_var.inner;
29103 if (ret_var.is_owned) {
29109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
29110 LDKNetworkGraph this_arg_conv;
29111 this_arg_conv.inner = (void*)(this_arg & (~1));
29112 this_arg_conv.is_owned = false;
29113 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
29114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29116 uint64_t ret_ref = (uint64_t)ret_var.inner;
29117 if (ret_var.is_owned) {
29123 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) {
29124 LDKNetworkGraph this_arg_conv;
29125 this_arg_conv.inner = (void*)(this_arg & (~1));
29126 this_arg_conv.is_owned = false;
29127 LDKNodeAnnouncement msg_conv;
29128 msg_conv.inner = (void*)(msg & (~1));
29129 msg_conv.is_owned = false;
29130 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29131 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
29132 return (uint64_t)ret_conv;
29135 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) {
29136 LDKNetworkGraph this_arg_conv;
29137 this_arg_conv.inner = (void*)(this_arg & (~1));
29138 this_arg_conv.is_owned = false;
29139 LDKUnsignedNodeAnnouncement msg_conv;
29140 msg_conv.inner = (void*)(msg & (~1));
29141 msg_conv.is_owned = false;
29142 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29143 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
29144 return (uint64_t)ret_conv;
29147 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) {
29148 LDKNetworkGraph this_arg_conv;
29149 this_arg_conv.inner = (void*)(this_arg & (~1));
29150 this_arg_conv.is_owned = false;
29151 LDKChannelAnnouncement msg_conv;
29152 msg_conv.inner = (void*)(msg & (~1));
29153 msg_conv.is_owned = false;
29154 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
29155 CHECK_ACCESS(chain_access_ptr);
29156 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
29157 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
29158 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
29159 // Manually implement clone for Java trait instances
29160 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
29161 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29162 LDKAccess_JCalls_cloned(&chain_access_conv.some);
29165 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29166 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
29167 return (uint64_t)ret_conv;
29170 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) {
29171 LDKNetworkGraph this_arg_conv;
29172 this_arg_conv.inner = (void*)(this_arg & (~1));
29173 this_arg_conv.is_owned = false;
29174 LDKUnsignedChannelAnnouncement msg_conv;
29175 msg_conv.inner = (void*)(msg & (~1));
29176 msg_conv.is_owned = false;
29177 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
29178 CHECK_ACCESS(chain_access_ptr);
29179 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
29180 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
29181 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
29182 // Manually implement clone for Java trait instances
29183 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
29184 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29185 LDKAccess_JCalls_cloned(&chain_access_conv.some);
29188 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29189 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
29190 return (uint64_t)ret_conv;
29193 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) {
29194 LDKNetworkGraph this_arg_conv;
29195 this_arg_conv.inner = (void*)(this_arg & (~1));
29196 this_arg_conv.is_owned = false;
29197 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
29200 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) {
29201 LDKNetworkGraph this_arg_conv;
29202 this_arg_conv.inner = (void*)(this_arg & (~1));
29203 this_arg_conv.is_owned = false;
29204 LDKPublicKey _node_id_ref;
29205 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
29206 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
29207 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
29210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
29211 LDKNetworkGraph this_arg_conv;
29212 this_arg_conv.inner = (void*)(this_arg & (~1));
29213 this_arg_conv.is_owned = false;
29214 LDKChannelUpdate msg_conv;
29215 msg_conv.inner = (void*)(msg & (~1));
29216 msg_conv.is_owned = false;
29217 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29218 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
29219 return (uint64_t)ret_conv;
29222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
29223 LDKNetworkGraph this_arg_conv;
29224 this_arg_conv.inner = (void*)(this_arg & (~1));
29225 this_arg_conv.is_owned = false;
29226 LDKUnsignedChannelUpdate msg_conv;
29227 msg_conv.inner = (void*)(msg & (~1));
29228 msg_conv.is_owned = false;
29229 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
29230 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
29231 return (uint64_t)ret_conv;
29234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
29235 LDKReadOnlyNetworkGraph this_arg_conv;
29236 this_arg_conv.inner = (void*)(this_arg & (~1));
29237 this_arg_conv.is_owned = false;
29238 LDKPublicKey pubkey_ref;
29239 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
29240 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
29241 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
29242 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
29243 uint64_t ret_ref = (uint64_t)ret_copy;
29247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29248 LDKRouteHop this_obj_conv;
29249 this_obj_conv.inner = (void*)(this_obj & (~1));
29250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29251 RouteHop_free(this_obj_conv);
29254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29255 LDKRouteHop this_ptr_conv;
29256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29257 this_ptr_conv.is_owned = false;
29258 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29259 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
29263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29264 LDKRouteHop this_ptr_conv;
29265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29266 this_ptr_conv.is_owned = false;
29267 LDKPublicKey val_ref;
29268 CHECK((*env)->GetArrayLength(env, val) == 33);
29269 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29270 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
29273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29274 LDKRouteHop this_ptr_conv;
29275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29276 this_ptr_conv.is_owned = false;
29277 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
29278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29280 uint64_t ret_ref = (uint64_t)ret_var.inner;
29281 if (ret_var.is_owned) {
29287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29288 LDKRouteHop this_ptr_conv;
29289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29290 this_ptr_conv.is_owned = false;
29291 LDKNodeFeatures val_conv;
29292 val_conv.inner = (void*)(val & (~1));
29293 val_conv.is_owned = (val & 1) || (val == 0);
29294 val_conv = NodeFeatures_clone(&val_conv);
29295 RouteHop_set_node_features(&this_ptr_conv, val_conv);
29298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29299 LDKRouteHop this_ptr_conv;
29300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29301 this_ptr_conv.is_owned = false;
29302 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
29306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29307 LDKRouteHop this_ptr_conv;
29308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29309 this_ptr_conv.is_owned = false;
29310 RouteHop_set_short_channel_id(&this_ptr_conv, val);
29313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29314 LDKRouteHop this_ptr_conv;
29315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29316 this_ptr_conv.is_owned = false;
29317 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
29318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29320 uint64_t ret_ref = (uint64_t)ret_var.inner;
29321 if (ret_var.is_owned) {
29327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29328 LDKRouteHop this_ptr_conv;
29329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29330 this_ptr_conv.is_owned = false;
29331 LDKChannelFeatures val_conv;
29332 val_conv.inner = (void*)(val & (~1));
29333 val_conv.is_owned = (val & 1) || (val == 0);
29334 val_conv = ChannelFeatures_clone(&val_conv);
29335 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
29338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29339 LDKRouteHop this_ptr_conv;
29340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29341 this_ptr_conv.is_owned = false;
29342 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
29346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29347 LDKRouteHop this_ptr_conv;
29348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29349 this_ptr_conv.is_owned = false;
29350 RouteHop_set_fee_msat(&this_ptr_conv, val);
29353 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29354 LDKRouteHop this_ptr_conv;
29355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29356 this_ptr_conv.is_owned = false;
29357 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
29361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29362 LDKRouteHop this_ptr_conv;
29363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29364 this_ptr_conv.is_owned = false;
29365 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
29368 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) {
29369 LDKPublicKey pubkey_arg_ref;
29370 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
29371 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
29372 LDKNodeFeatures node_features_arg_conv;
29373 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
29374 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
29375 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
29376 LDKChannelFeatures channel_features_arg_conv;
29377 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
29378 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
29379 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
29380 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);
29381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29383 uint64_t ret_ref = (uint64_t)ret_var.inner;
29384 if (ret_var.is_owned) {
29390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29391 LDKRouteHop orig_conv;
29392 orig_conv.inner = (void*)(orig & (~1));
29393 orig_conv.is_owned = false;
29394 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
29395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29397 uint64_t ret_ref = (uint64_t)ret_var.inner;
29398 if (ret_var.is_owned) {
29404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
29405 LDKRouteHop o_conv;
29406 o_conv.inner = (void*)(o & (~1));
29407 o_conv.is_owned = false;
29408 int64_t ret_val = RouteHop_hash(&o_conv);
29412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29413 LDKRouteHop a_conv;
29414 a_conv.inner = (void*)(a & (~1));
29415 a_conv.is_owned = false;
29416 LDKRouteHop b_conv;
29417 b_conv.inner = (void*)(b & (~1));
29418 b_conv.is_owned = false;
29419 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
29423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
29424 LDKRouteHop obj_conv;
29425 obj_conv.inner = (void*)(obj & (~1));
29426 obj_conv.is_owned = false;
29427 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
29428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29430 CVec_u8Z_free(ret_var);
29434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29435 LDKu8slice ser_ref;
29436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29438 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
29439 *ret_conv = RouteHop_read(ser_ref);
29440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29441 return (uint64_t)ret_conv;
29444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29445 LDKRoute this_obj_conv;
29446 this_obj_conv.inner = (void*)(this_obj & (~1));
29447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29448 Route_free(this_obj_conv);
29451 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
29452 LDKRoute this_ptr_conv;
29453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29454 this_ptr_conv.is_owned = false;
29455 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
29456 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
29458 for (size_t m = 0; m < ret_var.datalen; m++) {
29459 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
29460 int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
29461 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
29462 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
29463 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
29464 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29465 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29466 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
29467 if (ret_conv_12_conv_10_var.is_owned) {
29468 ret_conv_12_conv_10_ref |= 1;
29470 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
29472 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
29473 FREE(ret_conv_12_var.data);
29474 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
29476 FREE(ret_var.data);
29480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
29481 LDKRoute this_ptr_conv;
29482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29483 this_ptr_conv.is_owned = false;
29484 LDKCVec_CVec_RouteHopZZ val_constr;
29485 val_constr.datalen = (*env)->GetArrayLength(env, val);
29486 if (val_constr.datalen > 0)
29487 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
29489 val_constr.data = NULL;
29490 for (size_t m = 0; m < val_constr.datalen; m++) {
29491 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
29492 LDKCVec_RouteHopZ val_conv_12_constr;
29493 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
29494 if (val_conv_12_constr.datalen > 0)
29495 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29497 val_conv_12_constr.data = NULL;
29498 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
29499 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
29500 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
29501 LDKRouteHop val_conv_12_conv_10_conv;
29502 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
29503 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
29504 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
29505 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
29507 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
29508 val_constr.data[m] = val_conv_12_constr;
29510 Route_set_paths(&this_ptr_conv, val_constr);
29513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
29514 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
29515 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
29516 if (paths_arg_constr.datalen > 0)
29517 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
29519 paths_arg_constr.data = NULL;
29520 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
29521 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
29522 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
29523 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
29524 if (paths_arg_conv_12_constr.datalen > 0)
29525 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29527 paths_arg_conv_12_constr.data = NULL;
29528 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
29529 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
29530 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
29531 LDKRouteHop paths_arg_conv_12_conv_10_conv;
29532 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
29533 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
29534 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
29535 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
29537 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
29538 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
29540 LDKRoute ret_var = Route_new(paths_arg_constr);
29541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29543 uint64_t ret_ref = (uint64_t)ret_var.inner;
29544 if (ret_var.is_owned) {
29550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29551 LDKRoute orig_conv;
29552 orig_conv.inner = (void*)(orig & (~1));
29553 orig_conv.is_owned = false;
29554 LDKRoute ret_var = Route_clone(&orig_conv);
29555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29557 uint64_t ret_ref = (uint64_t)ret_var.inner;
29558 if (ret_var.is_owned) {
29564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
29566 o_conv.inner = (void*)(o & (~1));
29567 o_conv.is_owned = false;
29568 int64_t ret_val = Route_hash(&o_conv);
29572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29574 a_conv.inner = (void*)(a & (~1));
29575 a_conv.is_owned = false;
29577 b_conv.inner = (void*)(b & (~1));
29578 b_conv.is_owned = false;
29579 jboolean ret_val = Route_eq(&a_conv, &b_conv);
29583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
29584 LDKRoute this_arg_conv;
29585 this_arg_conv.inner = (void*)(this_arg & (~1));
29586 this_arg_conv.is_owned = false;
29587 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
29591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
29592 LDKRoute this_arg_conv;
29593 this_arg_conv.inner = (void*)(this_arg & (~1));
29594 this_arg_conv.is_owned = false;
29595 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
29599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
29601 obj_conv.inner = (void*)(obj & (~1));
29602 obj_conv.is_owned = false;
29603 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
29604 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29605 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29606 CVec_u8Z_free(ret_var);
29610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29611 LDKu8slice ser_ref;
29612 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29613 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29614 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
29615 *ret_conv = Route_read(ser_ref);
29616 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29617 return (uint64_t)ret_conv;
29620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29621 LDKRouteHint this_obj_conv;
29622 this_obj_conv.inner = (void*)(this_obj & (~1));
29623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29624 RouteHint_free(this_obj_conv);
29627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29628 LDKRouteHint orig_conv;
29629 orig_conv.inner = (void*)(orig & (~1));
29630 orig_conv.is_owned = false;
29631 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
29632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29634 uint64_t ret_ref = (uint64_t)ret_var.inner;
29635 if (ret_var.is_owned) {
29641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
29642 LDKRouteHint o_conv;
29643 o_conv.inner = (void*)(o & (~1));
29644 o_conv.is_owned = false;
29645 int64_t ret_val = RouteHint_hash(&o_conv);
29649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29650 LDKRouteHint a_conv;
29651 a_conv.inner = (void*)(a & (~1));
29652 a_conv.is_owned = false;
29653 LDKRouteHint b_conv;
29654 b_conv.inner = (void*)(b & (~1));
29655 b_conv.is_owned = false;
29656 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
29660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29661 LDKRouteHintHop this_obj_conv;
29662 this_obj_conv.inner = (void*)(this_obj & (~1));
29663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29664 RouteHintHop_free(this_obj_conv);
29667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29668 LDKRouteHintHop this_ptr_conv;
29669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29670 this_ptr_conv.is_owned = false;
29671 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29672 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
29676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29677 LDKRouteHintHop this_ptr_conv;
29678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29679 this_ptr_conv.is_owned = false;
29680 LDKPublicKey val_ref;
29681 CHECK((*env)->GetArrayLength(env, val) == 33);
29682 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29683 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
29686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29687 LDKRouteHintHop this_ptr_conv;
29688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29689 this_ptr_conv.is_owned = false;
29690 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
29694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29695 LDKRouteHintHop this_ptr_conv;
29696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29697 this_ptr_conv.is_owned = false;
29698 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
29701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
29702 LDKRouteHintHop this_ptr_conv;
29703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29704 this_ptr_conv.is_owned = false;
29705 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
29706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29708 uint64_t ret_ref = (uint64_t)ret_var.inner;
29709 if (ret_var.is_owned) {
29715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29716 LDKRouteHintHop this_ptr_conv;
29717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29718 this_ptr_conv.is_owned = false;
29719 LDKRoutingFees val_conv;
29720 val_conv.inner = (void*)(val & (~1));
29721 val_conv.is_owned = (val & 1) || (val == 0);
29722 val_conv = RoutingFees_clone(&val_conv);
29723 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
29726 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29727 LDKRouteHintHop this_ptr_conv;
29728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29729 this_ptr_conv.is_owned = false;
29730 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
29734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29735 LDKRouteHintHop this_ptr_conv;
29736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29737 this_ptr_conv.is_owned = false;
29738 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
29741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29742 LDKRouteHintHop this_ptr_conv;
29743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29744 this_ptr_conv.is_owned = false;
29745 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29746 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
29747 uint64_t ret_ref = (uint64_t)ret_copy;
29751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29752 LDKRouteHintHop this_ptr_conv;
29753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29754 this_ptr_conv.is_owned = false;
29755 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29756 CHECK_ACCESS(val_ptr);
29757 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29758 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
29759 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
29762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29763 LDKRouteHintHop this_ptr_conv;
29764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29765 this_ptr_conv.is_owned = false;
29766 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29767 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
29768 uint64_t ret_ref = (uint64_t)ret_copy;
29772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29773 LDKRouteHintHop this_ptr_conv;
29774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29775 this_ptr_conv.is_owned = false;
29776 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29777 CHECK_ACCESS(val_ptr);
29778 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29779 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
29780 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
29783 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) {
29784 LDKPublicKey src_node_id_arg_ref;
29785 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
29786 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
29787 LDKRoutingFees fees_arg_conv;
29788 fees_arg_conv.inner = (void*)(fees_arg & (~1));
29789 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
29790 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
29791 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
29792 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
29793 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
29794 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
29795 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
29796 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
29797 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
29798 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
29799 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);
29800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29802 uint64_t ret_ref = (uint64_t)ret_var.inner;
29803 if (ret_var.is_owned) {
29809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29810 LDKRouteHintHop orig_conv;
29811 orig_conv.inner = (void*)(orig & (~1));
29812 orig_conv.is_owned = false;
29813 LDKRouteHintHop ret_var = RouteHintHop_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_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
29824 LDKRouteHintHop o_conv;
29825 o_conv.inner = (void*)(o & (~1));
29826 o_conv.is_owned = false;
29827 int64_t ret_val = RouteHintHop_hash(&o_conv);
29831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29832 LDKRouteHintHop a_conv;
29833 a_conv.inner = (void*)(a & (~1));
29834 a_conv.is_owned = false;
29835 LDKRouteHintHop b_conv;
29836 b_conv.inner = (void*)(b & (~1));
29837 b_conv.is_owned = false;
29838 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
29842 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) {
29843 LDKPublicKey our_node_pubkey_ref;
29844 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
29845 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
29846 LDKNetworkGraph network_conv;
29847 network_conv.inner = (void*)(network & (~1));
29848 network_conv.is_owned = false;
29849 LDKPublicKey payee_ref;
29850 CHECK((*env)->GetArrayLength(env, payee) == 33);
29851 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
29852 LDKCVec_ChannelDetailsZ first_hops_constr;
29853 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
29854 if (first_hops != NULL) {
29855 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
29856 if (first_hops_constr.datalen > 0)
29857 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29859 first_hops_constr.data = NULL;
29860 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
29861 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
29862 int64_t first_hops_conv_16 = first_hops_vals[q];
29863 LDKChannelDetails first_hops_conv_16_conv;
29864 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
29865 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
29866 first_hops_constr.data[q] = first_hops_conv_16_conv;
29868 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
29869 first_hops_ptr = &first_hops_constr;
29871 LDKCVec_RouteHintZ last_hops_constr;
29872 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
29873 if (last_hops_constr.datalen > 0)
29874 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
29876 last_hops_constr.data = NULL;
29877 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
29878 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
29879 int64_t last_hops_conv_11 = last_hops_vals[l];
29880 LDKRouteHint last_hops_conv_11_conv;
29881 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
29882 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
29883 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
29884 last_hops_constr.data[l] = last_hops_conv_11_conv;
29886 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
29887 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
29888 CHECK_ACCESS(logger_ptr);
29889 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29890 if (logger_conv.free == LDKLogger_JCalls_free) {
29891 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29892 LDKLogger_JCalls_cloned(&logger_conv);
29894 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
29895 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
29896 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
29897 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
29898 *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);
29899 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
29900 return (uint64_t)ret_conv;
29903 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) {
29904 LDKPublicKey our_node_pubkey_ref;
29905 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
29906 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
29907 LDKNetworkGraph network_conv;
29908 network_conv.inner = (void*)(network & (~1));
29909 network_conv.is_owned = false;
29910 LDKPublicKey payee_ref;
29911 CHECK((*env)->GetArrayLength(env, payee) == 33);
29912 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
29913 LDKInvoiceFeatures payee_features_conv;
29914 payee_features_conv.inner = (void*)(payee_features & (~1));
29915 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
29916 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
29917 LDKCVec_ChannelDetailsZ first_hops_constr;
29918 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
29919 if (first_hops != NULL) {
29920 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
29921 if (first_hops_constr.datalen > 0)
29922 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29924 first_hops_constr.data = NULL;
29925 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
29926 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
29927 int64_t first_hops_conv_16 = first_hops_vals[q];
29928 LDKChannelDetails first_hops_conv_16_conv;
29929 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
29930 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
29931 first_hops_constr.data[q] = first_hops_conv_16_conv;
29933 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
29934 first_hops_ptr = &first_hops_constr;
29936 LDKCVec_RouteHintZ last_hops_constr;
29937 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
29938 if (last_hops_constr.datalen > 0)
29939 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
29941 last_hops_constr.data = NULL;
29942 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
29943 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
29944 int64_t last_hops_conv_11 = last_hops_vals[l];
29945 LDKRouteHint last_hops_conv_11_conv;
29946 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
29947 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
29948 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
29949 last_hops_constr.data[l] = last_hops_conv_11_conv;
29951 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
29952 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
29953 CHECK_ACCESS(logger_ptr);
29954 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29955 if (logger_conv.free == LDKLogger_JCalls_free) {
29956 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29957 LDKLogger_JCalls_cloned(&logger_conv);
29959 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
29960 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
29961 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
29962 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
29963 *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);
29964 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
29965 return (uint64_t)ret_conv;
29968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29969 LDKScorer this_obj_conv;
29970 this_obj_conv.inner = (void*)(this_obj & (~1));
29971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29972 Scorer_free(this_obj_conv);
29975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat) {
29976 LDKScorer ret_var = Scorer_new(base_penalty_msat);
29977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29979 uint64_t ret_ref = (uint64_t)ret_var.inner;
29980 if (ret_var.is_owned) {
29986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
29987 LDKScorer ret_var = Scorer_default();
29988 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29989 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29990 uint64_t ret_ref = (uint64_t)ret_var.inner;
29991 if (ret_var.is_owned) {
29997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
29998 LDKScorer this_arg_conv;
29999 this_arg_conv.inner = (void*)(this_arg & (~1));
30000 this_arg_conv.is_owned = false;
30001 LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore");
30002 *ret_ret = Scorer_as_Score(&this_arg_conv);
30003 return (uint64_t)ret_ret;
30006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30007 LDKFilesystemPersister this_obj_conv;
30008 this_obj_conv.inner = (void*)(this_obj & (~1));
30009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30010 FilesystemPersister_free(this_obj_conv);
30013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
30014 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
30015 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
30016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30018 uint64_t ret_ref = (uint64_t)ret_var.inner;
30019 if (ret_var.is_owned) {
30025 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
30026 LDKFilesystemPersister this_arg_conv;
30027 this_arg_conv.inner = (void*)(this_arg & (~1));
30028 this_arg_conv.is_owned = false;
30029 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
30030 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
30036 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
30037 LDKChannelManager manager_conv;
30038 manager_conv.inner = (void*)(manager & (~1));
30039 manager_conv.is_owned = false;
30040 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
30041 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
30042 return (uint64_t)ret_conv;
30045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
30046 LDKFilesystemPersister this_arg_conv;
30047 this_arg_conv.inner = (void*)(this_arg & (~1));
30048 this_arg_conv.is_owned = false;
30049 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
30050 CHECK_ACCESS(keys_manager_ptr);
30051 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30052 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30053 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30054 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30056 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
30057 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
30058 return (uint64_t)ret_conv;
30061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
30062 LDKFilesystemPersister this_arg_conv;
30063 this_arg_conv.inner = (void*)(this_arg & (~1));
30064 this_arg_conv.is_owned = false;
30065 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
30066 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
30067 return (uint64_t)ret_ret;
30070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30071 LDKBackgroundProcessor this_obj_conv;
30072 this_obj_conv.inner = (void*)(this_obj & (~1));
30073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30074 BackgroundProcessor_free(this_obj_conv);
30077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30078 if ((this_ptr & 1) != 0) return;
30079 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30080 CHECK_ACCESS(this_ptr_ptr);
30081 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
30082 FREE((void*)this_ptr);
30083 ChannelManagerPersister_free(this_ptr_conv);
30086 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) {
30087 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
30088 CHECK_ACCESS(persister_ptr);
30089 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
30090 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
30091 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30092 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
30094 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
30095 CHECK_ACCESS(event_handler_ptr);
30096 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
30097 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
30098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30099 LDKEventHandler_JCalls_cloned(&event_handler_conv);
30101 LDKChainMonitor chain_monitor_conv;
30102 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
30103 chain_monitor_conv.is_owned = false;
30104 LDKChannelManager channel_manager_conv;
30105 channel_manager_conv.inner = (void*)(channel_manager & (~1));
30106 channel_manager_conv.is_owned = false;
30107 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
30108 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
30109 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
30110 LDKPeerManager peer_manager_conv;
30111 peer_manager_conv.inner = (void*)(peer_manager & (~1));
30112 peer_manager_conv.is_owned = false;
30113 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
30114 CHECK_ACCESS(logger_ptr);
30115 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30116 if (logger_conv.free == LDKLogger_JCalls_free) {
30117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30118 LDKLogger_JCalls_cloned(&logger_conv);
30120 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);
30121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30123 uint64_t ret_ref = (uint64_t)ret_var.inner;
30124 if (ret_var.is_owned) {
30130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
30131 LDKBackgroundProcessor this_arg_conv;
30132 this_arg_conv.inner = (void*)(this_arg & (~1));
30133 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30134 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
30135 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
30136 *ret_conv = BackgroundProcessor_join(this_arg_conv);
30137 return (uint64_t)ret_conv;
30140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
30141 LDKBackgroundProcessor this_arg_conv;
30142 this_arg_conv.inner = (void*)(this_arg & (~1));
30143 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30144 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
30145 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
30146 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
30147 return (uint64_t)ret_conv;
30150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
30154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30155 LDKInvoice this_obj_conv;
30156 this_obj_conv.inner = (void*)(this_obj & (~1));
30157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30158 Invoice_free(this_obj_conv);
30161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30163 a_conv.inner = (void*)(a & (~1));
30164 a_conv.is_owned = false;
30166 b_conv.inner = (void*)(b & (~1));
30167 b_conv.is_owned = false;
30168 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
30172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30173 LDKInvoice orig_conv;
30174 orig_conv.inner = (void*)(orig & (~1));
30175 orig_conv.is_owned = false;
30176 LDKInvoice ret_var = Invoice_clone(&orig_conv);
30177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30179 uint64_t ret_ref = (uint64_t)ret_var.inner;
30180 if (ret_var.is_owned) {
30186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30187 LDKSignedRawInvoice this_obj_conv;
30188 this_obj_conv.inner = (void*)(this_obj & (~1));
30189 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30190 SignedRawInvoice_free(this_obj_conv);
30193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30194 LDKSignedRawInvoice a_conv;
30195 a_conv.inner = (void*)(a & (~1));
30196 a_conv.is_owned = false;
30197 LDKSignedRawInvoice b_conv;
30198 b_conv.inner = (void*)(b & (~1));
30199 b_conv.is_owned = false;
30200 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
30204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30205 LDKSignedRawInvoice orig_conv;
30206 orig_conv.inner = (void*)(orig & (~1));
30207 orig_conv.is_owned = false;
30208 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
30209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30211 uint64_t ret_ref = (uint64_t)ret_var.inner;
30212 if (ret_var.is_owned) {
30218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30219 LDKRawInvoice this_obj_conv;
30220 this_obj_conv.inner = (void*)(this_obj & (~1));
30221 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30222 RawInvoice_free(this_obj_conv);
30225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30226 LDKRawInvoice this_ptr_conv;
30227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30228 this_ptr_conv.is_owned = false;
30229 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
30230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30232 uint64_t ret_ref = (uint64_t)ret_var.inner;
30233 if (ret_var.is_owned) {
30239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30240 LDKRawInvoice this_ptr_conv;
30241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30242 this_ptr_conv.is_owned = false;
30243 LDKRawDataPart val_conv;
30244 val_conv.inner = (void*)(val & (~1));
30245 val_conv.is_owned = (val & 1) || (val == 0);
30246 val_conv = RawDataPart_clone(&val_conv);
30247 RawInvoice_set_data(&this_ptr_conv, val_conv);
30250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30251 LDKRawInvoice a_conv;
30252 a_conv.inner = (void*)(a & (~1));
30253 a_conv.is_owned = false;
30254 LDKRawInvoice b_conv;
30255 b_conv.inner = (void*)(b & (~1));
30256 b_conv.is_owned = false;
30257 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
30261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30262 LDKRawInvoice orig_conv;
30263 orig_conv.inner = (void*)(orig & (~1));
30264 orig_conv.is_owned = false;
30265 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
30266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30268 uint64_t ret_ref = (uint64_t)ret_var.inner;
30269 if (ret_var.is_owned) {
30275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30276 LDKRawDataPart this_obj_conv;
30277 this_obj_conv.inner = (void*)(this_obj & (~1));
30278 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30279 RawDataPart_free(this_obj_conv);
30282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
30283 LDKRawDataPart this_ptr_conv;
30284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30285 this_ptr_conv.is_owned = false;
30286 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
30287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30289 uint64_t ret_ref = (uint64_t)ret_var.inner;
30290 if (ret_var.is_owned) {
30296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30297 LDKRawDataPart this_ptr_conv;
30298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30299 this_ptr_conv.is_owned = false;
30300 LDKPositiveTimestamp val_conv;
30301 val_conv.inner = (void*)(val & (~1));
30302 val_conv.is_owned = (val & 1) || (val == 0);
30303 val_conv = PositiveTimestamp_clone(&val_conv);
30304 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
30307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30308 LDKRawDataPart a_conv;
30309 a_conv.inner = (void*)(a & (~1));
30310 a_conv.is_owned = false;
30311 LDKRawDataPart b_conv;
30312 b_conv.inner = (void*)(b & (~1));
30313 b_conv.is_owned = false;
30314 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
30318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30319 LDKRawDataPart orig_conv;
30320 orig_conv.inner = (void*)(orig & (~1));
30321 orig_conv.is_owned = false;
30322 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
30323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30325 uint64_t ret_ref = (uint64_t)ret_var.inner;
30326 if (ret_var.is_owned) {
30332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30333 LDKPositiveTimestamp this_obj_conv;
30334 this_obj_conv.inner = (void*)(this_obj & (~1));
30335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30336 PositiveTimestamp_free(this_obj_conv);
30339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30340 LDKPositiveTimestamp a_conv;
30341 a_conv.inner = (void*)(a & (~1));
30342 a_conv.is_owned = false;
30343 LDKPositiveTimestamp b_conv;
30344 b_conv.inner = (void*)(b & (~1));
30345 b_conv.is_owned = false;
30346 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
30350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30351 LDKPositiveTimestamp orig_conv;
30352 orig_conv.inner = (void*)(orig & (~1));
30353 orig_conv.is_owned = false;
30354 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
30355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30357 uint64_t ret_ref = (uint64_t)ret_var.inner;
30358 if (ret_var.is_owned) {
30364 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30365 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
30366 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
30370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
30371 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
30375 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
30376 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
30380 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
30381 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
30385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
30386 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
30390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30391 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
30392 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
30393 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
30397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
30398 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
30399 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
30403 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30404 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
30405 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
30409 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
30410 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
30414 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
30415 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
30419 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
30420 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
30424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
30425 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
30429 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
30430 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
30434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
30435 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
30436 int64_t ret_val = Currency_hash(o_conv);
30440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30441 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
30442 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
30443 jboolean ret_val = Currency_eq(a_conv, b_conv);
30447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30448 LDKSha256 this_obj_conv;
30449 this_obj_conv.inner = (void*)(this_obj & (~1));
30450 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30451 Sha256_free(this_obj_conv);
30454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30455 LDKSha256 orig_conv;
30456 orig_conv.inner = (void*)(orig & (~1));
30457 orig_conv.is_owned = false;
30458 LDKSha256 ret_var = Sha256_clone(&orig_conv);
30459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30461 uint64_t ret_ref = (uint64_t)ret_var.inner;
30462 if (ret_var.is_owned) {
30468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
30470 o_conv.inner = (void*)(o & (~1));
30471 o_conv.is_owned = false;
30472 int64_t ret_val = Sha256_hash(&o_conv);
30476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30478 a_conv.inner = (void*)(a & (~1));
30479 a_conv.is_owned = false;
30481 b_conv.inner = (void*)(b & (~1));
30482 b_conv.is_owned = false;
30483 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
30487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30488 LDKDescription this_obj_conv;
30489 this_obj_conv.inner = (void*)(this_obj & (~1));
30490 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30491 Description_free(this_obj_conv);
30494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30495 LDKDescription orig_conv;
30496 orig_conv.inner = (void*)(orig & (~1));
30497 orig_conv.is_owned = false;
30498 LDKDescription ret_var = Description_clone(&orig_conv);
30499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30501 uint64_t ret_ref = (uint64_t)ret_var.inner;
30502 if (ret_var.is_owned) {
30508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
30509 LDKDescription o_conv;
30510 o_conv.inner = (void*)(o & (~1));
30511 o_conv.is_owned = false;
30512 int64_t ret_val = Description_hash(&o_conv);
30516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30517 LDKDescription a_conv;
30518 a_conv.inner = (void*)(a & (~1));
30519 a_conv.is_owned = false;
30520 LDKDescription b_conv;
30521 b_conv.inner = (void*)(b & (~1));
30522 b_conv.is_owned = false;
30523 jboolean ret_val = Description_eq(&a_conv, &b_conv);
30527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30528 LDKPayeePubKey this_obj_conv;
30529 this_obj_conv.inner = (void*)(this_obj & (~1));
30530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30531 PayeePubKey_free(this_obj_conv);
30534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30535 LDKPayeePubKey orig_conv;
30536 orig_conv.inner = (void*)(orig & (~1));
30537 orig_conv.is_owned = false;
30538 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
30539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30541 uint64_t ret_ref = (uint64_t)ret_var.inner;
30542 if (ret_var.is_owned) {
30548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
30549 LDKPayeePubKey o_conv;
30550 o_conv.inner = (void*)(o & (~1));
30551 o_conv.is_owned = false;
30552 int64_t ret_val = PayeePubKey_hash(&o_conv);
30556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30557 LDKPayeePubKey a_conv;
30558 a_conv.inner = (void*)(a & (~1));
30559 a_conv.is_owned = false;
30560 LDKPayeePubKey b_conv;
30561 b_conv.inner = (void*)(b & (~1));
30562 b_conv.is_owned = false;
30563 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
30567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30568 LDKExpiryTime this_obj_conv;
30569 this_obj_conv.inner = (void*)(this_obj & (~1));
30570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30571 ExpiryTime_free(this_obj_conv);
30574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30575 LDKExpiryTime orig_conv;
30576 orig_conv.inner = (void*)(orig & (~1));
30577 orig_conv.is_owned = false;
30578 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
30579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30581 uint64_t ret_ref = (uint64_t)ret_var.inner;
30582 if (ret_var.is_owned) {
30588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
30589 LDKExpiryTime o_conv;
30590 o_conv.inner = (void*)(o & (~1));
30591 o_conv.is_owned = false;
30592 int64_t ret_val = ExpiryTime_hash(&o_conv);
30596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30597 LDKExpiryTime a_conv;
30598 a_conv.inner = (void*)(a & (~1));
30599 a_conv.is_owned = false;
30600 LDKExpiryTime b_conv;
30601 b_conv.inner = (void*)(b & (~1));
30602 b_conv.is_owned = false;
30603 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
30607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30608 LDKMinFinalCltvExpiry this_obj_conv;
30609 this_obj_conv.inner = (void*)(this_obj & (~1));
30610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30611 MinFinalCltvExpiry_free(this_obj_conv);
30614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30615 LDKMinFinalCltvExpiry orig_conv;
30616 orig_conv.inner = (void*)(orig & (~1));
30617 orig_conv.is_owned = false;
30618 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
30619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30621 uint64_t ret_ref = (uint64_t)ret_var.inner;
30622 if (ret_var.is_owned) {
30628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
30629 LDKMinFinalCltvExpiry o_conv;
30630 o_conv.inner = (void*)(o & (~1));
30631 o_conv.is_owned = false;
30632 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
30636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30637 LDKMinFinalCltvExpiry a_conv;
30638 a_conv.inner = (void*)(a & (~1));
30639 a_conv.is_owned = false;
30640 LDKMinFinalCltvExpiry b_conv;
30641 b_conv.inner = (void*)(b & (~1));
30642 b_conv.is_owned = false;
30643 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
30647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30648 if ((this_ptr & 1) != 0) return;
30649 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
30650 CHECK_ACCESS(this_ptr_ptr);
30651 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
30652 FREE((void*)this_ptr);
30653 Fallback_free(this_ptr_conv);
30656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30657 LDKFallback* orig_conv = (LDKFallback*)orig;
30658 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
30659 *ret_copy = Fallback_clone(orig_conv);
30660 uint64_t ret_ref = (uint64_t)ret_copy;
30664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
30666 LDKCVec_u8Z program_ref;
30667 program_ref.datalen = (*env)->GetArrayLength(env, program);
30668 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
30669 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
30670 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
30671 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
30672 uint64_t ret_ref = (uint64_t)ret_copy;
30676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
30677 LDKTwentyBytes a_ref;
30678 CHECK((*env)->GetArrayLength(env, a) == 20);
30679 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
30680 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
30681 *ret_copy = Fallback_pub_key_hash(a_ref);
30682 uint64_t ret_ref = (uint64_t)ret_copy;
30686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
30687 LDKTwentyBytes a_ref;
30688 CHECK((*env)->GetArrayLength(env, a) == 20);
30689 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
30690 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
30691 *ret_copy = Fallback_script_hash(a_ref);
30692 uint64_t ret_ref = (uint64_t)ret_copy;
30696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
30697 LDKFallback* o_conv = (LDKFallback*)o;
30698 int64_t ret_val = Fallback_hash(o_conv);
30702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30703 LDKFallback* a_conv = (LDKFallback*)a;
30704 LDKFallback* b_conv = (LDKFallback*)b;
30705 jboolean ret_val = Fallback_eq(a_conv, b_conv);
30709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30710 LDKInvoiceSignature this_obj_conv;
30711 this_obj_conv.inner = (void*)(this_obj & (~1));
30712 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30713 InvoiceSignature_free(this_obj_conv);
30716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30717 LDKInvoiceSignature orig_conv;
30718 orig_conv.inner = (void*)(orig & (~1));
30719 orig_conv.is_owned = false;
30720 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
30721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30723 uint64_t ret_ref = (uint64_t)ret_var.inner;
30724 if (ret_var.is_owned) {
30730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30731 LDKInvoiceSignature a_conv;
30732 a_conv.inner = (void*)(a & (~1));
30733 a_conv.is_owned = false;
30734 LDKInvoiceSignature b_conv;
30735 b_conv.inner = (void*)(b & (~1));
30736 b_conv.is_owned = false;
30737 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
30741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30742 LDKPrivateRoute this_obj_conv;
30743 this_obj_conv.inner = (void*)(this_obj & (~1));
30744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30745 PrivateRoute_free(this_obj_conv);
30748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30749 LDKPrivateRoute orig_conv;
30750 orig_conv.inner = (void*)(orig & (~1));
30751 orig_conv.is_owned = false;
30752 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
30753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30755 uint64_t ret_ref = (uint64_t)ret_var.inner;
30756 if (ret_var.is_owned) {
30762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
30763 LDKPrivateRoute o_conv;
30764 o_conv.inner = (void*)(o & (~1));
30765 o_conv.is_owned = false;
30766 int64_t ret_val = PrivateRoute_hash(&o_conv);
30770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30771 LDKPrivateRoute a_conv;
30772 a_conv.inner = (void*)(a & (~1));
30773 a_conv.is_owned = false;
30774 LDKPrivateRoute b_conv;
30775 b_conv.inner = (void*)(b & (~1));
30776 b_conv.is_owned = false;
30777 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
30781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
30782 LDKSignedRawInvoice this_arg_conv;
30783 this_arg_conv.inner = (void*)(this_arg & (~1));
30784 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
30785 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
30786 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
30787 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
30788 return ((uint64_t)ret_conv);
30791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
30792 LDKSignedRawInvoice this_arg_conv;
30793 this_arg_conv.inner = (void*)(this_arg & (~1));
30794 this_arg_conv.is_owned = false;
30795 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
30796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30798 uint64_t ret_ref = (uint64_t)ret_var.inner;
30799 if (ret_var.is_owned) {
30805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30806 LDKSignedRawInvoice this_arg_conv;
30807 this_arg_conv.inner = (void*)(this_arg & (~1));
30808 this_arg_conv.is_owned = false;
30809 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
30814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
30815 LDKSignedRawInvoice this_arg_conv;
30816 this_arg_conv.inner = (void*)(this_arg & (~1));
30817 this_arg_conv.is_owned = false;
30818 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
30819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30821 uint64_t ret_ref = (uint64_t)ret_var.inner;
30822 if (ret_var.is_owned) {
30828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30829 LDKSignedRawInvoice this_arg_conv;
30830 this_arg_conv.inner = (void*)(this_arg & (~1));
30831 this_arg_conv.is_owned = false;
30832 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
30833 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
30834 return (uint64_t)ret_conv;
30837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
30838 LDKSignedRawInvoice this_arg_conv;
30839 this_arg_conv.inner = (void*)(this_arg & (~1));
30840 this_arg_conv.is_owned = false;
30841 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
30845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30846 LDKRawInvoice this_arg_conv;
30847 this_arg_conv.inner = (void*)(this_arg & (~1));
30848 this_arg_conv.is_owned = false;
30849 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30850 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
30854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30855 LDKRawInvoice this_arg_conv;
30856 this_arg_conv.inner = (void*)(this_arg & (~1));
30857 this_arg_conv.is_owned = false;
30858 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
30859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30861 uint64_t ret_ref = (uint64_t)ret_var.inner;
30862 if (ret_var.is_owned) {
30868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
30869 LDKRawInvoice this_arg_conv;
30870 this_arg_conv.inner = (void*)(this_arg & (~1));
30871 this_arg_conv.is_owned = false;
30872 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
30873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30875 uint64_t ret_ref = (uint64_t)ret_var.inner;
30876 if (ret_var.is_owned) {
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
30883 LDKRawInvoice this_arg_conv;
30884 this_arg_conv.inner = (void*)(this_arg & (~1));
30885 this_arg_conv.is_owned = false;
30886 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
30887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30889 uint64_t ret_ref = (uint64_t)ret_var.inner;
30890 if (ret_var.is_owned) {
30896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
30897 LDKRawInvoice this_arg_conv;
30898 this_arg_conv.inner = (void*)(this_arg & (~1));
30899 this_arg_conv.is_owned = false;
30900 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
30901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30903 uint64_t ret_ref = (uint64_t)ret_var.inner;
30904 if (ret_var.is_owned) {
30910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
30911 LDKRawInvoice this_arg_conv;
30912 this_arg_conv.inner = (void*)(this_arg & (~1));
30913 this_arg_conv.is_owned = false;
30914 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
30915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30917 uint64_t ret_ref = (uint64_t)ret_var.inner;
30918 if (ret_var.is_owned) {
30924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
30925 LDKRawInvoice this_arg_conv;
30926 this_arg_conv.inner = (void*)(this_arg & (~1));
30927 this_arg_conv.is_owned = false;
30928 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
30929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30931 uint64_t ret_ref = (uint64_t)ret_var.inner;
30932 if (ret_var.is_owned) {
30938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
30939 LDKRawInvoice this_arg_conv;
30940 this_arg_conv.inner = (void*)(this_arg & (~1));
30941 this_arg_conv.is_owned = false;
30942 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30943 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
30947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
30948 LDKRawInvoice this_arg_conv;
30949 this_arg_conv.inner = (void*)(this_arg & (~1));
30950 this_arg_conv.is_owned = false;
30951 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
30952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30954 uint64_t ret_ref = (uint64_t)ret_var.inner;
30955 if (ret_var.is_owned) {
30961 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
30962 LDKRawInvoice this_arg_conv;
30963 this_arg_conv.inner = (void*)(this_arg & (~1));
30964 this_arg_conv.is_owned = false;
30965 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
30966 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
30967 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
30968 for (size_t o = 0; o < ret_var.datalen; o++) {
30969 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
30970 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30971 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30972 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
30973 if (ret_conv_14_var.is_owned) {
30974 ret_conv_14_ref |= 1;
30976 ret_arr_ptr[o] = ret_conv_14_ref;
30978 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
30979 FREE(ret_var.data);
30983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
30984 LDKRawInvoice this_arg_conv;
30985 this_arg_conv.inner = (void*)(this_arg & (~1));
30986 this_arg_conv.is_owned = false;
30987 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30988 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
30989 uint64_t ret_ref = (uint64_t)ret_copy;
30993 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
30994 LDKRawInvoice this_arg_conv;
30995 this_arg_conv.inner = (void*)(this_arg & (~1));
30996 this_arg_conv.is_owned = false;
30997 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
31001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
31002 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31003 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
31004 return (uint64_t)ret_conv;
31007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
31008 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31009 *ret_conv = PositiveTimestamp_from_system_time(time);
31010 return (uint64_t)ret_conv;
31013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
31014 LDKPositiveTimestamp this_arg_conv;
31015 this_arg_conv.inner = (void*)(this_arg & (~1));
31016 this_arg_conv.is_owned = false;
31017 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
31021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
31022 LDKPositiveTimestamp this_arg_conv;
31023 this_arg_conv.inner = (void*)(this_arg & (~1));
31024 this_arg_conv.is_owned = false;
31025 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
31029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
31030 LDKInvoice this_arg_conv;
31031 this_arg_conv.inner = (void*)(this_arg & (~1));
31032 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31033 this_arg_conv = Invoice_clone(&this_arg_conv);
31034 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
31035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31037 uint64_t ret_ref = (uint64_t)ret_var.inner;
31038 if (ret_var.is_owned) {
31044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
31045 LDKInvoice this_arg_conv;
31046 this_arg_conv.inner = (void*)(this_arg & (~1));
31047 this_arg_conv.is_owned = false;
31048 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
31049 *ret_conv = Invoice_check_signature(&this_arg_conv);
31050 return (uint64_t)ret_conv;
31053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
31054 LDKSignedRawInvoice signed_invoice_conv;
31055 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
31056 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
31057 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
31058 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
31059 *ret_conv = Invoice_from_signed(signed_invoice_conv);
31060 return (uint64_t)ret_conv;
31063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
31064 LDKInvoice this_arg_conv;
31065 this_arg_conv.inner = (void*)(this_arg & (~1));
31066 this_arg_conv.is_owned = false;
31067 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
31071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
31072 LDKInvoice this_arg_conv;
31073 this_arg_conv.inner = (void*)(this_arg & (~1));
31074 this_arg_conv.is_owned = false;
31075 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31076 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
31080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
31081 LDKInvoice this_arg_conv;
31082 this_arg_conv.inner = (void*)(this_arg & (~1));
31083 this_arg_conv.is_owned = false;
31084 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31085 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
31089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
31090 LDKInvoice this_arg_conv;
31091 this_arg_conv.inner = (void*)(this_arg & (~1));
31092 this_arg_conv.is_owned = false;
31093 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31094 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
31098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
31099 LDKInvoice this_arg_conv;
31100 this_arg_conv.inner = (void*)(this_arg & (~1));
31101 this_arg_conv.is_owned = false;
31102 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
31103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31105 uint64_t ret_ref = (uint64_t)ret_var.inner;
31106 if (ret_var.is_owned) {
31112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
31113 LDKInvoice this_arg_conv;
31114 this_arg_conv.inner = (void*)(this_arg & (~1));
31115 this_arg_conv.is_owned = false;
31116 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31117 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
31121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
31122 LDKInvoice this_arg_conv;
31123 this_arg_conv.inner = (void*)(this_arg & (~1));
31124 this_arg_conv.is_owned = false;
31125 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
31129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
31130 LDKInvoice this_arg_conv;
31131 this_arg_conv.inner = (void*)(this_arg & (~1));
31132 this_arg_conv.is_owned = false;
31133 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
31137 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
31138 LDKInvoice this_arg_conv;
31139 this_arg_conv.inner = (void*)(this_arg & (~1));
31140 this_arg_conv.is_owned = false;
31141 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
31142 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31143 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31144 for (size_t o = 0; o < ret_var.datalen; o++) {
31145 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
31146 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31147 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31148 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
31149 if (ret_conv_14_var.is_owned) {
31150 ret_conv_14_ref |= 1;
31152 ret_arr_ptr[o] = ret_conv_14_ref;
31154 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31155 FREE(ret_var.data);
31159 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
31160 LDKInvoice this_arg_conv;
31161 this_arg_conv.inner = (void*)(this_arg & (~1));
31162 this_arg_conv.is_owned = false;
31163 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
31164 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31165 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31166 for (size_t l = 0; l < ret_var.datalen; l++) {
31167 LDKRouteHint ret_conv_11_var = ret_var.data[l];
31168 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31169 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31170 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
31171 if (ret_conv_11_var.is_owned) {
31172 ret_conv_11_ref |= 1;
31174 ret_arr_ptr[l] = ret_conv_11_ref;
31176 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31177 FREE(ret_var.data);
31181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
31182 LDKInvoice this_arg_conv;
31183 this_arg_conv.inner = (void*)(this_arg & (~1));
31184 this_arg_conv.is_owned = false;
31185 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
31189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
31190 LDKInvoice this_arg_conv;
31191 this_arg_conv.inner = (void*)(this_arg & (~1));
31192 this_arg_conv.is_owned = false;
31193 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31194 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
31195 uint64_t ret_ref = (uint64_t)ret_copy;
31199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
31200 LDKStr description_conv = java_to_owned_str(env, description);
31201 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31202 *ret_conv = Description_new(description_conv);
31203 return (uint64_t)ret_conv;
31206 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
31207 LDKDescription this_arg_conv;
31208 this_arg_conv.inner = (void*)(this_arg & (~1));
31209 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31210 this_arg_conv = Description_clone(&this_arg_conv);
31211 LDKStr ret_str = Description_into_inner(this_arg_conv);
31212 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
31218 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
31219 *ret_conv = ExpiryTime_from_seconds(seconds);
31220 return (uint64_t)ret_conv;
31223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
31224 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
31225 *ret_conv = ExpiryTime_from_duration(duration);
31226 return (uint64_t)ret_conv;
31229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
31230 LDKExpiryTime this_arg_conv;
31231 this_arg_conv.inner = (void*)(this_arg & (~1));
31232 this_arg_conv.is_owned = false;
31233 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
31237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
31238 LDKExpiryTime this_arg_conv;
31239 this_arg_conv.inner = (void*)(this_arg & (~1));
31240 this_arg_conv.is_owned = false;
31241 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
31245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
31246 LDKRouteHint hops_conv;
31247 hops_conv.inner = (void*)(hops & (~1));
31248 hops_conv.is_owned = (hops & 1) || (hops == 0);
31249 hops_conv = RouteHint_clone(&hops_conv);
31250 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31251 *ret_conv = PrivateRoute_new(hops_conv);
31252 return (uint64_t)ret_conv;
31255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
31256 LDKPrivateRoute this_arg_conv;
31257 this_arg_conv.inner = (void*)(this_arg & (~1));
31258 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31259 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
31260 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
31261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31263 uint64_t ret_ref = (uint64_t)ret_var.inner;
31264 if (ret_var.is_owned) {
31270 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31271 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
31272 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
31276 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
31277 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
31281 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
31282 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
31286 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
31287 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
31291 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
31292 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
31296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31297 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
31298 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
31299 jboolean ret_val = CreationError_eq(a_conv, b_conv);
31303 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31304 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
31305 LDKStr ret_str = CreationError_to_str(o_conv);
31306 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31312 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
31313 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
31317 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
31318 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
31322 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
31323 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
31327 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
31328 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
31332 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
31333 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
31337 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
31338 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
31342 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
31343 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
31347 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
31348 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
31352 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
31353 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
31357 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
31358 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
31362 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
31363 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
31367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31368 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
31369 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
31370 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
31374 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31375 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
31376 LDKStr ret_str = SemanticError_to_str(o_conv);
31377 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
31383 if ((this_ptr & 1) != 0) return;
31384 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31385 CHECK_ACCESS(this_ptr_ptr);
31386 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
31387 FREE((void*)this_ptr);
31388 SignOrCreationError_free(this_ptr_conv);
31391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31392 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
31393 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
31394 *ret_copy = SignOrCreationError_clone(orig_conv);
31395 uint64_t ret_ref = (uint64_t)ret_copy;
31399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
31400 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
31401 *ret_copy = SignOrCreationError_sign_error();
31402 uint64_t ret_ref = (uint64_t)ret_copy;
31406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
31407 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
31408 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
31409 *ret_copy = SignOrCreationError_creation_error(a_conv);
31410 uint64_t ret_ref = (uint64_t)ret_copy;
31414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31415 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
31416 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
31417 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
31421 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31422 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
31423 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
31424 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31429 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) {
31430 LDKChannelManager channelmanager_conv;
31431 channelmanager_conv.inner = (void*)(channelmanager & (~1));
31432 channelmanager_conv.is_owned = false;
31433 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
31434 CHECK_ACCESS(keys_manager_ptr);
31435 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
31436 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
31437 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31438 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
31440 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
31441 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
31442 CHECK_ACCESS(amt_msat_ptr);
31443 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
31444 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
31445 LDKStr description_conv = java_to_owned_str(env, description);
31446 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
31447 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
31448 return (uint64_t)ret_conv;
31451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
31452 LDKStr s_conv = java_to_owned_str(env, s);
31453 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
31454 *ret_conv = SiPrefix_from_str(s_conv);
31455 return (uint64_t)ret_conv;
31458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
31459 LDKStr s_conv = java_to_owned_str(env, s);
31460 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
31461 *ret_conv = Invoice_from_str(s_conv);
31462 return (uint64_t)ret_conv;
31465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
31466 LDKStr s_conv = java_to_owned_str(env, s);
31467 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
31468 *ret_conv = SignedRawInvoice_from_str(s_conv);
31469 return (uint64_t)ret_conv;
31472 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31474 o_conv.inner = (void*)(o & (~1));
31475 o_conv.is_owned = false;
31476 LDKStr ret_str = Invoice_to_str(&o_conv);
31477 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31482 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31483 LDKSignedRawInvoice o_conv;
31484 o_conv.inner = (void*)(o & (~1));
31485 o_conv.is_owned = false;
31486 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
31487 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31492 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31493 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
31494 LDKStr ret_str = Currency_to_str(o_conv);
31495 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
31500 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
31501 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
31502 LDKStr ret_str = SiPrefix_to_str(o_conv);
31503 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);