1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
6 #include "org_ldk_impl_bindings.h"
12 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
13 #define MALLOC(a, _) malloc(a)
14 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
15 #define CHECK_ACCESS(p)
16 #define DO_ASSERT(a) (void)(a)
19 static jmethodID ordinal_meth = NULL;
20 static jmethodID slicedef_meth = NULL;
21 static jclass slicedef_cls = NULL;
22 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
23 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
24 CHECK(ordinal_meth != NULL);
25 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
26 CHECK(slicedef_meth != NULL);
27 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
28 CHECK(slicedef_cls != NULL);
31 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
37 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
40 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
41 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
42 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
45 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
46 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
47 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
48 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
51 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
52 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
53 vec->datalen = (*env)->GetArrayLength(env, bytes);
54 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
55 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
58 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
59 LDKTransaction *txdata = (LDKTransaction*)ptr;
61 slice.data = txdata->data;
62 slice.datalen = txdata->datalen;
63 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
65 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
66 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
67 txdata->datalen = (*env)->GetArrayLength(env, bytes);
68 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
69 txdata->data_is_owned = false;
70 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
71 return (uint64_t)txdata;
73 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
74 LDKTransaction *tx = (LDKTransaction*)ptr;
75 tx->data_is_owned = true;
76 Transaction_free(*tx);
79 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
80 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
82 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
84 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
85 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
86 return (uint64_t)vec->datalen;
88 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
89 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
91 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
93 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
94 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
100 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
101 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
103 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
106 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
107 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
109 typedef jlongArray int64_tArray;
110 typedef jbyteArray int8_tArray;
112 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
113 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
114 char* conv_buf = MALLOC(len + 1, "str conv buf");
115 memcpy(conv_buf, chars, len);
117 jstring ret = (*env)->NewStringUTF(env, conv_buf);
121 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
122 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
123 char* newchars = MALLOC(str_len + 1, "String chars");
124 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
125 memcpy(newchars, jchars, str_len);
126 newchars[str_len] = 0;
127 (*env)->ReleaseStringUTFChars(env, str, jchars);
131 .chars_is_owned = true
136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
137 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
139 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
140 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
143 static jclass arr_of_B_clz = NULL;
144 static jclass arr_of_J_clz = NULL;
145 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
146 arr_of_B_clz = (*env)->FindClass(env, "[B");
147 CHECK(arr_of_B_clz != NULL);
148 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
149 arr_of_J_clz = (*env)->FindClass(env, "[J");
150 CHECK(arr_of_J_clz != NULL);
151 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
153 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
154 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
155 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
156 case 0: return LDKAccessError_UnknownChain;
157 case 1: return LDKAccessError_UnknownTx;
161 static jclass AccessError_class = NULL;
162 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
163 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
164 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
165 AccessError_class = (*env)->NewGlobalRef(env, clz);
166 CHECK(AccessError_class != NULL);
167 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
168 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
169 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
170 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
172 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
174 case LDKAccessError_UnknownChain:
175 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
176 case LDKAccessError_UnknownTx:
177 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
182 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
183 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
184 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
185 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
189 static jclass ChannelMonitorUpdateErr_class = NULL;
190 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
191 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
192 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
193 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
194 CHECK(ChannelMonitorUpdateErr_class != NULL);
195 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
196 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
197 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
198 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
200 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
202 case LDKChannelMonitorUpdateErr_TemporaryFailure:
203 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
204 case LDKChannelMonitorUpdateErr_PermanentFailure:
205 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
210 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
211 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
212 case 0: return LDKConfirmationTarget_Background;
213 case 1: return LDKConfirmationTarget_Normal;
214 case 2: return LDKConfirmationTarget_HighPriority;
218 static jclass ConfirmationTarget_class = NULL;
219 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
220 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
221 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
222 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
223 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
224 CHECK(ConfirmationTarget_class != NULL);
225 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
226 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
227 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
228 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
229 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
230 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
232 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
234 case LDKConfirmationTarget_Background:
235 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
236 case LDKConfirmationTarget_Normal:
237 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
238 case LDKConfirmationTarget_HighPriority:
239 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
244 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
245 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
246 case 0: return LDKCreationError_DescriptionTooLong;
247 case 1: return LDKCreationError_RouteTooLong;
248 case 2: return LDKCreationError_TimestampOutOfBounds;
249 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
253 static jclass CreationError_class = NULL;
254 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
255 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
256 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
257 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
258 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
259 CreationError_class = (*env)->NewGlobalRef(env, clz);
260 CHECK(CreationError_class != NULL);
261 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
262 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
263 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
264 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
265 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
266 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
267 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
268 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
270 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
272 case LDKCreationError_DescriptionTooLong:
273 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
274 case LDKCreationError_RouteTooLong:
275 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
276 case LDKCreationError_TimestampOutOfBounds:
277 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
278 case LDKCreationError_ExpiryTimeOutOfBounds:
279 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
284 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
285 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
286 case 0: return LDKCurrency_Bitcoin;
287 case 1: return LDKCurrency_BitcoinTestnet;
288 case 2: return LDKCurrency_Regtest;
289 case 3: return LDKCurrency_Simnet;
290 case 4: return LDKCurrency_Signet;
294 static jclass Currency_class = NULL;
295 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
296 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
297 static jfieldID Currency_LDKCurrency_Regtest = NULL;
298 static jfieldID Currency_LDKCurrency_Simnet = NULL;
299 static jfieldID Currency_LDKCurrency_Signet = NULL;
300 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
301 Currency_class = (*env)->NewGlobalRef(env, clz);
302 CHECK(Currency_class != NULL);
303 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
304 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
305 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
306 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
307 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
308 CHECK(Currency_LDKCurrency_Regtest != NULL);
309 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
310 CHECK(Currency_LDKCurrency_Simnet != NULL);
311 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
312 CHECK(Currency_LDKCurrency_Signet != NULL);
314 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
316 case LDKCurrency_Bitcoin:
317 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
318 case LDKCurrency_BitcoinTestnet:
319 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
320 case LDKCurrency_Regtest:
321 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
322 case LDKCurrency_Simnet:
323 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
324 case LDKCurrency_Signet:
325 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
330 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
331 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
332 case 0: return LDKIOError_NotFound;
333 case 1: return LDKIOError_PermissionDenied;
334 case 2: return LDKIOError_ConnectionRefused;
335 case 3: return LDKIOError_ConnectionReset;
336 case 4: return LDKIOError_ConnectionAborted;
337 case 5: return LDKIOError_NotConnected;
338 case 6: return LDKIOError_AddrInUse;
339 case 7: return LDKIOError_AddrNotAvailable;
340 case 8: return LDKIOError_BrokenPipe;
341 case 9: return LDKIOError_AlreadyExists;
342 case 10: return LDKIOError_WouldBlock;
343 case 11: return LDKIOError_InvalidInput;
344 case 12: return LDKIOError_InvalidData;
345 case 13: return LDKIOError_TimedOut;
346 case 14: return LDKIOError_WriteZero;
347 case 15: return LDKIOError_Interrupted;
348 case 16: return LDKIOError_Other;
349 case 17: return LDKIOError_UnexpectedEof;
353 static jclass IOError_class = NULL;
354 static jfieldID IOError_LDKIOError_NotFound = NULL;
355 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
356 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
357 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
358 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
359 static jfieldID IOError_LDKIOError_NotConnected = NULL;
360 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
361 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
362 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
363 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
364 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
365 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
366 static jfieldID IOError_LDKIOError_InvalidData = NULL;
367 static jfieldID IOError_LDKIOError_TimedOut = NULL;
368 static jfieldID IOError_LDKIOError_WriteZero = NULL;
369 static jfieldID IOError_LDKIOError_Interrupted = NULL;
370 static jfieldID IOError_LDKIOError_Other = NULL;
371 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
372 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
373 IOError_class = (*env)->NewGlobalRef(env, clz);
374 CHECK(IOError_class != NULL);
375 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
376 CHECK(IOError_LDKIOError_NotFound != NULL);
377 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
378 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
379 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
380 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
381 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
382 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
383 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
384 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
385 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
386 CHECK(IOError_LDKIOError_NotConnected != NULL);
387 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
388 CHECK(IOError_LDKIOError_AddrInUse != NULL);
389 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
390 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
391 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
392 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
393 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
394 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
395 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
396 CHECK(IOError_LDKIOError_WouldBlock != NULL);
397 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
398 CHECK(IOError_LDKIOError_InvalidInput != NULL);
399 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
400 CHECK(IOError_LDKIOError_InvalidData != NULL);
401 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
402 CHECK(IOError_LDKIOError_TimedOut != NULL);
403 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
404 CHECK(IOError_LDKIOError_WriteZero != NULL);
405 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
406 CHECK(IOError_LDKIOError_Interrupted != NULL);
407 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
408 CHECK(IOError_LDKIOError_Other != NULL);
409 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
410 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
412 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
414 case LDKIOError_NotFound:
415 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
416 case LDKIOError_PermissionDenied:
417 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
418 case LDKIOError_ConnectionRefused:
419 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
420 case LDKIOError_ConnectionReset:
421 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
422 case LDKIOError_ConnectionAborted:
423 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
424 case LDKIOError_NotConnected:
425 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
426 case LDKIOError_AddrInUse:
427 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
428 case LDKIOError_AddrNotAvailable:
429 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
430 case LDKIOError_BrokenPipe:
431 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
432 case LDKIOError_AlreadyExists:
433 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
434 case LDKIOError_WouldBlock:
435 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
436 case LDKIOError_InvalidInput:
437 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
438 case LDKIOError_InvalidData:
439 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
440 case LDKIOError_TimedOut:
441 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
442 case LDKIOError_WriteZero:
443 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
444 case LDKIOError_Interrupted:
445 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
446 case LDKIOError_Other:
447 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
448 case LDKIOError_UnexpectedEof:
449 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
454 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
455 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
456 case 0: return LDKLevel_Trace;
457 case 1: return LDKLevel_Debug;
458 case 2: return LDKLevel_Info;
459 case 3: return LDKLevel_Warn;
460 case 4: return LDKLevel_Error;
464 static jclass Level_class = NULL;
465 static jfieldID Level_LDKLevel_Trace = NULL;
466 static jfieldID Level_LDKLevel_Debug = NULL;
467 static jfieldID Level_LDKLevel_Info = NULL;
468 static jfieldID Level_LDKLevel_Warn = NULL;
469 static jfieldID Level_LDKLevel_Error = NULL;
470 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
471 Level_class = (*env)->NewGlobalRef(env, clz);
472 CHECK(Level_class != NULL);
473 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
474 CHECK(Level_LDKLevel_Trace != NULL);
475 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
476 CHECK(Level_LDKLevel_Debug != NULL);
477 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
478 CHECK(Level_LDKLevel_Info != NULL);
479 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
480 CHECK(Level_LDKLevel_Warn != NULL);
481 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
482 CHECK(Level_LDKLevel_Error != NULL);
484 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
487 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
489 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
491 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
493 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
495 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
500 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
501 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
502 case 0: return LDKNetwork_Bitcoin;
503 case 1: return LDKNetwork_Testnet;
504 case 2: return LDKNetwork_Regtest;
505 case 3: return LDKNetwork_Signet;
509 static jclass Network_class = NULL;
510 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
511 static jfieldID Network_LDKNetwork_Testnet = NULL;
512 static jfieldID Network_LDKNetwork_Regtest = NULL;
513 static jfieldID Network_LDKNetwork_Signet = NULL;
514 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
515 Network_class = (*env)->NewGlobalRef(env, clz);
516 CHECK(Network_class != NULL);
517 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
518 CHECK(Network_LDKNetwork_Bitcoin != NULL);
519 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
520 CHECK(Network_LDKNetwork_Testnet != NULL);
521 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
522 CHECK(Network_LDKNetwork_Regtest != NULL);
523 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
524 CHECK(Network_LDKNetwork_Signet != NULL);
526 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
528 case LDKNetwork_Bitcoin:
529 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
530 case LDKNetwork_Testnet:
531 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
532 case LDKNetwork_Regtest:
533 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
534 case LDKNetwork_Signet:
535 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
540 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
541 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
542 case 0: return LDKSecp256k1Error_IncorrectSignature;
543 case 1: return LDKSecp256k1Error_InvalidMessage;
544 case 2: return LDKSecp256k1Error_InvalidPublicKey;
545 case 3: return LDKSecp256k1Error_InvalidSignature;
546 case 4: return LDKSecp256k1Error_InvalidSecretKey;
547 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
548 case 6: return LDKSecp256k1Error_InvalidTweak;
549 case 7: return LDKSecp256k1Error_TweakCheckFailed;
550 case 8: return LDKSecp256k1Error_NotEnoughMemory;
554 static jclass Secp256k1Error_class = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
564 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
565 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
566 CHECK(Secp256k1Error_class != NULL);
567 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
568 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
569 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
570 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
571 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
572 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
573 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
574 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
575 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
576 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
577 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
578 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
579 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
580 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
581 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
582 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
583 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
584 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
586 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
588 case LDKSecp256k1Error_IncorrectSignature:
589 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
590 case LDKSecp256k1Error_InvalidMessage:
591 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
592 case LDKSecp256k1Error_InvalidPublicKey:
593 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
594 case LDKSecp256k1Error_InvalidSignature:
595 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
596 case LDKSecp256k1Error_InvalidSecretKey:
597 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
598 case LDKSecp256k1Error_InvalidRecoveryId:
599 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
600 case LDKSecp256k1Error_InvalidTweak:
601 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
602 case LDKSecp256k1Error_TweakCheckFailed:
603 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
604 case LDKSecp256k1Error_NotEnoughMemory:
605 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
610 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
611 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
612 case 0: return LDKSemanticError_NoPaymentHash;
613 case 1: return LDKSemanticError_MultiplePaymentHashes;
614 case 2: return LDKSemanticError_NoDescription;
615 case 3: return LDKSemanticError_MultipleDescriptions;
616 case 4: return LDKSemanticError_NoPaymentSecret;
617 case 5: return LDKSemanticError_MultiplePaymentSecrets;
618 case 6: return LDKSemanticError_InvalidFeatures;
619 case 7: return LDKSemanticError_InvalidRecoveryId;
620 case 8: return LDKSemanticError_InvalidSignature;
621 case 9: return LDKSemanticError_ImpreciseAmount;
625 static jclass SemanticError_class = NULL;
626 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
627 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
628 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
629 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
630 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
631 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
632 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
633 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
634 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
635 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
636 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
637 SemanticError_class = (*env)->NewGlobalRef(env, clz);
638 CHECK(SemanticError_class != NULL);
639 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
640 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
641 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
642 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
643 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
644 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
645 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
646 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
647 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
648 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
649 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
650 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
651 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
652 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
653 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
654 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
655 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
656 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
657 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
658 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
660 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
662 case LDKSemanticError_NoPaymentHash:
663 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
664 case LDKSemanticError_MultiplePaymentHashes:
665 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
666 case LDKSemanticError_NoDescription:
667 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
668 case LDKSemanticError_MultipleDescriptions:
669 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
670 case LDKSemanticError_NoPaymentSecret:
671 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
672 case LDKSemanticError_MultiplePaymentSecrets:
673 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
674 case LDKSemanticError_InvalidFeatures:
675 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
676 case LDKSemanticError_InvalidRecoveryId:
677 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
678 case LDKSemanticError_InvalidSignature:
679 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
680 case LDKSemanticError_ImpreciseAmount:
681 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
686 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
687 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
688 case 0: return LDKSiPrefix_Milli;
689 case 1: return LDKSiPrefix_Micro;
690 case 2: return LDKSiPrefix_Nano;
691 case 3: return LDKSiPrefix_Pico;
695 static jclass SiPrefix_class = NULL;
696 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
697 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
698 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
699 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
701 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
702 CHECK(SiPrefix_class != NULL);
703 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
704 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
705 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
706 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
707 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
708 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
709 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
710 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
712 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
714 case LDKSiPrefix_Milli:
715 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
716 case LDKSiPrefix_Micro:
717 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
718 case LDKSiPrefix_Nano:
719 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
720 case LDKSiPrefix_Pico:
721 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
727 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
728 ret->datalen = (*env)->GetArrayLength(env, elems);
729 if (ret->datalen == 0) {
732 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
733 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
734 for (size_t i = 0; i < ret->datalen; i++) {
735 ret->data[i] = java_elems[i];
737 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
739 return (uint64_t)ret;
741 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
742 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
743 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
746 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) {
747 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
748 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
749 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
750 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
751 CVec_u8Z_free(ret_var);
755 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) {
756 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
757 int64_t ret_val = TxOut_get_value(thing_conv);
761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
762 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
765 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
766 CHECK(val->result_ok);
767 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
768 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
771 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
772 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
773 CHECK(!val->result_ok);
774 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
778 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
781 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
782 CHECK(val->result_ok);
783 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
784 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
787 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
788 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
789 CHECK(!val->result_ok);
790 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
794 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
797 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
798 CHECK(val->result_ok);
799 LDKTxCreationKeys res_var = (*val->contents.result);
800 uint64_t res_ref = 0;
801 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
802 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
803 res_ref = (uint64_t)res_var.inner & ~1;
806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
807 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
808 CHECK(!val->result_ok);
809 LDKDecodeError err_var = (*val->contents.err);
810 uint64_t err_ref = 0;
811 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
812 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
813 err_ref = (uint64_t)err_var.inner & ~1;
816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
817 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
820 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
821 CHECK(val->result_ok);
822 LDKChannelPublicKeys res_var = (*val->contents.result);
823 uint64_t res_ref = 0;
824 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
825 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
826 res_ref = (uint64_t)res_var.inner & ~1;
829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
830 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
831 CHECK(!val->result_ok);
832 LDKDecodeError err_var = (*val->contents.err);
833 uint64_t err_ref = 0;
834 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
835 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
836 err_ref = (uint64_t)err_var.inner & ~1;
839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
840 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
843 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
844 CHECK(val->result_ok);
845 LDKTxCreationKeys res_var = (*val->contents.result);
846 uint64_t res_ref = 0;
847 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
848 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
849 res_ref = (uint64_t)res_var.inner & ~1;
852 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
853 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
854 CHECK(!val->result_ok);
855 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
858 static jclass LDKCOption_u32Z_Some_class = NULL;
859 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
860 static jclass LDKCOption_u32Z_None_class = NULL;
861 static jmethodID LDKCOption_u32Z_None_meth = NULL;
862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
863 LDKCOption_u32Z_Some_class =
864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
865 CHECK(LDKCOption_u32Z_Some_class != NULL);
866 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
867 CHECK(LDKCOption_u32Z_Some_meth != NULL);
868 LDKCOption_u32Z_None_class =
869 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
870 CHECK(LDKCOption_u32Z_None_class != NULL);
871 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
872 CHECK(LDKCOption_u32Z_None_meth != NULL);
874 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
875 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
877 case LDKCOption_u32Z_Some: {
878 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
880 case LDKCOption_u32Z_None: {
881 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
887 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
890 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
891 CHECK(val->result_ok);
892 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
893 uint64_t res_ref = 0;
894 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
895 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
896 res_ref = (uint64_t)res_var.inner & ~1;
899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
900 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
901 CHECK(!val->result_ok);
902 LDKDecodeError err_var = (*val->contents.err);
903 uint64_t err_ref = 0;
904 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
905 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
906 err_ref = (uint64_t)err_var.inner & ~1;
909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
910 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
913 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
914 CHECK(val->result_ok);
915 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
916 uint64_t res_ref = 0;
917 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
918 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
919 res_ref = (uint64_t)res_var.inner & ~1;
922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
923 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
924 CHECK(!val->result_ok);
925 LDKDecodeError err_var = (*val->contents.err);
926 uint64_t err_ref = 0;
927 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
928 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
929 err_ref = (uint64_t)err_var.inner & ~1;
932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
933 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
936 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
937 CHECK(val->result_ok);
938 LDKChannelTransactionParameters res_var = (*val->contents.result);
939 uint64_t res_ref = 0;
940 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 res_ref = (uint64_t)res_var.inner & ~1;
945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
946 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
947 CHECK(!val->result_ok);
948 LDKDecodeError err_var = (*val->contents.err);
949 uint64_t err_ref = 0;
950 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
951 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
952 err_ref = (uint64_t)err_var.inner & ~1;
955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
956 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
959 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
960 CHECK(val->result_ok);
961 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
962 uint64_t res_ref = 0;
963 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
964 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
965 res_ref = (uint64_t)res_var.inner & ~1;
968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
969 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
970 CHECK(!val->result_ok);
971 LDKDecodeError err_var = (*val->contents.err);
972 uint64_t err_ref = 0;
973 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
974 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
975 err_ref = (uint64_t)err_var.inner & ~1;
978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
979 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
982 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
983 CHECK(val->result_ok);
984 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
985 uint64_t res_ref = 0;
986 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
987 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
988 res_ref = (uint64_t)res_var.inner & ~1;
991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
992 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
993 CHECK(!val->result_ok);
994 LDKDecodeError err_var = (*val->contents.err);
995 uint64_t err_ref = 0;
996 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
997 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
998 err_ref = (uint64_t)err_var.inner & ~1;
1001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1002 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
1004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
1006 CHECK(val->result_ok);
1007 LDKTrustedClosingTransaction res_var = (*val->contents.result);
1008 uint64_t res_ref = 0;
1009 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1010 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1011 res_ref = (uint64_t)res_var.inner & ~1;
1014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1015 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
1016 CHECK(!val->result_ok);
1017 return *val->contents.err;
1019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1020 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1023 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1024 CHECK(val->result_ok);
1025 LDKCommitmentTransaction res_var = (*val->contents.result);
1026 uint64_t res_ref = 0;
1027 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1028 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1029 res_ref = (uint64_t)res_var.inner & ~1;
1032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1033 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1034 CHECK(!val->result_ok);
1035 LDKDecodeError err_var = (*val->contents.err);
1036 uint64_t err_ref = 0;
1037 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1038 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1039 err_ref = (uint64_t)err_var.inner & ~1;
1042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1046 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1047 CHECK(val->result_ok);
1048 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1049 uint64_t res_ref = 0;
1050 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 res_ref = (uint64_t)res_var.inner & ~1;
1055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1056 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1057 CHECK(!val->result_ok);
1058 return *val->contents.err;
1060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1061 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1063 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1064 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1065 CHECK(val->result_ok);
1066 LDKCVec_SignatureZ res_var = (*val->contents.result);
1067 jobjectArray res_arr = NULL;
1068 res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1070 for (size_t i = 0; i < res_var.datalen; i++) {
1071 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1072 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1073 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1079 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1080 CHECK(!val->result_ok);
1081 return *val->contents.err;
1083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1084 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1087 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1088 CHECK(val->result_ok);
1089 LDKShutdownScript res_var = (*val->contents.result);
1090 uint64_t res_ref = 0;
1091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1093 res_ref = (uint64_t)res_var.inner & ~1;
1096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1097 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1098 CHECK(!val->result_ok);
1099 LDKDecodeError err_var = (*val->contents.err);
1100 uint64_t err_ref = 0;
1101 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1102 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1103 err_ref = (uint64_t)err_var.inner & ~1;
1106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1107 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1110 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1111 CHECK(val->result_ok);
1112 LDKShutdownScript res_var = (*val->contents.result);
1113 uint64_t res_ref = 0;
1114 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1115 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1116 res_ref = (uint64_t)res_var.inner & ~1;
1119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1120 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1121 CHECK(!val->result_ok);
1122 LDKInvalidShutdownScript err_var = (*val->contents.err);
1123 uint64_t err_ref = 0;
1124 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1125 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1126 err_ref = (uint64_t)err_var.inner & ~1;
1129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1130 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1133 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1134 CHECK(val->result_ok);
1135 return *val->contents.result;
1137 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1138 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1139 CHECK(!val->result_ok);
1140 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1144 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1147 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1148 CHECK(val->result_ok);
1149 LDKRouteHop res_var = (*val->contents.result);
1150 uint64_t res_ref = 0;
1151 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1152 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1153 res_ref = (uint64_t)res_var.inner & ~1;
1156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1157 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1158 CHECK(!val->result_ok);
1159 LDKDecodeError err_var = (*val->contents.err);
1160 uint64_t err_ref = 0;
1161 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1162 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1163 err_ref = (uint64_t)err_var.inner & ~1;
1166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1167 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1168 ret->datalen = (*env)->GetArrayLength(env, elems);
1169 if (ret->datalen == 0) {
1172 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1173 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1174 for (size_t i = 0; i < ret->datalen; i++) {
1175 int64_t arr_elem = java_elems[i];
1176 LDKRouteHop arr_elem_conv;
1177 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1178 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1179 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1180 ret->data[i] = arr_elem_conv;
1182 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1184 return (uint64_t)ret;
1186 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1187 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1188 for (size_t i = 0; i < ret.datalen; i++) {
1189 ret.data[i] = RouteHop_clone(&orig->data[i]);
1193 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1194 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1195 for (size_t i = 0; i < ret.datalen; i++) {
1196 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1201 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1204 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1205 CHECK(val->result_ok);
1206 LDKRoute res_var = (*val->contents.result);
1207 uint64_t res_ref = 0;
1208 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1210 res_ref = (uint64_t)res_var.inner & ~1;
1213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1214 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1215 CHECK(!val->result_ok);
1216 LDKDecodeError err_var = (*val->contents.err);
1217 uint64_t err_ref = 0;
1218 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1219 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1220 err_ref = (uint64_t)err_var.inner & ~1;
1223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1224 return ((LDKCResult_RouteParametersDecodeErrorZ*)arg)->result_ok;
1226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1227 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
1228 CHECK(val->result_ok);
1229 LDKRouteParameters res_var = (*val->contents.result);
1230 uint64_t res_ref = 0;
1231 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1232 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1233 res_ref = (uint64_t)res_var.inner & ~1;
1236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1237 LDKCResult_RouteParametersDecodeErrorZ *val = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
1238 CHECK(!val->result_ok);
1239 LDKDecodeError err_var = (*val->contents.err);
1240 uint64_t err_ref = 0;
1241 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1242 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1243 err_ref = (uint64_t)err_var.inner & ~1;
1246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1247 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1248 ret->datalen = (*env)->GetArrayLength(env, elems);
1249 if (ret->datalen == 0) {
1252 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1253 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1254 for (size_t i = 0; i < ret->datalen; i++) {
1255 int64_t arr_elem = java_elems[i];
1256 LDKRouteHint arr_elem_conv;
1257 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1258 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1259 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1260 ret->data[i] = arr_elem_conv;
1262 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1264 return (uint64_t)ret;
1266 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1267 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1268 for (size_t i = 0; i < ret.datalen; i++) {
1269 ret.data[i] = RouteHint_clone(&orig->data[i]);
1273 static jclass LDKCOption_u64Z_Some_class = NULL;
1274 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1275 static jclass LDKCOption_u64Z_None_class = NULL;
1276 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1278 LDKCOption_u64Z_Some_class =
1279 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1280 CHECK(LDKCOption_u64Z_Some_class != NULL);
1281 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1282 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1283 LDKCOption_u64Z_None_class =
1284 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1285 CHECK(LDKCOption_u64Z_None_class != NULL);
1286 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1287 CHECK(LDKCOption_u64Z_None_meth != NULL);
1289 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1290 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1292 case LDKCOption_u64Z_Some: {
1293 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1295 case LDKCOption_u64Z_None: {
1296 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1302 return ((LDKCResult_PayeeDecodeErrorZ*)arg)->result_ok;
1304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1305 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
1306 CHECK(val->result_ok);
1307 LDKPayee res_var = (*val->contents.result);
1308 uint64_t res_ref = 0;
1309 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1310 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1311 res_ref = (uint64_t)res_var.inner & ~1;
1314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1315 LDKCResult_PayeeDecodeErrorZ *val = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
1316 CHECK(!val->result_ok);
1317 LDKDecodeError err_var = (*val->contents.err);
1318 uint64_t err_ref = 0;
1319 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1320 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1321 err_ref = (uint64_t)err_var.inner & ~1;
1324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1325 LDKCVec_RouteHintHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHintHopZ), "LDKCVec_RouteHintHopZ");
1326 ret->datalen = (*env)->GetArrayLength(env, elems);
1327 if (ret->datalen == 0) {
1330 ret->data = MALLOC(sizeof(LDKRouteHintHop) * ret->datalen, "LDKCVec_RouteHintHopZ Data");
1331 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1332 for (size_t i = 0; i < ret->datalen; i++) {
1333 int64_t arr_elem = java_elems[i];
1334 LDKRouteHintHop arr_elem_conv;
1335 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1336 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1337 arr_elem_conv = RouteHintHop_clone(&arr_elem_conv);
1338 ret->data[i] = arr_elem_conv;
1340 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1342 return (uint64_t)ret;
1344 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1345 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1346 for (size_t i = 0; i < ret.datalen; i++) {
1347 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1352 return ((LDKCResult_RouteHintDecodeErrorZ*)arg)->result_ok;
1354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1355 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
1356 CHECK(val->result_ok);
1357 LDKRouteHint res_var = (*val->contents.result);
1358 uint64_t res_ref = 0;
1359 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1360 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1361 res_ref = (uint64_t)res_var.inner & ~1;
1364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1365 LDKCResult_RouteHintDecodeErrorZ *val = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
1366 CHECK(!val->result_ok);
1367 LDKDecodeError err_var = (*val->contents.err);
1368 uint64_t err_ref = 0;
1369 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1370 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1371 err_ref = (uint64_t)err_var.inner & ~1;
1374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1375 return ((LDKCResult_RouteHintHopDecodeErrorZ*)arg)->result_ok;
1377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1378 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
1379 CHECK(val->result_ok);
1380 LDKRouteHintHop res_var = (*val->contents.result);
1381 uint64_t res_ref = 0;
1382 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1383 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1384 res_ref = (uint64_t)res_var.inner & ~1;
1387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1388 LDKCResult_RouteHintHopDecodeErrorZ *val = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
1389 CHECK(!val->result_ok);
1390 LDKDecodeError err_var = (*val->contents.err);
1391 uint64_t err_ref = 0;
1392 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1393 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1394 err_ref = (uint64_t)err_var.inner & ~1;
1397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1398 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1399 ret->datalen = (*env)->GetArrayLength(env, elems);
1400 if (ret->datalen == 0) {
1403 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1404 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1405 for (size_t i = 0; i < ret->datalen; i++) {
1406 int64_t arr_elem = java_elems[i];
1407 LDKChannelDetails arr_elem_conv;
1408 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1409 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1410 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1411 ret->data[i] = arr_elem_conv;
1413 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1415 return (uint64_t)ret;
1417 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1418 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1419 for (size_t i = 0; i < ret.datalen; i++) {
1420 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1425 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1428 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1429 CHECK(val->result_ok);
1430 LDKRoute res_var = (*val->contents.result);
1431 uint64_t res_ref = 0;
1432 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1433 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1434 res_ref = (uint64_t)res_var.inner & ~1;
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1438 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1439 CHECK(!val->result_ok);
1440 LDKLightningError err_var = (*val->contents.err);
1441 uint64_t err_ref = 0;
1442 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1443 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1444 err_ref = (uint64_t)err_var.inner & ~1;
1447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1448 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1451 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1452 CHECK(val->result_ok);
1453 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1454 return (uint64_t)res_ref;
1456 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1457 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1458 CHECK(!val->result_ok);
1459 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1462 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
1466 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1467 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1471 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
1475 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1476 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1477 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1478 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1479 Transaction_free(ret_var);
1483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1484 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1485 ret->datalen = (*env)->GetArrayLength(env, elems);
1486 if (ret->datalen == 0) {
1489 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1490 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1491 for (size_t i = 0; i < ret->datalen; i++) {
1492 int64_t arr_elem = java_elems[i];
1493 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1494 CHECK_ACCESS(arr_elem_ptr);
1495 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(arr_elem_ptr);
1496 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1497 ret->data[i] = arr_elem_conv;
1499 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1501 return (uint64_t)ret;
1503 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1504 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1505 for (size_t i = 0; i < ret.datalen; i++) {
1506 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1510 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1511 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1512 for (size_t i = 0; i < ret.datalen; i++) {
1513 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1518 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1521 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1522 CHECK(val->result_ok);
1523 return *val->contents.result;
1525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1526 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1527 CHECK(!val->result_ok);
1528 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1531 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1532 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1533 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1534 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1535 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1536 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1537 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1538 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1540 LDKMonitorEvent_HTLCEvent_class =
1541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1542 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1543 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1544 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1545 LDKMonitorEvent_CommitmentTxConfirmed_class =
1546 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1547 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1548 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1549 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1550 LDKMonitorEvent_UpdateCompleted_class =
1551 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted;"));
1552 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1553 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1554 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1555 LDKMonitorEvent_UpdateFailed_class =
1556 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed;"));
1557 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1558 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1559 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1561 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1562 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1564 case LDKMonitorEvent_HTLCEvent: {
1565 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1566 uint64_t htlc_event_ref = 0;
1567 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1568 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1569 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1570 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1572 case LDKMonitorEvent_CommitmentTxConfirmed: {
1573 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1574 uint64_t commitment_tx_confirmed_ref = 0;
1575 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1576 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1577 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1578 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1580 case LDKMonitorEvent_UpdateCompleted: {
1581 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1582 uint64_t funding_txo_ref = 0;
1583 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1584 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1585 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1586 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
1588 case LDKMonitorEvent_UpdateFailed: {
1589 LDKOutPoint update_failed_var = obj->update_failed;
1590 uint64_t update_failed_ref = 0;
1591 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1592 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1593 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1594 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
1599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1600 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1601 ret->datalen = (*env)->GetArrayLength(env, elems);
1602 if (ret->datalen == 0) {
1605 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1606 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1607 for (size_t i = 0; i < ret->datalen; i++) {
1608 int64_t arr_elem = java_elems[i];
1609 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1610 CHECK_ACCESS(arr_elem_ptr);
1611 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(arr_elem_ptr);
1612 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1613 ret->data[i] = arr_elem_conv;
1615 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1617 return (uint64_t)ret;
1619 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1620 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1621 for (size_t i = 0; i < ret.datalen; i++) {
1622 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1626 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1627 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1628 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1629 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1631 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1633 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1634 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1635 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1636 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1638 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1639 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1640 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1642 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1643 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1645 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1646 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1647 *some_conv = obj->some;
1648 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1649 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uint64_t)some_conv));
1651 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1652 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1657 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1658 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1659 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1660 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1661 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1662 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1664 LDKNetworkUpdate_ChannelUpdateMessage_class =
1665 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1666 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1667 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1668 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1669 LDKNetworkUpdate_ChannelClosed_class =
1670 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1671 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1672 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1673 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1674 LDKNetworkUpdate_NodeFailure_class =
1675 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1676 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1677 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1678 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1680 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1681 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1683 case LDKNetworkUpdate_ChannelUpdateMessage: {
1684 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1685 uint64_t msg_ref = 0;
1686 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1687 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1688 msg_ref = (uint64_t)msg_var.inner & ~1;
1689 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1691 case LDKNetworkUpdate_ChannelClosed: {
1692 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1694 case LDKNetworkUpdate_NodeFailure: {
1695 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1696 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1697 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1702 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1703 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1704 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1705 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1707 LDKCOption_NetworkUpdateZ_Some_class =
1708 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1709 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1710 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1711 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1712 LDKCOption_NetworkUpdateZ_None_class =
1713 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1714 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1715 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1716 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1718 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1719 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1721 case LDKCOption_NetworkUpdateZ_Some: {
1722 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1723 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1725 case LDKCOption_NetworkUpdateZ_None: {
1726 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1731 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1732 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1733 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1734 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1735 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1736 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1738 LDKSpendableOutputDescriptor_StaticOutput_class =
1739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1740 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1741 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1742 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1743 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1745 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1746 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1747 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1748 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1750 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1751 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1752 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1754 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1755 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1757 case LDKSpendableOutputDescriptor_StaticOutput: {
1758 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1759 uint64_t outpoint_ref = 0;
1760 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1761 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1762 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1763 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1764 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1766 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1767 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1768 uint64_t delayed_payment_output_ref = 0;
1769 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1770 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1771 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1772 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1774 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1775 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1776 uint64_t static_payment_output_ref = 0;
1777 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1778 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1779 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1780 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1786 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1787 ret->datalen = (*env)->GetArrayLength(env, elems);
1788 if (ret->datalen == 0) {
1791 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1792 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1793 for (size_t i = 0; i < ret->datalen; i++) {
1794 int64_t arr_elem = java_elems[i];
1795 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
1796 CHECK_ACCESS(arr_elem_ptr);
1797 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(arr_elem_ptr);
1798 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1799 ret->data[i] = arr_elem_conv;
1801 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1803 return (uint64_t)ret;
1805 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1806 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1807 for (size_t i = 0; i < ret.datalen; i++) {
1808 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1812 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1813 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1814 static jclass LDKErrorAction_IgnoreError_class = NULL;
1815 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1816 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1817 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1818 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1819 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1821 LDKErrorAction_DisconnectPeer_class =
1822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1823 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1824 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1825 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1826 LDKErrorAction_IgnoreError_class =
1827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1828 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1829 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1830 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1831 LDKErrorAction_IgnoreAndLog_class =
1832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1833 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1834 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1835 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1836 LDKErrorAction_SendErrorMessage_class =
1837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1838 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1839 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1840 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1842 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1843 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1845 case LDKErrorAction_DisconnectPeer: {
1846 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1847 uint64_t msg_ref = 0;
1848 if ((uint64_t)msg_var.inner > 4096) {
1849 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 msg_ref = (uint64_t)msg_var.inner & ~1;
1853 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1855 case LDKErrorAction_IgnoreError: {
1856 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1858 case LDKErrorAction_IgnoreAndLog: {
1859 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1860 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1862 case LDKErrorAction_SendErrorMessage: {
1863 LDKErrorMessage msg_var = obj->send_error_message.msg;
1864 uint64_t msg_ref = 0;
1865 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1866 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1867 msg_ref = (uint64_t)msg_var.inner & ~1;
1868 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1873 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1874 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1875 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1876 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1877 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1878 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1879 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1880 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1881 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1882 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1883 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1884 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1885 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1886 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1887 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1888 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1889 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1890 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1891 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1892 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1893 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1894 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1895 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1896 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1897 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1898 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1899 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1900 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1901 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1902 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1903 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1904 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1905 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1906 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1907 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1908 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1909 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1910 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1912 LDKMessageSendEvent_SendAcceptChannel_class =
1913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1914 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1915 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1916 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1917 LDKMessageSendEvent_SendOpenChannel_class =
1918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1919 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1920 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1921 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1922 LDKMessageSendEvent_SendFundingCreated_class =
1923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1924 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1925 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1926 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1927 LDKMessageSendEvent_SendFundingSigned_class =
1928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1929 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1930 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1931 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1932 LDKMessageSendEvent_SendFundingLocked_class =
1933 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1934 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1935 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1936 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1937 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1938 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1939 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1940 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1941 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1942 LDKMessageSendEvent_UpdateHTLCs_class =
1943 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1944 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1945 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1946 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1947 LDKMessageSendEvent_SendRevokeAndACK_class =
1948 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1949 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1950 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1951 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1952 LDKMessageSendEvent_SendClosingSigned_class =
1953 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1954 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1955 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1956 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1957 LDKMessageSendEvent_SendShutdown_class =
1958 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1959 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1960 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1961 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1962 LDKMessageSendEvent_SendChannelReestablish_class =
1963 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1964 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1965 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1966 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1967 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1968 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1969 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1970 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1971 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1972 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1973 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1974 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1975 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1976 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1977 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1979 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1980 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1981 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1982 LDKMessageSendEvent_SendChannelUpdate_class =
1983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1984 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1985 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1986 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1987 LDKMessageSendEvent_HandleError_class =
1988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1989 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1990 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1991 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1992 LDKMessageSendEvent_SendChannelRangeQuery_class =
1993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1994 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1995 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1996 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1997 LDKMessageSendEvent_SendShortIdsQuery_class =
1998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1999 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2000 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2001 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2002 LDKMessageSendEvent_SendReplyChannelRange_class =
2003 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
2004 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2005 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2006 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2008 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2009 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2011 case LDKMessageSendEvent_SendAcceptChannel: {
2012 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2013 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2014 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2015 uint64_t msg_ref = 0;
2016 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2017 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2018 msg_ref = (uint64_t)msg_var.inner & ~1;
2019 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2021 case LDKMessageSendEvent_SendOpenChannel: {
2022 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2023 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2024 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2025 uint64_t msg_ref = 0;
2026 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2027 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2028 msg_ref = (uint64_t)msg_var.inner & ~1;
2029 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2031 case LDKMessageSendEvent_SendFundingCreated: {
2032 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2033 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2034 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2035 uint64_t msg_ref = 0;
2036 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2037 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2038 msg_ref = (uint64_t)msg_var.inner & ~1;
2039 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2041 case LDKMessageSendEvent_SendFundingSigned: {
2042 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2043 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2044 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2045 uint64_t msg_ref = 0;
2046 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2047 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2048 msg_ref = (uint64_t)msg_var.inner & ~1;
2049 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2051 case LDKMessageSendEvent_SendFundingLocked: {
2052 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2053 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2054 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2055 uint64_t msg_ref = 0;
2056 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2057 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2058 msg_ref = (uint64_t)msg_var.inner & ~1;
2059 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2061 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2062 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2063 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2064 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2065 uint64_t msg_ref = 0;
2066 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2067 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2068 msg_ref = (uint64_t)msg_var.inner & ~1;
2069 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2071 case LDKMessageSendEvent_UpdateHTLCs: {
2072 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2073 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2074 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2075 uint64_t updates_ref = 0;
2076 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2077 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2078 updates_ref = (uint64_t)updates_var.inner & ~1;
2079 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2081 case LDKMessageSendEvent_SendRevokeAndACK: {
2082 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2083 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2084 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2085 uint64_t msg_ref = 0;
2086 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2088 msg_ref = (uint64_t)msg_var.inner & ~1;
2089 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2091 case LDKMessageSendEvent_SendClosingSigned: {
2092 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2093 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2094 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2095 uint64_t msg_ref = 0;
2096 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2097 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2098 msg_ref = (uint64_t)msg_var.inner & ~1;
2099 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2101 case LDKMessageSendEvent_SendShutdown: {
2102 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2103 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2104 LDKShutdown msg_var = obj->send_shutdown.msg;
2105 uint64_t msg_ref = 0;
2106 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2107 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2108 msg_ref = (uint64_t)msg_var.inner & ~1;
2109 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2111 case LDKMessageSendEvent_SendChannelReestablish: {
2112 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2113 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2114 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2115 uint64_t msg_ref = 0;
2116 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2117 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2118 msg_ref = (uint64_t)msg_var.inner & ~1;
2119 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2121 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2122 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2123 uint64_t msg_ref = 0;
2124 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2125 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2126 msg_ref = (uint64_t)msg_var.inner & ~1;
2127 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2128 uint64_t update_msg_ref = 0;
2129 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2130 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2131 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
2132 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2134 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2135 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2136 uint64_t msg_ref = 0;
2137 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2138 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2139 msg_ref = (uint64_t)msg_var.inner & ~1;
2140 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2142 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2143 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2144 uint64_t msg_ref = 0;
2145 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2146 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2147 msg_ref = (uint64_t)msg_var.inner & ~1;
2148 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2150 case LDKMessageSendEvent_SendChannelUpdate: {
2151 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2152 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2153 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2154 uint64_t msg_ref = 0;
2155 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2156 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2157 msg_ref = (uint64_t)msg_var.inner & ~1;
2158 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2160 case LDKMessageSendEvent_HandleError: {
2161 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2162 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2163 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
2164 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2166 case LDKMessageSendEvent_SendChannelRangeQuery: {
2167 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2168 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2169 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2170 uint64_t msg_ref = 0;
2171 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2172 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2173 msg_ref = (uint64_t)msg_var.inner & ~1;
2174 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2176 case LDKMessageSendEvent_SendShortIdsQuery: {
2177 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2178 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
2179 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2180 uint64_t msg_ref = 0;
2181 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2182 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2183 msg_ref = (uint64_t)msg_var.inner & ~1;
2184 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
2186 case LDKMessageSendEvent_SendReplyChannelRange: {
2187 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2188 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
2189 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2190 uint64_t msg_ref = 0;
2191 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2192 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2193 msg_ref = (uint64_t)msg_var.inner & ~1;
2194 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
2199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2200 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
2201 ret->datalen = (*env)->GetArrayLength(env, elems);
2202 if (ret->datalen == 0) {
2205 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
2206 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2207 for (size_t i = 0; i < ret->datalen; i++) {
2208 int64_t arr_elem = java_elems[i];
2209 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
2210 CHECK_ACCESS(arr_elem_ptr);
2211 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(arr_elem_ptr);
2212 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
2213 ret->data[i] = arr_elem_conv;
2215 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2217 return (uint64_t)ret;
2219 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2220 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2221 for (size_t i = 0; i < ret.datalen; i++) {
2222 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2227 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2230 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2231 CHECK(val->result_ok);
2232 LDKInitFeatures res_var = (*val->contents.result);
2233 uint64_t res_ref = 0;
2234 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2235 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2236 res_ref = (uint64_t)res_var.inner & ~1;
2239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2240 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2241 CHECK(!val->result_ok);
2242 LDKDecodeError err_var = (*val->contents.err);
2243 uint64_t err_ref = 0;
2244 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2245 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2246 err_ref = (uint64_t)err_var.inner & ~1;
2249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2250 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2253 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2254 CHECK(val->result_ok);
2255 LDKNodeFeatures res_var = (*val->contents.result);
2256 uint64_t res_ref = 0;
2257 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2258 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2259 res_ref = (uint64_t)res_var.inner & ~1;
2262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2263 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2264 CHECK(!val->result_ok);
2265 LDKDecodeError err_var = (*val->contents.err);
2266 uint64_t err_ref = 0;
2267 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2268 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2269 err_ref = (uint64_t)err_var.inner & ~1;
2272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2273 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2276 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2277 CHECK(val->result_ok);
2278 LDKChannelFeatures res_var = (*val->contents.result);
2279 uint64_t res_ref = 0;
2280 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2281 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2282 res_ref = (uint64_t)res_var.inner & ~1;
2285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2286 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2287 CHECK(!val->result_ok);
2288 LDKDecodeError err_var = (*val->contents.err);
2289 uint64_t err_ref = 0;
2290 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2291 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2292 err_ref = (uint64_t)err_var.inner & ~1;
2295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2296 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2299 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2300 CHECK(val->result_ok);
2301 LDKInvoiceFeatures res_var = (*val->contents.result);
2302 uint64_t res_ref = 0;
2303 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2304 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2305 res_ref = (uint64_t)res_var.inner & ~1;
2308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2309 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2310 CHECK(!val->result_ok);
2311 LDKDecodeError err_var = (*val->contents.err);
2312 uint64_t err_ref = 0;
2313 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2314 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2315 err_ref = (uint64_t)err_var.inner & ~1;
2318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2319 return ((LDKCResult_ScoringParametersDecodeErrorZ*)arg)->result_ok;
2321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2322 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
2323 CHECK(val->result_ok);
2324 LDKScoringParameters res_var = (*val->contents.result);
2325 uint64_t res_ref = 0;
2326 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2327 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2328 res_ref = (uint64_t)res_var.inner & ~1;
2331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2332 LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
2333 CHECK(!val->result_ok);
2334 LDKDecodeError err_var = (*val->contents.err);
2335 uint64_t err_ref = 0;
2336 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2337 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2338 err_ref = (uint64_t)err_var.inner & ~1;
2341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2342 return ((LDKCResult_ScorerDecodeErrorZ*)arg)->result_ok;
2344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2345 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
2346 CHECK(val->result_ok);
2347 LDKScorer res_var = (*val->contents.result);
2348 uint64_t res_ref = 0;
2349 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2350 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2351 res_ref = (uint64_t)res_var.inner & ~1;
2354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2355 LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1);
2356 CHECK(!val->result_ok);
2357 LDKDecodeError err_var = (*val->contents.err);
2358 uint64_t err_ref = 0;
2359 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2360 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2361 err_ref = (uint64_t)err_var.inner & ~1;
2364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2365 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2368 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2369 CHECK(val->result_ok);
2370 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2371 uint64_t res_ref = 0;
2372 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2373 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2374 res_ref = (uint64_t)res_var.inner & ~1;
2377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2378 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2379 CHECK(!val->result_ok);
2380 LDKDecodeError err_var = (*val->contents.err);
2381 uint64_t err_ref = 0;
2382 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2383 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2384 err_ref = (uint64_t)err_var.inner & ~1;
2387 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2388 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2391 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2392 CHECK(val->result_ok);
2393 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2394 uint64_t res_ref = 0;
2395 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2396 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2397 res_ref = (uint64_t)res_var.inner & ~1;
2400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2401 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2402 CHECK(!val->result_ok);
2403 LDKDecodeError err_var = (*val->contents.err);
2404 uint64_t err_ref = 0;
2405 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2406 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2407 err_ref = (uint64_t)err_var.inner & ~1;
2410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2411 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2414 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2415 CHECK(val->result_ok);
2416 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2420 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2421 CHECK(!val->result_ok);
2422 LDKDecodeError err_var = (*val->contents.err);
2423 uint64_t err_ref = 0;
2424 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2425 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2426 err_ref = (uint64_t)err_var.inner & ~1;
2429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2430 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2433 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2434 CHECK(val->result_ok);
2435 return *val->contents.result;
2437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2438 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2439 CHECK(!val->result_ok);
2440 return *val->contents.err;
2442 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
2446 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2447 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form);
2452 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2455 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
2456 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2457 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
2458 jobjectArray ret_arr = NULL;
2459 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2461 for (size_t i = 0; i < ret_var.datalen; i++) {
2462 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2463 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2464 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2472 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2475 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2476 CHECK(val->result_ok);
2477 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2478 *res_conv = (*val->contents.result);
2479 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
2480 return ((uint64_t)res_conv);
2482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2483 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2484 CHECK(!val->result_ok);
2485 return *val->contents.err;
2487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2488 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2491 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2492 CHECK(val->result_ok);
2493 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2494 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2498 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2499 CHECK(!val->result_ok);
2500 return *val->contents.err;
2502 typedef struct LDKBaseSign_JCalls {
2503 atomic_size_t refcnt;
2506 jmethodID get_per_commitment_point_meth;
2507 jmethodID release_commitment_secret_meth;
2508 jmethodID validate_holder_commitment_meth;
2509 jmethodID channel_keys_id_meth;
2510 jmethodID sign_counterparty_commitment_meth;
2511 jmethodID validate_counterparty_revocation_meth;
2512 jmethodID sign_holder_commitment_and_htlcs_meth;
2513 jmethodID sign_justice_revoked_output_meth;
2514 jmethodID sign_justice_revoked_htlc_meth;
2515 jmethodID sign_counterparty_htlc_transaction_meth;
2516 jmethodID sign_closing_transaction_meth;
2517 jmethodID sign_channel_announcement_meth;
2518 jmethodID ready_channel_meth;
2519 } LDKBaseSign_JCalls;
2520 static void LDKBaseSign_JCalls_free(void* this_arg) {
2521 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2522 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2524 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2525 if (get_jenv_res == JNI_EDETACHED) {
2526 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2528 DO_ASSERT(get_jenv_res == JNI_OK);
2530 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2531 if (get_jenv_res == JNI_EDETACHED) {
2532 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2537 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2538 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2540 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2541 if (get_jenv_res == JNI_EDETACHED) {
2542 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2544 DO_ASSERT(get_jenv_res == JNI_OK);
2546 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2548 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2549 if ((*env)->ExceptionCheck(env)) {
2550 (*env)->ExceptionDescribe(env);
2551 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2553 LDKPublicKey ret_ref;
2554 CHECK((*env)->GetArrayLength(env, ret) == 33);
2555 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2556 if (get_jenv_res == JNI_EDETACHED) {
2557 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2561 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2562 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2564 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2565 if (get_jenv_res == JNI_EDETACHED) {
2566 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2568 DO_ASSERT(get_jenv_res == JNI_OK);
2570 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2572 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2573 if ((*env)->ExceptionCheck(env)) {
2574 (*env)->ExceptionDescribe(env);
2575 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2577 LDKThirtyTwoBytes ret_ref;
2578 CHECK((*env)->GetArrayLength(env, ret) == 32);
2579 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2580 if (get_jenv_res == JNI_EDETACHED) {
2581 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2585 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2586 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2588 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2589 if (get_jenv_res == JNI_EDETACHED) {
2590 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2592 DO_ASSERT(get_jenv_res == JNI_OK);
2594 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2595 uint64_t holder_tx_ref = 0;
2596 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2597 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2598 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2599 holder_tx_ref = (uint64_t)holder_tx_var.inner;
2600 if (holder_tx_var.is_owned) {
2603 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2605 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2606 if ((*env)->ExceptionCheck(env)) {
2607 (*env)->ExceptionDescribe(env);
2608 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2610 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2611 CHECK_ACCESS(ret_ptr);
2612 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2613 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2614 if (get_jenv_res == JNI_EDETACHED) {
2615 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2619 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2620 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2623 if (get_jenv_res == JNI_EDETACHED) {
2624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2626 DO_ASSERT(get_jenv_res == JNI_OK);
2628 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2630 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2631 if ((*env)->ExceptionCheck(env)) {
2632 (*env)->ExceptionDescribe(env);
2633 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2635 LDKThirtyTwoBytes ret_ref;
2636 CHECK((*env)->GetArrayLength(env, ret) == 32);
2637 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2638 if (get_jenv_res == JNI_EDETACHED) {
2639 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2643 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2644 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2646 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2647 if (get_jenv_res == JNI_EDETACHED) {
2648 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2650 DO_ASSERT(get_jenv_res == JNI_OK);
2652 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2653 uint64_t commitment_tx_ref = 0;
2654 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2655 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2656 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2657 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2658 if (commitment_tx_var.is_owned) {
2659 commitment_tx_ref |= 1;
2661 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2663 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2664 if ((*env)->ExceptionCheck(env)) {
2665 (*env)->ExceptionDescribe(env);
2666 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2668 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2669 CHECK_ACCESS(ret_ptr);
2670 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2671 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2672 if (get_jenv_res == JNI_EDETACHED) {
2673 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2677 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2678 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2680 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2681 if (get_jenv_res == JNI_EDETACHED) {
2682 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2684 DO_ASSERT(get_jenv_res == JNI_OK);
2686 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2687 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2688 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2690 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2691 if ((*env)->ExceptionCheck(env)) {
2692 (*env)->ExceptionDescribe(env);
2693 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2695 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2696 CHECK_ACCESS(ret_ptr);
2697 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2698 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2699 if (get_jenv_res == JNI_EDETACHED) {
2700 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2704 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2705 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2707 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2708 if (get_jenv_res == JNI_EDETACHED) {
2709 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2711 DO_ASSERT(get_jenv_res == JNI_OK);
2713 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2714 uint64_t commitment_tx_ref = 0;
2715 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2716 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2717 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2718 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2719 if (commitment_tx_var.is_owned) {
2720 commitment_tx_ref |= 1;
2722 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2724 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2725 if ((*env)->ExceptionCheck(env)) {
2726 (*env)->ExceptionDescribe(env);
2727 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2729 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2730 CHECK_ACCESS(ret_ptr);
2731 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2732 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2733 if (get_jenv_res == JNI_EDETACHED) {
2734 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2738 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]) {
2739 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2741 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2742 if (get_jenv_res == JNI_EDETACHED) {
2743 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2745 DO_ASSERT(get_jenv_res == JNI_OK);
2747 LDKTransaction justice_tx_var = justice_tx;
2748 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2749 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2750 Transaction_free(justice_tx_var);
2751 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2752 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2753 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2755 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2756 if ((*env)->ExceptionCheck(env)) {
2757 (*env)->ExceptionDescribe(env);
2758 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2760 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2761 CHECK_ACCESS(ret_ptr);
2762 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2763 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2764 if (get_jenv_res == JNI_EDETACHED) {
2765 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2769 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) {
2770 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2772 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2773 if (get_jenv_res == JNI_EDETACHED) {
2774 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2776 DO_ASSERT(get_jenv_res == JNI_OK);
2778 LDKTransaction justice_tx_var = justice_tx;
2779 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2780 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2781 Transaction_free(justice_tx_var);
2782 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2783 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2784 LDKHTLCOutputInCommitment htlc_var = *htlc;
2785 uint64_t htlc_ref = 0;
2786 htlc_var = HTLCOutputInCommitment_clone(htlc);
2787 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2788 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2789 htlc_ref = (uint64_t)htlc_var.inner;
2790 if (htlc_var.is_owned) {
2793 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2795 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);
2796 if ((*env)->ExceptionCheck(env)) {
2797 (*env)->ExceptionDescribe(env);
2798 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2800 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2801 CHECK_ACCESS(ret_ptr);
2802 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2803 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2804 if (get_jenv_res == JNI_EDETACHED) {
2805 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2809 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) {
2810 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2812 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2813 if (get_jenv_res == JNI_EDETACHED) {
2814 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2816 DO_ASSERT(get_jenv_res == JNI_OK);
2818 LDKTransaction htlc_tx_var = htlc_tx;
2819 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2820 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2821 Transaction_free(htlc_tx_var);
2822 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2823 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2824 LDKHTLCOutputInCommitment htlc_var = *htlc;
2825 uint64_t htlc_ref = 0;
2826 htlc_var = HTLCOutputInCommitment_clone(htlc);
2827 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2828 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2829 htlc_ref = (uint64_t)htlc_var.inner;
2830 if (htlc_var.is_owned) {
2833 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2835 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);
2836 if ((*env)->ExceptionCheck(env)) {
2837 (*env)->ExceptionDescribe(env);
2838 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2840 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2841 CHECK_ACCESS(ret_ptr);
2842 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2843 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2844 if (get_jenv_res == JNI_EDETACHED) {
2845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2849 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2850 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2852 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2853 if (get_jenv_res == JNI_EDETACHED) {
2854 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2856 DO_ASSERT(get_jenv_res == JNI_OK);
2858 LDKClosingTransaction closing_tx_var = *closing_tx;
2859 uint64_t closing_tx_ref = 0;
2860 closing_tx_var = ClosingTransaction_clone(closing_tx);
2861 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2862 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2863 closing_tx_ref = (uint64_t)closing_tx_var.inner;
2864 if (closing_tx_var.is_owned) {
2865 closing_tx_ref |= 1;
2867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2869 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2870 if ((*env)->ExceptionCheck(env)) {
2871 (*env)->ExceptionDescribe(env);
2872 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2874 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2875 CHECK_ACCESS(ret_ptr);
2876 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2877 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2878 if (get_jenv_res == JNI_EDETACHED) {
2879 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2883 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2884 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2886 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2887 if (get_jenv_res == JNI_EDETACHED) {
2888 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2890 DO_ASSERT(get_jenv_res == JNI_OK);
2892 LDKUnsignedChannelAnnouncement msg_var = *msg;
2893 uint64_t msg_ref = 0;
2894 msg_var = UnsignedChannelAnnouncement_clone(msg);
2895 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2896 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2897 msg_ref = (uint64_t)msg_var.inner;
2898 if (msg_var.is_owned) {
2901 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2903 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2904 if ((*env)->ExceptionCheck(env)) {
2905 (*env)->ExceptionDescribe(env);
2906 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2908 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
2909 CHECK_ACCESS(ret_ptr);
2910 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2911 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2912 if (get_jenv_res == JNI_EDETACHED) {
2913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2917 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2918 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2921 if (get_jenv_res == JNI_EDETACHED) {
2922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2924 DO_ASSERT(get_jenv_res == JNI_OK);
2926 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2927 uint64_t channel_parameters_ref = 0;
2928 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2929 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2930 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2931 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2932 if (channel_parameters_var.is_owned) {
2933 channel_parameters_ref |= 1;
2935 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2937 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2938 if ((*env)->ExceptionCheck(env)) {
2939 (*env)->ExceptionDescribe(env);
2940 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2942 if (get_jenv_res == JNI_EDETACHED) {
2943 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2946 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2947 jclass c = (*env)->GetObjectClass(env, o);
2949 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2950 atomic_init(&calls->refcnt, 1);
2951 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2952 calls->o = (*env)->NewWeakGlobalRef(env, o);
2953 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2954 CHECK(calls->get_per_commitment_point_meth != NULL);
2955 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2956 CHECK(calls->release_commitment_secret_meth != NULL);
2957 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2958 CHECK(calls->validate_holder_commitment_meth != NULL);
2959 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2960 CHECK(calls->channel_keys_id_meth != NULL);
2961 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2962 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2963 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2964 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2965 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2966 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2967 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2968 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2969 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2970 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2971 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2972 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2973 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2974 CHECK(calls->sign_closing_transaction_meth != NULL);
2975 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2976 CHECK(calls->sign_channel_announcement_meth != NULL);
2977 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2978 CHECK(calls->ready_channel_meth != NULL);
2980 LDKChannelPublicKeys pubkeys_conv;
2981 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2982 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2983 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2986 .this_arg = (void*) calls,
2987 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2988 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2989 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2990 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2991 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2992 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2993 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2994 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2995 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2996 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2997 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2998 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2999 .ready_channel = ready_channel_LDKBaseSign_jcall,
3000 .free = LDKBaseSign_JCalls_free,
3001 .pubkeys = pubkeys_conv,
3002 .set_pubkeys = NULL,
3006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3007 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3008 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
3009 return (uint64_t)res_ptr;
3011 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) {
3012 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3013 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3014 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3015 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3016 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3021 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3022 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3023 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3024 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3029 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) {
3030 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3032 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3033 LDKHolderCommitmentTransaction holder_tx_conv;
3034 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3035 holder_tx_conv.is_owned = false;
3036 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3037 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
3038 return (uint64_t)ret_conv;
3041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3042 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3043 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3044 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3045 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3050 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) {
3051 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3052 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3053 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3054 LDKCommitmentTransaction commitment_tx_conv;
3055 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3056 commitment_tx_conv.is_owned = false;
3057 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3058 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3059 return (uint64_t)ret_conv;
3062 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) {
3063 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3064 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3065 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3066 unsigned char secret_arr[32];
3067 CHECK((*env)->GetArrayLength(env, secret) == 32);
3068 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3069 unsigned char (*secret_ref)[32] = &secret_arr;
3070 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3071 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3072 return (uint64_t)ret_conv;
3075 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) {
3076 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3077 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3078 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3079 LDKHolderCommitmentTransaction commitment_tx_conv;
3080 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3081 commitment_tx_conv.is_owned = false;
3082 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3083 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3084 return (uint64_t)ret_conv;
3087 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) {
3088 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3089 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3090 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3091 LDKTransaction justice_tx_ref;
3092 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3093 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3094 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3095 justice_tx_ref.data_is_owned = true;
3096 unsigned char per_commitment_key_arr[32];
3097 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3098 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3099 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3100 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3101 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3102 return (uint64_t)ret_conv;
3105 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) {
3106 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3107 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3108 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3109 LDKTransaction justice_tx_ref;
3110 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3111 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3112 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3113 justice_tx_ref.data_is_owned = true;
3114 unsigned char per_commitment_key_arr[32];
3115 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3116 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3117 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3118 LDKHTLCOutputInCommitment htlc_conv;
3119 htlc_conv.inner = (void*)(htlc & (~1));
3120 htlc_conv.is_owned = false;
3121 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3122 *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);
3123 return (uint64_t)ret_conv;
3126 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) {
3127 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3128 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3129 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3130 LDKTransaction htlc_tx_ref;
3131 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3132 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3133 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3134 htlc_tx_ref.data_is_owned = true;
3135 LDKPublicKey per_commitment_point_ref;
3136 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3137 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3138 LDKHTLCOutputInCommitment htlc_conv;
3139 htlc_conv.inner = (void*)(htlc & (~1));
3140 htlc_conv.is_owned = false;
3141 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3142 *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);
3143 return (uint64_t)ret_conv;
3146 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) {
3147 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3148 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3149 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3150 LDKClosingTransaction closing_tx_conv;
3151 closing_tx_conv.inner = (void*)(closing_tx & (~1));
3152 closing_tx_conv.is_owned = false;
3153 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3154 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3155 return (uint64_t)ret_conv;
3158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
3159 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3160 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3161 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3162 LDKUnsignedChannelAnnouncement msg_conv;
3163 msg_conv.inner = (void*)(msg & (~1));
3164 msg_conv.is_owned = false;
3165 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3166 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3167 return (uint64_t)ret_conv;
3170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
3171 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3172 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3173 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3174 LDKChannelTransactionParameters channel_parameters_conv;
3175 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
3176 channel_parameters_conv.is_owned = false;
3177 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
3180 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
3181 if (this_arg->set_pubkeys != NULL)
3182 this_arg->set_pubkeys(this_arg);
3183 return this_arg->pubkeys;
3185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
3186 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3187 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3188 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3189 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
3190 uint64_t ret_ref = 0;
3191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3193 ret_ref = (uint64_t)ret_var.inner;
3194 if (ret_var.is_owned) {
3200 typedef struct LDKSign_JCalls {
3201 atomic_size_t refcnt;
3204 LDKBaseSign_JCalls* BaseSign;
3205 jmethodID write_meth;
3207 static void LDKSign_JCalls_free(void* this_arg) {
3208 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3209 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3211 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3212 if (get_jenv_res == JNI_EDETACHED) {
3213 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3215 DO_ASSERT(get_jenv_res == JNI_OK);
3217 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3218 if (get_jenv_res == JNI_EDETACHED) {
3219 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3224 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
3225 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3227 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3228 if (get_jenv_res == JNI_EDETACHED) {
3229 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3231 DO_ASSERT(get_jenv_res == JNI_OK);
3233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3235 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3236 if ((*env)->ExceptionCheck(env)) {
3237 (*env)->ExceptionDescribe(env);
3238 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
3240 LDKCVec_u8Z ret_ref;
3241 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3242 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3243 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3244 if (get_jenv_res == JNI_EDETACHED) {
3245 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3249 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
3250 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
3251 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3252 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
3254 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
3255 jclass c = (*env)->GetObjectClass(env, o);
3257 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
3258 atomic_init(&calls->refcnt, 1);
3259 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3260 calls->o = (*env)->NewWeakGlobalRef(env, o);
3261 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3262 CHECK(calls->write_meth != NULL);
3264 LDKChannelPublicKeys pubkeys_conv;
3265 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3266 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3267 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
3270 .this_arg = (void*) calls,
3271 .write = write_LDKSign_jcall,
3272 .cloned = LDKSign_JCalls_cloned,
3273 .free = LDKSign_JCalls_free,
3274 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
3276 calls->BaseSign = ret.BaseSign.this_arg;
3279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
3280 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
3281 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
3282 return (uint64_t)res_ptr;
3284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
3285 LDKSign *inp = (LDKSign *)(arg & ~1);
3286 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
3287 DO_ASSERT((res_ptr & 1) == 0);
3288 return (int64_t)(res_ptr | 1);
3290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3291 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3292 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3293 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
3294 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3297 CVec_u8Z_free(ret_var);
3301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3302 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
3304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3305 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3306 CHECK(val->result_ok);
3307 LDKSign* res_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3308 *res_ret = Sign_clone(&(*val->contents.result));
3309 return (uint64_t)res_ret;
3311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3312 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3313 CHECK(!val->result_ok);
3314 LDKDecodeError err_var = (*val->contents.err);
3315 uint64_t err_ref = 0;
3316 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3317 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3318 err_ref = (uint64_t)err_var.inner & ~1;
3321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3322 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
3324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3325 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3326 CHECK(val->result_ok);
3327 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3328 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3332 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3333 CHECK(!val->result_ok);
3334 return *val->contents.err;
3336 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3337 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3338 for (size_t i = 0; i < ret.datalen; i++) {
3339 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3344 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3346 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3347 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3348 CHECK(val->result_ok);
3349 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3350 jobjectArray res_arr = NULL;
3351 res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3353 for (size_t i = 0; i < res_var.datalen; i++) {
3354 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3355 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3356 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3357 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3363 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3364 CHECK(!val->result_ok);
3365 return *val->contents.err;
3367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3368 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3371 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3372 CHECK(val->result_ok);
3373 LDKInMemorySigner res_var = (*val->contents.result);
3374 uint64_t res_ref = 0;
3375 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3376 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3377 res_ref = (uint64_t)res_var.inner & ~1;
3380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3381 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3382 CHECK(!val->result_ok);
3383 LDKDecodeError err_var = (*val->contents.err);
3384 uint64_t err_ref = 0;
3385 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3386 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3387 err_ref = (uint64_t)err_var.inner & ~1;
3390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3391 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3392 ret->datalen = (*env)->GetArrayLength(env, elems);
3393 if (ret->datalen == 0) {
3396 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3397 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3398 for (size_t i = 0; i < ret->datalen; i++) {
3399 int64_t arr_elem = java_elems[i];
3400 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3401 CHECK_ACCESS(arr_elem_ptr);
3402 LDKTxOut arr_elem_conv = *(LDKTxOut*)(arr_elem_ptr);
3403 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3404 ret->data[i] = arr_elem_conv;
3406 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3408 return (uint64_t)ret;
3410 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3411 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3412 for (size_t i = 0; i < ret.datalen; i++) {
3413 ret.data[i] = TxOut_clone(&orig->data[i]);
3417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3418 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3421 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3422 CHECK(val->result_ok);
3423 LDKTransaction res_var = (*val->contents.result);
3424 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3425 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3429 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3430 CHECK(!val->result_ok);
3431 return *val->contents.err;
3433 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3434 return ThirtyTwoBytes_clone(&tuple->a);
3436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3437 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3438 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3439 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data);
3443 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3444 return ChannelMonitor_clone(&tuple->b);
3446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3447 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3448 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
3449 uint64_t ret_ref = 0;
3450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3452 ret_ref = (uint64_t)ret_var.inner;
3453 if (ret_var.is_owned) {
3459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3460 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3461 ret->datalen = (*env)->GetArrayLength(env, elems);
3462 if (ret->datalen == 0) {
3465 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3466 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3467 for (size_t i = 0; i < ret->datalen; i++) {
3468 int64_t arr_elem = java_elems[i];
3469 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3470 CHECK_ACCESS(arr_elem_ptr);
3471 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(arr_elem_ptr);
3472 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
3473 ret->data[i] = arr_elem_conv;
3475 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3477 return (uint64_t)ret;
3479 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
3480 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
3481 for (size_t i = 0; i < ret.datalen; i++) {
3482 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
3486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3487 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3489 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3490 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3491 CHECK(val->result_ok);
3492 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3493 int64_tArray res_arr = NULL;
3494 res_arr = (*env)->NewLongArray(env, res_var.datalen);
3495 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3496 for (size_t j = 0; j < res_var.datalen; j++) {
3497 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3498 *res_conv_35_conv = res_var.data[j];
3499 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
3500 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
3502 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3506 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3507 CHECK(!val->result_ok);
3508 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3511 static jclass LDKCOption_u16Z_Some_class = NULL;
3512 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3513 static jclass LDKCOption_u16Z_None_class = NULL;
3514 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3516 LDKCOption_u16Z_Some_class =
3517 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3518 CHECK(LDKCOption_u16Z_Some_class != NULL);
3519 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3520 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3521 LDKCOption_u16Z_None_class =
3522 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3523 CHECK(LDKCOption_u16Z_None_class != NULL);
3524 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3525 CHECK(LDKCOption_u16Z_None_meth != NULL);
3527 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3528 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3530 case LDKCOption_u16Z_Some: {
3531 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3533 case LDKCOption_u16Z_None: {
3534 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3539 static jclass LDKAPIError_APIMisuseError_class = NULL;
3540 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3541 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3542 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3543 static jclass LDKAPIError_RouteError_class = NULL;
3544 static jmethodID LDKAPIError_RouteError_meth = NULL;
3545 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3546 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3547 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3548 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3549 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3550 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3552 LDKAPIError_APIMisuseError_class =
3553 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3554 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3555 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3556 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3557 LDKAPIError_FeeRateTooHigh_class =
3558 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3559 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3560 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3561 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3562 LDKAPIError_RouteError_class =
3563 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3564 CHECK(LDKAPIError_RouteError_class != NULL);
3565 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3566 CHECK(LDKAPIError_RouteError_meth != NULL);
3567 LDKAPIError_ChannelUnavailable_class =
3568 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3569 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3570 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3571 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3572 LDKAPIError_MonitorUpdateFailed_class =
3573 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3574 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3575 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3576 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3577 LDKAPIError_IncompatibleShutdownScript_class =
3578 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3579 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3580 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3581 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3583 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3584 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3586 case LDKAPIError_APIMisuseError: {
3587 LDKStr err_str = obj->api_misuse_error.err;
3588 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3589 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3591 case LDKAPIError_FeeRateTooHigh: {
3592 LDKStr err_str = obj->fee_rate_too_high.err;
3593 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3594 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3596 case LDKAPIError_RouteError: {
3597 LDKStr err_str = obj->route_error.err;
3598 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3599 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3601 case LDKAPIError_ChannelUnavailable: {
3602 LDKStr err_str = obj->channel_unavailable.err;
3603 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3604 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3606 case LDKAPIError_MonitorUpdateFailed: {
3607 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3609 case LDKAPIError_IncompatibleShutdownScript: {
3610 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3611 uint64_t script_ref = 0;
3612 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3613 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3614 script_ref = (uint64_t)script_var.inner & ~1;
3615 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3621 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3624 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3625 CHECK(val->result_ok);
3626 return *val->contents.result;
3628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3629 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3630 CHECK(!val->result_ok);
3631 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3635 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3636 ret->datalen = (*env)->GetArrayLength(env, elems);
3637 if (ret->datalen == 0) {
3640 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3641 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3642 for (size_t i = 0; i < ret->datalen; i++) {
3643 int64_t arr_elem = java_elems[i];
3644 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3645 CHECK_ACCESS(arr_elem_ptr);
3646 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(arr_elem_ptr);
3647 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3648 ret->data[i] = arr_elem_conv;
3650 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3652 return (uint64_t)ret;
3654 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3655 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3656 for (size_t i = 0; i < ret.datalen; i++) {
3657 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3662 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3663 ret->datalen = (*env)->GetArrayLength(env, elems);
3664 if (ret->datalen == 0) {
3667 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3668 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3669 for (size_t i = 0; i < ret->datalen; i++) {
3670 int64_t arr_elem = java_elems[i];
3671 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3672 CHECK_ACCESS(arr_elem_ptr);
3673 LDKAPIError arr_elem_conv = *(LDKAPIError*)(arr_elem_ptr);
3674 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3675 ret->data[i] = arr_elem_conv;
3677 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3679 return (uint64_t)ret;
3681 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3682 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3683 for (size_t i = 0; i < ret.datalen; i++) {
3684 ret.data[i] = APIError_clone(&orig->data[i]);
3688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3689 return ((LDKCResult__u832APIErrorZ*)arg)->result_ok;
3691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3692 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3693 CHECK(val->result_ok);
3694 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3695 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3699 LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1);
3700 CHECK(!val->result_ok);
3701 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3704 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3705 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3706 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3707 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3708 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3709 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3710 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3711 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3713 LDKPaymentSendFailure_ParameterError_class =
3714 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3715 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3716 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3717 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3718 LDKPaymentSendFailure_PathParameterError_class =
3719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3720 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3721 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3722 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3723 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3724 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3725 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3726 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3727 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3728 LDKPaymentSendFailure_PartialFailure_class =
3729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3730 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3731 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
3732 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3734 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3735 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3737 case LDKPaymentSendFailure_ParameterError: {
3738 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3739 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3741 case LDKPaymentSendFailure_PathParameterError: {
3742 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3743 int64_tArray path_parameter_error_arr = NULL;
3744 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3745 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3746 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3747 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3748 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3749 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3750 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3752 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3753 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3755 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3756 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3757 int64_tArray all_failed_retry_safe_arr = NULL;
3758 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3759 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3760 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3761 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3762 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3764 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3765 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3767 case LDKPaymentSendFailure_PartialFailure: {
3768 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
3769 int64_tArray results_arr = NULL;
3770 results_arr = (*env)->NewLongArray(env, results_var.datalen);
3771 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
3772 for (size_t w = 0; w < results_var.datalen; w++) {
3773 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3774 *results_conv_22_conv = results_var.data[w];
3775 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
3776 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
3778 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
3779 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
3780 uint64_t failed_paths_retry_ref = 0;
3781 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
3782 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3783 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3784 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
3786 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3787 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
3788 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
3793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3794 return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok;
3796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3797 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3798 CHECK(val->result_ok);
3799 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3800 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3804 LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
3805 CHECK(!val->result_ok);
3806 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3810 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3813 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3814 CHECK(val->result_ok);
3815 return *val->contents.result;
3817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3818 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3819 CHECK(!val->result_ok);
3820 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3823 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3824 return ThirtyTwoBytes_clone(&tuple->a);
3826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3827 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data);
3833 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){
3834 return ThirtyTwoBytes_clone(&tuple->b);
3836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3837 LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1);
3838 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3839 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv).data);
3843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3844 return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok;
3846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3847 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3848 CHECK(val->result_ok);
3849 LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3850 *res_conv = (*val->contents.result);
3851 *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv);
3852 return ((uint64_t)res_conv);
3854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3855 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
3856 CHECK(!val->result_ok);
3857 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3860 static jclass LDKNetAddress_IPv4_class = NULL;
3861 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3862 static jclass LDKNetAddress_IPv6_class = NULL;
3863 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3864 static jclass LDKNetAddress_OnionV2_class = NULL;
3865 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3866 static jclass LDKNetAddress_OnionV3_class = NULL;
3867 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3869 LDKNetAddress_IPv4_class =
3870 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3871 CHECK(LDKNetAddress_IPv4_class != NULL);
3872 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3873 CHECK(LDKNetAddress_IPv4_meth != NULL);
3874 LDKNetAddress_IPv6_class =
3875 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3876 CHECK(LDKNetAddress_IPv6_class != NULL);
3877 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3878 CHECK(LDKNetAddress_IPv6_meth != NULL);
3879 LDKNetAddress_OnionV2_class =
3880 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3881 CHECK(LDKNetAddress_OnionV2_class != NULL);
3882 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3883 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3884 LDKNetAddress_OnionV3_class =
3885 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3886 CHECK(LDKNetAddress_OnionV3_class != NULL);
3887 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3888 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3890 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3891 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3893 case LDKNetAddress_IPv4: {
3894 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3895 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3896 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3898 case LDKNetAddress_IPv6: {
3899 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3900 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3901 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3903 case LDKNetAddress_OnionV2: {
3904 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3905 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3906 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3908 case LDKNetAddress_OnionV3: {
3909 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3910 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3911 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);
3916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3917 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3918 ret->datalen = (*env)->GetArrayLength(env, elems);
3919 if (ret->datalen == 0) {
3922 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3923 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3924 for (size_t i = 0; i < ret->datalen; i++) {
3925 int64_t arr_elem = java_elems[i];
3926 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
3927 CHECK_ACCESS(arr_elem_ptr);
3928 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(arr_elem_ptr);
3929 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3930 ret->data[i] = arr_elem_conv;
3932 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3934 return (uint64_t)ret;
3936 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3937 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3938 for (size_t i = 0; i < ret.datalen; i++) {
3939 ret.data[i] = NetAddress_clone(&orig->data[i]);
3943 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3944 return ThirtyTwoBytes_clone(&tuple->a);
3946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3947 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3948 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3949 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data);
3953 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3954 return ThirtyTwoBytes_clone(&tuple->b);
3956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3957 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3958 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data);
3963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3964 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3967 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3968 CHECK(val->result_ok);
3969 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3970 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3974 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3975 CHECK(!val->result_ok);
3976 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3980 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3981 ret->datalen = (*env)->GetArrayLength(env, elems);
3982 if (ret->datalen == 0) {
3985 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3986 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3987 for (size_t i = 0; i < ret->datalen; i++) {
3988 int64_t arr_elem = java_elems[i];
3989 LDKChannelMonitor arr_elem_conv;
3990 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3991 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3992 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3993 ret->data[i] = arr_elem_conv;
3995 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3997 return (uint64_t)ret;
3999 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4000 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4001 for (size_t i = 0; i < ret.datalen; i++) {
4002 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4006 typedef struct LDKWatch_JCalls {
4007 atomic_size_t refcnt;
4010 jmethodID watch_channel_meth;
4011 jmethodID update_channel_meth;
4012 jmethodID release_pending_monitor_events_meth;
4014 static void LDKWatch_JCalls_free(void* this_arg) {
4015 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4016 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4018 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4019 if (get_jenv_res == JNI_EDETACHED) {
4020 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4022 DO_ASSERT(get_jenv_res == JNI_OK);
4024 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4025 if (get_jenv_res == JNI_EDETACHED) {
4026 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4031 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4032 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4034 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4035 if (get_jenv_res == JNI_EDETACHED) {
4036 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4038 DO_ASSERT(get_jenv_res == JNI_OK);
4040 LDKOutPoint funding_txo_var = funding_txo;
4041 uint64_t funding_txo_ref = 0;
4042 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4043 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4044 funding_txo_ref = (uint64_t)funding_txo_var.inner;
4045 if (funding_txo_var.is_owned) {
4046 funding_txo_ref |= 1;
4048 LDKChannelMonitor monitor_var = monitor;
4049 uint64_t monitor_ref = 0;
4050 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4051 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4052 monitor_ref = (uint64_t)monitor_var.inner;
4053 if (monitor_var.is_owned) {
4056 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4058 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
4059 if ((*env)->ExceptionCheck(env)) {
4060 (*env)->ExceptionDescribe(env);
4061 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
4063 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4064 CHECK_ACCESS(ret_ptr);
4065 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4066 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4067 if (get_jenv_res == JNI_EDETACHED) {
4068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4072 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4073 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4075 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4076 if (get_jenv_res == JNI_EDETACHED) {
4077 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4079 DO_ASSERT(get_jenv_res == JNI_OK);
4081 LDKOutPoint funding_txo_var = funding_txo;
4082 uint64_t funding_txo_ref = 0;
4083 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4084 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4085 funding_txo_ref = (uint64_t)funding_txo_var.inner;
4086 if (funding_txo_var.is_owned) {
4087 funding_txo_ref |= 1;
4089 LDKChannelMonitorUpdate update_var = update;
4090 uint64_t update_ref = 0;
4091 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4092 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4093 update_ref = (uint64_t)update_var.inner;
4094 if (update_var.is_owned) {
4097 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4099 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
4100 if ((*env)->ExceptionCheck(env)) {
4101 (*env)->ExceptionDescribe(env);
4102 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
4104 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4105 CHECK_ACCESS(ret_ptr);
4106 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4107 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
4108 if (get_jenv_res == JNI_EDETACHED) {
4109 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4113 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4114 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4116 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4117 if (get_jenv_res == JNI_EDETACHED) {
4118 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4120 DO_ASSERT(get_jenv_res == JNI_OK);
4122 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4124 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
4125 if ((*env)->ExceptionCheck(env)) {
4126 (*env)->ExceptionDescribe(env);
4127 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
4129 LDKCVec_MonitorEventZ ret_constr;
4130 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
4131 if (ret_constr.datalen > 0)
4132 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4134 ret_constr.data = NULL;
4135 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
4136 for (size_t o = 0; o < ret_constr.datalen; o++) {
4137 int64_t ret_conv_14 = ret_vals[o];
4138 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
4139 CHECK_ACCESS(ret_conv_14_ptr);
4140 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
4141 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
4142 ret_constr.data[o] = ret_conv_14_conv;
4144 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
4145 if (get_jenv_res == JNI_EDETACHED) {
4146 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4150 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4151 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4152 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4154 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
4155 jclass c = (*env)->GetObjectClass(env, o);
4157 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4158 atomic_init(&calls->refcnt, 1);
4159 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4160 calls->o = (*env)->NewWeakGlobalRef(env, o);
4161 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
4162 CHECK(calls->watch_channel_meth != NULL);
4163 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
4164 CHECK(calls->update_channel_meth != NULL);
4165 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
4166 CHECK(calls->release_pending_monitor_events_meth != NULL);
4169 .this_arg = (void*) calls,
4170 .watch_channel = watch_channel_LDKWatch_jcall,
4171 .update_channel = update_channel_LDKWatch_jcall,
4172 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4173 .free = LDKWatch_JCalls_free,
4177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
4178 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4179 *res_ptr = LDKWatch_init(env, clz, o);
4180 return (uint64_t)res_ptr;
4182 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) {
4183 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4184 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4185 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4186 LDKOutPoint funding_txo_conv;
4187 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4188 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4189 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4190 LDKChannelMonitor monitor_conv;
4191 monitor_conv.inner = (void*)(monitor & (~1));
4192 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
4193 monitor_conv = ChannelMonitor_clone(&monitor_conv);
4194 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4195 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4196 return (uint64_t)ret_conv;
4199 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) {
4200 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4201 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4202 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4203 LDKOutPoint funding_txo_conv;
4204 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4205 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4206 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4207 LDKChannelMonitorUpdate update_conv;
4208 update_conv.inner = (void*)(update & (~1));
4209 update_conv.is_owned = (update & 1) || (update == 0);
4210 update_conv = ChannelMonitorUpdate_clone(&update_conv);
4211 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4212 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4213 return (uint64_t)ret_conv;
4216 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
4217 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4218 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4219 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4220 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4221 int64_tArray ret_arr = NULL;
4222 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4223 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4224 for (size_t o = 0; o < ret_var.datalen; o++) {
4225 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4226 *ret_conv_14_copy = ret_var.data[o];
4227 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
4228 ret_arr_ptr[o] = ret_conv_14_ref;
4230 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4235 typedef struct LDKBroadcasterInterface_JCalls {
4236 atomic_size_t refcnt;
4239 jmethodID broadcast_transaction_meth;
4240 } LDKBroadcasterInterface_JCalls;
4241 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4242 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4243 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4245 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4246 if (get_jenv_res == JNI_EDETACHED) {
4247 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4249 DO_ASSERT(get_jenv_res == JNI_OK);
4251 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4252 if (get_jenv_res == JNI_EDETACHED) {
4253 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4258 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4259 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4261 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4262 if (get_jenv_res == JNI_EDETACHED) {
4263 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4265 DO_ASSERT(get_jenv_res == JNI_OK);
4267 LDKTransaction tx_var = tx;
4268 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
4269 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
4270 Transaction_free(tx_var);
4271 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4273 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
4274 if ((*env)->ExceptionCheck(env)) {
4275 (*env)->ExceptionDescribe(env);
4276 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
4278 if (get_jenv_res == JNI_EDETACHED) {
4279 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4282 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4283 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4284 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4286 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
4287 jclass c = (*env)->GetObjectClass(env, o);
4289 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4290 atomic_init(&calls->refcnt, 1);
4291 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4292 calls->o = (*env)->NewWeakGlobalRef(env, o);
4293 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
4294 CHECK(calls->broadcast_transaction_meth != NULL);
4296 LDKBroadcasterInterface ret = {
4297 .this_arg = (void*) calls,
4298 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4299 .free = LDKBroadcasterInterface_JCalls_free,
4303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4304 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4305 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
4306 return (uint64_t)res_ptr;
4308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
4309 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4310 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4311 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4312 LDKTransaction tx_ref;
4313 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
4314 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4315 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
4316 tx_ref.data_is_owned = true;
4317 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4320 typedef struct LDKKeysInterface_JCalls {
4321 atomic_size_t refcnt;
4324 jmethodID get_node_secret_meth;
4325 jmethodID get_destination_script_meth;
4326 jmethodID get_shutdown_scriptpubkey_meth;
4327 jmethodID get_channel_signer_meth;
4328 jmethodID get_secure_random_bytes_meth;
4329 jmethodID read_chan_signer_meth;
4330 jmethodID sign_invoice_meth;
4331 } LDKKeysInterface_JCalls;
4332 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4333 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4334 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4336 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4337 if (get_jenv_res == JNI_EDETACHED) {
4338 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4340 DO_ASSERT(get_jenv_res == JNI_OK);
4342 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4343 if (get_jenv_res == JNI_EDETACHED) {
4344 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4349 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
4350 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4353 if (get_jenv_res == JNI_EDETACHED) {
4354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4356 DO_ASSERT(get_jenv_res == JNI_OK);
4358 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4360 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
4361 if ((*env)->ExceptionCheck(env)) {
4362 (*env)->ExceptionDescribe(env);
4363 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
4365 LDKSecretKey ret_ref;
4366 CHECK((*env)->GetArrayLength(env, ret) == 32);
4367 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
4368 if (get_jenv_res == JNI_EDETACHED) {
4369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4373 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4374 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4376 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4377 if (get_jenv_res == JNI_EDETACHED) {
4378 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4380 DO_ASSERT(get_jenv_res == JNI_OK);
4382 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4384 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
4385 if ((*env)->ExceptionCheck(env)) {
4386 (*env)->ExceptionDescribe(env);
4387 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
4389 LDKCVec_u8Z ret_ref;
4390 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4391 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4392 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4393 if (get_jenv_res == JNI_EDETACHED) {
4394 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4398 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4399 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4402 if (get_jenv_res == JNI_EDETACHED) {
4403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4405 DO_ASSERT(get_jenv_res == JNI_OK);
4407 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4409 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
4410 if ((*env)->ExceptionCheck(env)) {
4411 (*env)->ExceptionDescribe(env);
4412 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
4414 LDKShutdownScript ret_conv;
4415 ret_conv.inner = (void*)(ret & (~1));
4416 ret_conv.is_owned = (ret & 1) || (ret == 0);
4417 ret_conv = ShutdownScript_clone(&ret_conv);
4418 if (get_jenv_res == JNI_EDETACHED) {
4419 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4423 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4424 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4426 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4427 if (get_jenv_res == JNI_EDETACHED) {
4428 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4430 DO_ASSERT(get_jenv_res == JNI_OK);
4432 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4434 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4435 if ((*env)->ExceptionCheck(env)) {
4436 (*env)->ExceptionDescribe(env);
4437 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4439 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4440 CHECK_ACCESS(ret_ptr);
4441 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4442 ret_conv = Sign_clone(&ret_conv);
4443 if (get_jenv_res == JNI_EDETACHED) {
4444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4448 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4449 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4451 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4452 if (get_jenv_res == JNI_EDETACHED) {
4453 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4455 DO_ASSERT(get_jenv_res == JNI_OK);
4457 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4459 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4460 if ((*env)->ExceptionCheck(env)) {
4461 (*env)->ExceptionDescribe(env);
4462 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4464 LDKThirtyTwoBytes ret_ref;
4465 CHECK((*env)->GetArrayLength(env, ret) == 32);
4466 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4467 if (get_jenv_res == JNI_EDETACHED) {
4468 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4472 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4473 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4475 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4476 if (get_jenv_res == JNI_EDETACHED) {
4477 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4479 DO_ASSERT(get_jenv_res == JNI_OK);
4481 LDKu8slice reader_var = reader;
4482 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4483 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4484 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4486 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4487 if ((*env)->ExceptionCheck(env)) {
4488 (*env)->ExceptionDescribe(env);
4489 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4491 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4492 CHECK_ACCESS(ret_ptr);
4493 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4494 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4495 if (get_jenv_res == JNI_EDETACHED) {
4496 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4500 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4501 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4503 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4504 if (get_jenv_res == JNI_EDETACHED) {
4505 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4507 DO_ASSERT(get_jenv_res == JNI_OK);
4509 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4510 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4511 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4512 CVec_u8Z_free(invoice_preimage_var);
4513 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4515 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4516 if ((*env)->ExceptionCheck(env)) {
4517 (*env)->ExceptionDescribe(env);
4518 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4520 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
4521 CHECK_ACCESS(ret_ptr);
4522 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
4523 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4524 if (get_jenv_res == JNI_EDETACHED) {
4525 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4529 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4530 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4531 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4533 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4534 jclass c = (*env)->GetObjectClass(env, o);
4536 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4537 atomic_init(&calls->refcnt, 1);
4538 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4539 calls->o = (*env)->NewWeakGlobalRef(env, o);
4540 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4541 CHECK(calls->get_node_secret_meth != NULL);
4542 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4543 CHECK(calls->get_destination_script_meth != NULL);
4544 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4545 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4546 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4547 CHECK(calls->get_channel_signer_meth != NULL);
4548 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4549 CHECK(calls->get_secure_random_bytes_meth != NULL);
4550 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4551 CHECK(calls->read_chan_signer_meth != NULL);
4552 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4553 CHECK(calls->sign_invoice_meth != NULL);
4555 LDKKeysInterface ret = {
4556 .this_arg = (void*) calls,
4557 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4558 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4559 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4560 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4561 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4562 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4563 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4564 .free = LDKKeysInterface_JCalls_free,
4568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4569 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4570 *res_ptr = LDKKeysInterface_init(env, clz, o);
4571 return (uint64_t)res_ptr;
4573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4574 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4575 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4576 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4577 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4583 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4584 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4585 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4586 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4589 CVec_u8Z_free(ret_var);
4593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4594 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4595 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4596 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4597 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4598 uint64_t ret_ref = 0;
4599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4601 ret_ref = (uint64_t)ret_var.inner;
4602 if (ret_var.is_owned) {
4608 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) {
4609 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4610 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4611 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4612 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4613 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4614 return (uint64_t)ret_ret;
4617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4618 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4619 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4620 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4621 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4622 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4627 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4628 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4629 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4630 LDKu8slice reader_ref;
4631 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4632 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4633 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4634 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4635 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4636 return (uint64_t)ret_conv;
4639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4640 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4641 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4642 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4643 LDKCVec_u8Z invoice_preimage_ref;
4644 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4645 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4646 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4647 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4648 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4649 return (uint64_t)ret_conv;
4652 typedef struct LDKFeeEstimator_JCalls {
4653 atomic_size_t refcnt;
4656 jmethodID get_est_sat_per_1000_weight_meth;
4657 } LDKFeeEstimator_JCalls;
4658 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4659 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4660 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4662 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4663 if (get_jenv_res == JNI_EDETACHED) {
4664 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4666 DO_ASSERT(get_jenv_res == JNI_OK);
4668 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4669 if (get_jenv_res == JNI_EDETACHED) {
4670 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4675 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4676 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_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 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4685 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4687 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4688 if ((*env)->ExceptionCheck(env)) {
4689 (*env)->ExceptionDescribe(env);
4690 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4692 if (get_jenv_res == JNI_EDETACHED) {
4693 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4697 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4698 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4699 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4701 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4702 jclass c = (*env)->GetObjectClass(env, o);
4704 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4705 atomic_init(&calls->refcnt, 1);
4706 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4707 calls->o = (*env)->NewWeakGlobalRef(env, o);
4708 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4709 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4711 LDKFeeEstimator ret = {
4712 .this_arg = (void*) calls,
4713 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4714 .free = LDKFeeEstimator_JCalls_free,
4718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4719 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4720 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4721 return (uint64_t)res_ptr;
4723 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) {
4724 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
4725 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4726 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
4727 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4728 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4732 typedef struct LDKLogger_JCalls {
4733 atomic_size_t refcnt;
4738 static void LDKLogger_JCalls_free(void* this_arg) {
4739 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4740 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4742 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4743 if (get_jenv_res == JNI_EDETACHED) {
4744 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4746 DO_ASSERT(get_jenv_res == JNI_OK);
4748 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4749 if (get_jenv_res == JNI_EDETACHED) {
4750 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4755 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4756 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4758 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4759 if (get_jenv_res == JNI_EDETACHED) {
4760 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4762 DO_ASSERT(get_jenv_res == JNI_OK);
4764 const char* record_str = record;
4765 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4766 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4768 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4769 if ((*env)->ExceptionCheck(env)) {
4770 (*env)->ExceptionDescribe(env);
4771 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4773 if (get_jenv_res == JNI_EDETACHED) {
4774 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4777 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4778 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4779 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4781 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4782 jclass c = (*env)->GetObjectClass(env, o);
4784 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4785 atomic_init(&calls->refcnt, 1);
4786 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4787 calls->o = (*env)->NewWeakGlobalRef(env, o);
4788 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4789 CHECK(calls->log_meth != NULL);
4792 .this_arg = (void*) calls,
4793 .log = log_LDKLogger_jcall,
4794 .free = LDKLogger_JCalls_free,
4798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4799 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4800 *res_ptr = LDKLogger_init(env, clz, o);
4801 return (uint64_t)res_ptr;
4803 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4804 return ThirtyTwoBytes_clone(&tuple->a);
4806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4807 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4808 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4809 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data);
4813 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4817 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4818 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
4819 uint64_t ret_ref = 0;
4820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4822 ret_ref = (uint64_t)ret_var.inner & ~1;
4826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4827 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4830 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4831 CHECK(val->result_ok);
4832 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = &(*val->contents.result);
4833 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
4834 return ((uint64_t)res_conv) | 1;
4836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4837 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4838 CHECK(!val->result_ok);
4839 LDKDecodeError err_var = (*val->contents.err);
4840 uint64_t err_ref = 0;
4841 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4842 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4843 err_ref = (uint64_t)err_var.inner & ~1;
4846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4847 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4850 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4851 CHECK(val->result_ok);
4852 LDKChannelConfig res_var = (*val->contents.result);
4853 uint64_t res_ref = 0;
4854 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4855 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4856 res_ref = (uint64_t)res_var.inner & ~1;
4859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4860 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4861 CHECK(!val->result_ok);
4862 LDKDecodeError err_var = (*val->contents.err);
4863 uint64_t err_ref = 0;
4864 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4865 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4866 err_ref = (uint64_t)err_var.inner & ~1;
4869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4870 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4873 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4874 CHECK(val->result_ok);
4875 LDKOutPoint res_var = (*val->contents.result);
4876 uint64_t res_ref = 0;
4877 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4878 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4879 res_ref = (uint64_t)res_var.inner & ~1;
4882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4883 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4884 CHECK(!val->result_ok);
4885 LDKDecodeError err_var = (*val->contents.err);
4886 uint64_t err_ref = 0;
4887 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4888 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4889 err_ref = (uint64_t)err_var.inner & ~1;
4892 typedef struct LDKType_JCalls {
4893 atomic_size_t refcnt;
4896 jmethodID type_id_meth;
4897 jmethodID debug_str_meth;
4898 jmethodID write_meth;
4900 static void LDKType_JCalls_free(void* this_arg) {
4901 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4902 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4904 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4905 if (get_jenv_res == JNI_EDETACHED) {
4906 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4908 DO_ASSERT(get_jenv_res == JNI_OK);
4910 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4911 if (get_jenv_res == JNI_EDETACHED) {
4912 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4917 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4918 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4921 if (get_jenv_res == JNI_EDETACHED) {
4922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4924 DO_ASSERT(get_jenv_res == JNI_OK);
4926 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4928 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4929 if ((*env)->ExceptionCheck(env)) {
4930 (*env)->ExceptionDescribe(env);
4931 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4933 if (get_jenv_res == JNI_EDETACHED) {
4934 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4938 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4939 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4941 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4942 if (get_jenv_res == JNI_EDETACHED) {
4943 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4945 DO_ASSERT(get_jenv_res == JNI_OK);
4947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4949 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4950 if ((*env)->ExceptionCheck(env)) {
4951 (*env)->ExceptionDescribe(env);
4952 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4954 LDKStr ret_conv = java_to_owned_str(env, ret);
4955 if (get_jenv_res == JNI_EDETACHED) {
4956 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4960 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4961 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4963 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4964 if (get_jenv_res == JNI_EDETACHED) {
4965 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4967 DO_ASSERT(get_jenv_res == JNI_OK);
4969 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4971 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4972 if ((*env)->ExceptionCheck(env)) {
4973 (*env)->ExceptionDescribe(env);
4974 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4976 LDKCVec_u8Z ret_ref;
4977 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4978 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4979 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4980 if (get_jenv_res == JNI_EDETACHED) {
4981 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4985 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4986 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4987 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4989 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4990 jclass c = (*env)->GetObjectClass(env, o);
4992 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4993 atomic_init(&calls->refcnt, 1);
4994 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4995 calls->o = (*env)->NewWeakGlobalRef(env, o);
4996 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4997 CHECK(calls->type_id_meth != NULL);
4998 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4999 CHECK(calls->debug_str_meth != NULL);
5000 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5001 CHECK(calls->write_meth != NULL);
5004 .this_arg = (void*) calls,
5005 .type_id = type_id_LDKType_jcall,
5006 .debug_str = debug_str_LDKType_jcall,
5007 .write = write_LDKType_jcall,
5008 .cloned = LDKType_JCalls_cloned,
5009 .free = LDKType_JCalls_free,
5013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
5014 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5015 *res_ptr = LDKType_init(env, clz, o);
5016 return (uint64_t)res_ptr;
5018 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5019 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5020 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5021 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5022 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5026 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
5027 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5028 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5029 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5030 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5031 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
5036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5037 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5038 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5039 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5040 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5041 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5042 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5043 CVec_u8Z_free(ret_var);
5047 static jclass LDKCOption_TypeZ_Some_class = NULL;
5048 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
5049 static jclass LDKCOption_TypeZ_None_class = NULL;
5050 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
5051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
5052 LDKCOption_TypeZ_Some_class =
5053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
5054 CHECK(LDKCOption_TypeZ_Some_class != NULL);
5055 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
5056 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
5057 LDKCOption_TypeZ_None_class =
5058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
5059 CHECK(LDKCOption_TypeZ_None_class != NULL);
5060 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
5061 CHECK(LDKCOption_TypeZ_None_meth != NULL);
5063 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5064 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5066 case LDKCOption_TypeZ_Some: {
5067 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5068 *some_ret = Type_clone(&obj->some);
5069 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
5071 case LDKCOption_TypeZ_None: {
5072 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
5077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5078 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
5080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5081 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
5082 CHECK(val->result_ok);
5083 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5087 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
5088 CHECK(!val->result_ok);
5089 LDKDecodeError err_var = (*val->contents.err);
5090 uint64_t err_ref = 0;
5091 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5092 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5093 err_ref = (uint64_t)err_var.inner & ~1;
5096 static jclass LDKPaymentError_Invoice_class = NULL;
5097 static jmethodID LDKPaymentError_Invoice_meth = NULL;
5098 static jclass LDKPaymentError_Routing_class = NULL;
5099 static jmethodID LDKPaymentError_Routing_meth = NULL;
5100 static jclass LDKPaymentError_Sending_class = NULL;
5101 static jmethodID LDKPaymentError_Sending_meth = NULL;
5102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
5103 LDKPaymentError_Invoice_class =
5104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Invoice;"));
5105 CHECK(LDKPaymentError_Invoice_class != NULL);
5106 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
5107 CHECK(LDKPaymentError_Invoice_meth != NULL);
5108 LDKPaymentError_Routing_class =
5109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Routing;"));
5110 CHECK(LDKPaymentError_Routing_class != NULL);
5111 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
5112 CHECK(LDKPaymentError_Routing_meth != NULL);
5113 LDKPaymentError_Sending_class =
5114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Sending;"));
5115 CHECK(LDKPaymentError_Sending_class != NULL);
5116 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
5117 CHECK(LDKPaymentError_Sending_meth != NULL);
5119 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5120 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5122 case LDKPaymentError_Invoice: {
5123 LDKStr invoice_str = obj->invoice;
5124 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
5125 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
5127 case LDKPaymentError_Routing: {
5128 LDKLightningError routing_var = obj->routing;
5129 uint64_t routing_ref = 0;
5130 CHECK((((uint64_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5131 CHECK((((uint64_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5132 routing_ref = (uint64_t)routing_var.inner & ~1;
5133 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
5135 case LDKPaymentError_Sending: {
5136 uint64_t sending_ref = ((uint64_t)&obj->sending) | 1;
5137 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
5142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5143 return ((LDKCResult_PaymentIdPaymentErrorZ*)arg)->result_ok;
5145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5146 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
5147 CHECK(val->result_ok);
5148 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
5149 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
5152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5153 LDKCResult_PaymentIdPaymentErrorZ *val = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
5154 CHECK(!val->result_ok);
5155 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5159 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
5161 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5162 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
5163 CHECK(val->result_ok);
5164 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
5167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5168 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
5169 CHECK(!val->result_ok);
5170 return *val->contents.err;
5172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5173 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
5175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5176 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
5177 CHECK(val->result_ok);
5178 LDKInvoice res_var = (*val->contents.result);
5179 uint64_t res_ref = 0;
5180 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5181 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5182 res_ref = (uint64_t)res_var.inner & ~1;
5185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5186 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
5187 CHECK(!val->result_ok);
5188 return *val->contents.err;
5190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5191 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
5193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5194 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
5195 CHECK(val->result_ok);
5196 LDKSignedRawInvoice res_var = (*val->contents.result);
5197 uint64_t res_ref = 0;
5198 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5199 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5200 res_ref = (uint64_t)res_var.inner & ~1;
5203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5204 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
5205 CHECK(!val->result_ok);
5206 return *val->contents.err;
5208 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5209 return RawInvoice_clone(&tuple->a);
5211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5212 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5213 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
5214 uint64_t ret_ref = 0;
5215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5217 ret_ref = (uint64_t)ret_var.inner;
5218 if (ret_var.is_owned) {
5224 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5225 return ThirtyTwoBytes_clone(&tuple->b);
5227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5228 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5229 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5230 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data);
5234 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
5235 return InvoiceSignature_clone(&tuple->c);
5237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
5238 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
5239 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
5240 uint64_t ret_ref = 0;
5241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5243 ret_ref = (uint64_t)ret_var.inner;
5244 if (ret_var.is_owned) {
5250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5251 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
5253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5254 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
5255 CHECK(val->result_ok);
5256 LDKPayeePubKey res_var = (*val->contents.result);
5257 uint64_t res_ref = 0;
5258 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5259 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5260 res_ref = (uint64_t)res_var.inner & ~1;
5263 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5264 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
5265 CHECK(!val->result_ok);
5266 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5270 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
5271 ret->datalen = (*env)->GetArrayLength(env, elems);
5272 if (ret->datalen == 0) {
5275 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
5276 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5277 for (size_t i = 0; i < ret->datalen; i++) {
5278 int64_t arr_elem = java_elems[i];
5279 LDKPrivateRoute arr_elem_conv;
5280 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5281 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5282 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
5283 ret->data[i] = arr_elem_conv;
5285 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5287 return (uint64_t)ret;
5289 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5290 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5291 for (size_t i = 0; i < ret.datalen; i++) {
5292 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5297 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
5299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5300 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
5301 CHECK(val->result_ok);
5302 LDKPositiveTimestamp res_var = (*val->contents.result);
5303 uint64_t res_ref = 0;
5304 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5305 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5306 res_ref = (uint64_t)res_var.inner & ~1;
5309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5310 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
5311 CHECK(!val->result_ok);
5312 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5316 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
5318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5319 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
5320 CHECK(val->result_ok);
5321 return *val->contents.result;
5323 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5324 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
5325 CHECK(!val->result_ok);
5326 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
5329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5330 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
5332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5333 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
5334 CHECK(val->result_ok);
5335 LDKInvoice res_var = (*val->contents.result);
5336 uint64_t res_ref = 0;
5337 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5338 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5339 res_ref = (uint64_t)res_var.inner & ~1;
5342 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5343 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
5344 CHECK(!val->result_ok);
5345 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
5348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5349 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
5351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5352 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5353 CHECK(val->result_ok);
5354 LDKDescription res_var = (*val->contents.result);
5355 uint64_t res_ref = 0;
5356 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5357 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5358 res_ref = (uint64_t)res_var.inner & ~1;
5361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5362 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
5363 CHECK(!val->result_ok);
5364 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5368 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
5370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5371 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5372 CHECK(val->result_ok);
5373 LDKExpiryTime res_var = (*val->contents.result);
5374 uint64_t res_ref = 0;
5375 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5376 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5377 res_ref = (uint64_t)res_var.inner & ~1;
5380 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5381 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
5382 CHECK(!val->result_ok);
5383 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5387 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
5389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5390 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5391 CHECK(val->result_ok);
5392 LDKPrivateRoute res_var = (*val->contents.result);
5393 uint64_t res_ref = 0;
5394 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5395 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5396 res_ref = (uint64_t)res_var.inner & ~1;
5399 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5400 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
5401 CHECK(!val->result_ok);
5402 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
5405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5406 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
5408 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5409 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5410 CHECK(val->result_ok);
5411 LDKStr res_str = (*val->contents.result);
5412 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
5415 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5416 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
5417 CHECK(!val->result_ok);
5418 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
5421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5422 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
5424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5425 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5426 CHECK(val->result_ok);
5427 LDKChannelMonitorUpdate res_var = (*val->contents.result);
5428 uint64_t res_ref = 0;
5429 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5430 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5431 res_ref = (uint64_t)res_var.inner & ~1;
5434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5435 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
5436 CHECK(!val->result_ok);
5437 LDKDecodeError err_var = (*val->contents.err);
5438 uint64_t err_ref = 0;
5439 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5440 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5441 err_ref = (uint64_t)err_var.inner & ~1;
5444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5445 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
5447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5448 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5449 CHECK(val->result_ok);
5450 LDKHTLCUpdate res_var = (*val->contents.result);
5451 uint64_t res_ref = 0;
5452 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5453 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5454 res_ref = (uint64_t)res_var.inner & ~1;
5457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5458 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
5459 CHECK(!val->result_ok);
5460 LDKDecodeError err_var = (*val->contents.err);
5461 uint64_t err_ref = 0;
5462 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5463 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5464 err_ref = (uint64_t)err_var.inner & ~1;
5467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5468 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
5470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5471 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5472 CHECK(val->result_ok);
5473 return *val->contents.result;
5475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5476 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5477 CHECK(!val->result_ok);
5478 LDKMonitorUpdateError err_var = (*val->contents.err);
5479 uint64_t err_ref = 0;
5480 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5481 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5482 err_ref = (uint64_t)err_var.inner & ~1;
5485 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5486 return OutPoint_clone(&tuple->a);
5488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5489 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5490 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
5491 uint64_t ret_ref = 0;
5492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5494 ret_ref = (uint64_t)ret_var.inner;
5495 if (ret_var.is_owned) {
5501 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5502 return CVec_u8Z_clone(&tuple->b);
5504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5505 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5506 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
5507 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5508 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5509 CVec_u8Z_free(ret_var);
5513 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5516 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5517 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5518 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
5522 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5523 return CVec_u8Z_clone(&tuple->b);
5525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5526 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5527 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
5528 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5529 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5530 CVec_u8Z_free(ret_var);
5534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5535 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
5536 ret->datalen = (*env)->GetArrayLength(env, elems);
5537 if (ret->datalen == 0) {
5540 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5541 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5542 for (size_t i = 0; i < ret->datalen; i++) {
5543 int64_t arr_elem = java_elems[i];
5544 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5545 CHECK_ACCESS(arr_elem_ptr);
5546 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(arr_elem_ptr);
5547 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5548 ret->data[i] = arr_elem_conv;
5550 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5552 return (uint64_t)ret;
5554 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5555 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5556 for (size_t i = 0; i < ret.datalen; i++) {
5557 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5561 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5562 return ThirtyTwoBytes_clone(&tuple->a);
5564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5565 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5566 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5567 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data);
5571 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5572 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
5574 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5575 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5576 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
5577 int64_tArray ret_arr = NULL;
5578 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5579 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5580 for (size_t v = 0; v < ret_var.datalen; v++) {
5581 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5582 *ret_conv_21_conv = ret_var.data[v];
5583 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
5585 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5591 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5592 ret->datalen = (*env)->GetArrayLength(env, elems);
5593 if (ret->datalen == 0) {
5596 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5597 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5598 for (size_t i = 0; i < ret->datalen; i++) {
5599 int64_t arr_elem = java_elems[i];
5600 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5601 CHECK_ACCESS(arr_elem_ptr);
5602 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arr_elem_ptr);
5603 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5604 ret->data[i] = arr_elem_conv;
5606 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5608 return (uint64_t)ret;
5610 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5611 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 };
5612 for (size_t i = 0; i < ret.datalen; i++) {
5613 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5617 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5618 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5619 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5620 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5622 LDKPaymentPurpose_InvoicePayment_class =
5623 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5624 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5625 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5626 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5627 LDKPaymentPurpose_SpontaneousPayment_class =
5628 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5629 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5630 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5631 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5633 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5634 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5636 case LDKPaymentPurpose_InvoicePayment: {
5637 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5638 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5639 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5640 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5641 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5643 case LDKPaymentPurpose_SpontaneousPayment: {
5644 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5645 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5646 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5651 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5652 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5653 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5654 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5655 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5656 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5657 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5658 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5659 static jclass LDKClosureReason_ProcessingError_class = NULL;
5660 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5661 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5662 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5663 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5664 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5666 LDKClosureReason_CounterpartyForceClosed_class =
5667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5668 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5669 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5670 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5671 LDKClosureReason_HolderForceClosed_class =
5672 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5673 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5674 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5675 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5676 LDKClosureReason_CooperativeClosure_class =
5677 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5678 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5679 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5680 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5681 LDKClosureReason_CommitmentTxConfirmed_class =
5682 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5683 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5684 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5685 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5686 LDKClosureReason_ProcessingError_class =
5687 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5688 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5689 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5690 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5691 LDKClosureReason_DisconnectedPeer_class =
5692 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5693 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5694 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5695 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5696 LDKClosureReason_OutdatedChannelManager_class =
5697 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5698 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5699 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5700 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5702 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5703 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5705 case LDKClosureReason_CounterpartyForceClosed: {
5706 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5707 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5708 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5710 case LDKClosureReason_HolderForceClosed: {
5711 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5713 case LDKClosureReason_CooperativeClosure: {
5714 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5716 case LDKClosureReason_CommitmentTxConfirmed: {
5717 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5719 case LDKClosureReason_ProcessingError: {
5720 LDKStr err_str = obj->processing_error.err;
5721 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5722 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5724 case LDKClosureReason_DisconnectedPeer: {
5725 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5727 case LDKClosureReason_OutdatedChannelManager: {
5728 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5733 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5734 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5735 static jclass LDKEvent_PaymentReceived_class = NULL;
5736 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5737 static jclass LDKEvent_PaymentSent_class = NULL;
5738 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5739 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5740 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5741 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5742 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5743 static jclass LDKEvent_SpendableOutputs_class = NULL;
5744 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5745 static jclass LDKEvent_PaymentForwarded_class = NULL;
5746 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5747 static jclass LDKEvent_ChannelClosed_class = NULL;
5748 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5749 static jclass LDKEvent_DiscardFunding_class = NULL;
5750 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
5751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5752 LDKEvent_FundingGenerationReady_class =
5753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5754 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5755 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5756 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5757 LDKEvent_PaymentReceived_class =
5758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5759 CHECK(LDKEvent_PaymentReceived_class != NULL);
5760 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5761 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5762 LDKEvent_PaymentSent_class =
5763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5764 CHECK(LDKEvent_PaymentSent_class != NULL);
5765 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
5766 CHECK(LDKEvent_PaymentSent_meth != NULL);
5767 LDKEvent_PaymentPathFailed_class =
5768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5769 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5770 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
5771 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5772 LDKEvent_PendingHTLCsForwardable_class =
5773 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5774 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5775 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5776 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5777 LDKEvent_SpendableOutputs_class =
5778 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5779 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5780 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5781 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5782 LDKEvent_PaymentForwarded_class =
5783 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5784 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5785 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5786 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5787 LDKEvent_ChannelClosed_class =
5788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5789 CHECK(LDKEvent_ChannelClosed_class != NULL);
5790 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
5791 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5792 LDKEvent_DiscardFunding_class =
5793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;"));
5794 CHECK(LDKEvent_DiscardFunding_class != NULL);
5795 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
5796 CHECK(LDKEvent_DiscardFunding_meth != NULL);
5798 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5799 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5801 case LDKEvent_FundingGenerationReady: {
5802 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5803 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5804 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5805 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5806 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5807 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);
5809 case LDKEvent_PaymentReceived: {
5810 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5811 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5812 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5813 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5815 case LDKEvent_PaymentSent: {
5816 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5817 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
5818 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5819 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5820 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5821 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
5822 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
5823 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
5825 case LDKEvent_PaymentPathFailed: {
5826 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5827 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
5828 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5829 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5830 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5831 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5832 int64_tArray path_arr = NULL;
5833 path_arr = (*env)->NewLongArray(env, path_var.datalen);
5834 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5835 for (size_t k = 0; k < path_var.datalen; k++) {
5836 LDKRouteHop path_conv_10_var = path_var.data[k];
5837 uint64_t path_conv_10_ref = 0;
5838 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5839 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5840 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5841 path_arr_ptr[k] = path_conv_10_ref;
5843 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5844 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
5845 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
5846 uint64_t retry_ref = 0;
5847 if ((uint64_t)retry_var.inner > 4096) {
5848 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5849 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5850 retry_ref = (uint64_t)retry_var.inner & ~1;
5852 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, 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, retry_ref);
5854 case LDKEvent_PendingHTLCsForwardable: {
5855 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5857 case LDKEvent_SpendableOutputs: {
5858 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5859 int64_tArray outputs_arr = NULL;
5860 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5861 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5862 for (size_t b = 0; b < outputs_var.datalen; b++) {
5863 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5864 outputs_arr_ptr[b] = outputs_conv_27_ref;
5866 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5867 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5869 case LDKEvent_PaymentForwarded: {
5870 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5871 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5873 case LDKEvent_ChannelClosed: {
5874 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5875 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5876 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5877 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
5879 case LDKEvent_DiscardFunding: {
5880 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5881 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
5882 LDKTransaction transaction_var = obj->discard_funding.transaction;
5883 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
5884 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
5885 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
5890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5891 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5892 ret->datalen = (*env)->GetArrayLength(env, elems);
5893 if (ret->datalen == 0) {
5896 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5897 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5898 for (size_t i = 0; i < ret->datalen; i++) {
5899 int64_t arr_elem = java_elems[i];
5900 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5901 CHECK_ACCESS(arr_elem_ptr);
5902 LDKEvent arr_elem_conv = *(LDKEvent*)(arr_elem_ptr);
5903 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5904 ret->data[i] = arr_elem_conv;
5906 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5908 return (uint64_t)ret;
5910 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5911 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5912 for (size_t i = 0; i < ret.datalen; i++) {
5913 ret.data[i] = Event_clone(&orig->data[i]);
5917 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5920 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5921 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5922 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
5926 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5927 return TxOut_clone(&tuple->b);
5929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5930 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5931 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5932 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
5933 return (uint64_t)ret_ref;
5936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5937 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5938 ret->datalen = (*env)->GetArrayLength(env, elems);
5939 if (ret->datalen == 0) {
5942 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5943 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5944 for (size_t i = 0; i < ret->datalen; i++) {
5945 int64_t arr_elem = java_elems[i];
5946 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
5947 CHECK_ACCESS(arr_elem_ptr);
5948 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(arr_elem_ptr);
5949 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5950 ret->data[i] = arr_elem_conv;
5952 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5954 return (uint64_t)ret;
5956 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5957 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5958 for (size_t i = 0; i < ret.datalen; i++) {
5959 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5963 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5964 return ThirtyTwoBytes_clone(&tuple->a);
5966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5967 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5968 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5969 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data);
5973 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5974 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
5976 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5977 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5978 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
5979 int64_tArray ret_arr = NULL;
5980 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5981 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5982 for (size_t u = 0; u < ret_var.datalen; u++) {
5983 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5984 *ret_conv_20_conv = ret_var.data[u];
5985 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
5987 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5993 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5994 ret->datalen = (*env)->GetArrayLength(env, elems);
5995 if (ret->datalen == 0) {
5998 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5999 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6000 for (size_t i = 0; i < ret->datalen; i++) {
6001 int64_t arr_elem = java_elems[i];
6002 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
6003 CHECK_ACCESS(arr_elem_ptr);
6004 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arr_elem_ptr);
6005 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
6006 ret->data[i] = arr_elem_conv;
6008 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6010 return (uint64_t)ret;
6012 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6013 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 };
6014 for (size_t i = 0; i < ret.datalen; i++) {
6015 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6019 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
6020 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
6021 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
6022 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
6023 static jclass LDKBalance_ContentiousClaimable_class = NULL;
6024 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
6025 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
6026 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
6027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
6028 LDKBalance_ClaimableOnChannelClose_class =
6029 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
6030 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
6031 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
6032 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
6033 LDKBalance_ClaimableAwaitingConfirmations_class =
6034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
6035 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
6036 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
6037 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
6038 LDKBalance_ContentiousClaimable_class =
6039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
6040 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
6041 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
6042 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
6043 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
6044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
6045 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
6046 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
6047 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
6049 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6050 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6052 case LDKBalance_ClaimableOnChannelClose: {
6053 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
6055 case LDKBalance_ClaimableAwaitingConfirmations: {
6056 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
6058 case LDKBalance_ContentiousClaimable: {
6059 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
6061 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
6062 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);
6067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6068 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
6069 ret->datalen = (*env)->GetArrayLength(env, elems);
6070 if (ret->datalen == 0) {
6073 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
6074 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6075 for (size_t i = 0; i < ret->datalen; i++) {
6076 int64_t arr_elem = java_elems[i];
6077 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
6078 CHECK_ACCESS(arr_elem_ptr);
6079 LDKBalance arr_elem_conv = *(LDKBalance*)(arr_elem_ptr);
6080 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
6081 ret->data[i] = arr_elem_conv;
6083 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6085 return (uint64_t)ret;
6087 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6088 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6089 for (size_t i = 0; i < ret.datalen; i++) {
6090 ret.data[i] = Balance_clone(&orig->data[i]);
6094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6095 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
6097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6098 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
6099 CHECK(val->result_ok);
6100 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6101 *res_conv = (*val->contents.result);
6102 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
6103 return ((uint64_t)res_conv);
6105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6106 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
6107 CHECK(!val->result_ok);
6108 LDKDecodeError err_var = (*val->contents.err);
6109 uint64_t err_ref = 0;
6110 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6111 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6112 err_ref = (uint64_t)err_var.inner & ~1;
6115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6116 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
6118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6119 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
6120 CHECK(val->result_ok);
6121 return *val->contents.result;
6123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6124 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
6125 CHECK(!val->result_ok);
6126 LDKLightningError err_var = (*val->contents.err);
6127 uint64_t err_ref = 0;
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 err_ref = (uint64_t)err_var.inner & ~1;
6133 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
6136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
6137 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
6138 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form);
6143 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
6144 return Type_clone(&tuple->b);
6146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
6147 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
6148 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6149 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
6150 return (uint64_t)ret_ret;
6153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6154 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
6155 ret->datalen = (*env)->GetArrayLength(env, elems);
6156 if (ret->datalen == 0) {
6159 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
6160 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6161 for (size_t i = 0; i < ret->datalen; i++) {
6162 int64_t arr_elem = java_elems[i];
6163 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
6164 CHECK_ACCESS(arr_elem_ptr);
6165 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(arr_elem_ptr);
6166 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
6167 ret->data[i] = arr_elem_conv;
6169 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6171 return (uint64_t)ret;
6173 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6174 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6175 for (size_t i = 0; i < ret.datalen; i++) {
6176 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6181 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
6183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6184 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
6185 CHECK(val->result_ok);
6186 return *val->contents.result;
6188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6189 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
6190 CHECK(!val->result_ok);
6191 LDKLightningError err_var = (*val->contents.err);
6192 uint64_t err_ref = 0;
6193 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6194 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6195 err_ref = (uint64_t)err_var.inner & ~1;
6198 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6199 return ChannelAnnouncement_clone(&tuple->a);
6201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
6202 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6203 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
6204 uint64_t ret_ref = 0;
6205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6207 ret_ref = (uint64_t)ret_var.inner;
6208 if (ret_var.is_owned) {
6214 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6215 return ChannelUpdate_clone(&tuple->b);
6217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
6218 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6219 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
6220 uint64_t ret_ref = 0;
6221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6223 ret_ref = (uint64_t)ret_var.inner;
6224 if (ret_var.is_owned) {
6230 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
6231 return ChannelUpdate_clone(&tuple->c);
6233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
6234 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
6235 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
6236 uint64_t ret_ref = 0;
6237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6239 ret_ref = (uint64_t)ret_var.inner;
6240 if (ret_var.is_owned) {
6246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6247 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
6248 ret->datalen = (*env)->GetArrayLength(env, elems);
6249 if (ret->datalen == 0) {
6252 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
6253 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6254 for (size_t i = 0; i < ret->datalen; i++) {
6255 int64_t arr_elem = java_elems[i];
6256 void* arr_elem_ptr = (void*)(((uint64_t)arr_elem) & ~1);
6257 CHECK_ACCESS(arr_elem_ptr);
6258 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arr_elem_ptr);
6259 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
6260 ret->data[i] = arr_elem_conv;
6262 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6264 return (uint64_t)ret;
6266 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
6267 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
6268 for (size_t i = 0; i < ret.datalen; i++) {
6269 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
6273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6274 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
6275 ret->datalen = (*env)->GetArrayLength(env, elems);
6276 if (ret->datalen == 0) {
6279 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
6280 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6281 for (size_t i = 0; i < ret->datalen; i++) {
6282 int64_t arr_elem = java_elems[i];
6283 LDKNodeAnnouncement arr_elem_conv;
6284 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6285 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6286 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
6287 ret->data[i] = arr_elem_conv;
6289 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6291 return (uint64_t)ret;
6293 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
6294 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
6295 for (size_t i = 0; i < ret.datalen; i++) {
6296 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
6300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6301 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
6303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6304 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6305 CHECK(val->result_ok);
6306 LDKCVec_u8Z res_var = (*val->contents.result);
6307 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
6308 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
6311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6312 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
6313 CHECK(!val->result_ok);
6314 LDKPeerHandleError err_var = (*val->contents.err);
6315 uint64_t err_ref = 0;
6316 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6317 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6318 err_ref = (uint64_t)err_var.inner & ~1;
6321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6322 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
6324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6325 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6326 CHECK(val->result_ok);
6327 return *val->contents.result;
6329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6330 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
6331 CHECK(!val->result_ok);
6332 LDKPeerHandleError err_var = (*val->contents.err);
6333 uint64_t err_ref = 0;
6334 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6335 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6336 err_ref = (uint64_t)err_var.inner & ~1;
6339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6340 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
6342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6343 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6344 CHECK(val->result_ok);
6345 return *val->contents.result;
6347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6348 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
6349 CHECK(!val->result_ok);
6350 LDKPeerHandleError err_var = (*val->contents.err);
6351 uint64_t err_ref = 0;
6352 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6353 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6354 err_ref = (uint64_t)err_var.inner & ~1;
6357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6358 return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok;
6360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6361 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6362 CHECK(val->result_ok);
6363 LDKNodeId res_var = (*val->contents.result);
6364 uint64_t res_ref = 0;
6365 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6366 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6367 res_ref = (uint64_t)res_var.inner & ~1;
6370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6371 LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
6372 CHECK(!val->result_ok);
6373 LDKDecodeError err_var = (*val->contents.err);
6374 uint64_t err_ref = 0;
6375 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6376 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6377 err_ref = (uint64_t)err_var.inner & ~1;
6380 typedef struct LDKAccess_JCalls {
6381 atomic_size_t refcnt;
6384 jmethodID get_utxo_meth;
6386 static void LDKAccess_JCalls_free(void* this_arg) {
6387 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6388 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6390 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6391 if (get_jenv_res == JNI_EDETACHED) {
6392 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6394 DO_ASSERT(get_jenv_res == JNI_OK);
6396 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6397 if (get_jenv_res == JNI_EDETACHED) {
6398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6403 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6404 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6406 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6407 if (get_jenv_res == JNI_EDETACHED) {
6408 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6410 DO_ASSERT(get_jenv_res == JNI_OK);
6412 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6413 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6414 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6416 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6417 if ((*env)->ExceptionCheck(env)) {
6418 (*env)->ExceptionDescribe(env);
6419 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6421 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6422 CHECK_ACCESS(ret_ptr);
6423 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
6424 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6425 if (get_jenv_res == JNI_EDETACHED) {
6426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6430 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6431 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6432 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6434 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6435 jclass c = (*env)->GetObjectClass(env, o);
6437 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6438 atomic_init(&calls->refcnt, 1);
6439 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6440 calls->o = (*env)->NewWeakGlobalRef(env, o);
6441 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6442 CHECK(calls->get_utxo_meth != NULL);
6445 .this_arg = (void*) calls,
6446 .get_utxo = get_utxo_LDKAccess_jcall,
6447 .free = LDKAccess_JCalls_free,
6451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6452 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6453 *res_ptr = LDKAccess_init(env, clz, o);
6454 return (uint64_t)res_ptr;
6456 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) {
6457 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6459 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
6460 unsigned char genesis_hash_arr[32];
6461 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6462 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6463 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6464 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6465 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6466 return (uint64_t)ret_conv;
6469 static jclass LDKCOption_AccessZ_Some_class = NULL;
6470 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
6471 static jclass LDKCOption_AccessZ_None_class = NULL;
6472 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
6473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
6474 LDKCOption_AccessZ_Some_class =
6475 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
6476 CHECK(LDKCOption_AccessZ_Some_class != NULL);
6477 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
6478 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
6479 LDKCOption_AccessZ_None_class =
6480 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
6481 CHECK(LDKCOption_AccessZ_None_class != NULL);
6482 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
6483 CHECK(LDKCOption_AccessZ_None_meth != NULL);
6485 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6486 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6488 case LDKCOption_AccessZ_Some: {
6489 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
6490 *some_ret = obj->some;
6491 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
6492 if ((*some_ret).free == LDKAccess_JCalls_free) {
6493 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6494 LDKAccess_JCalls_cloned(&(*some_ret));
6496 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
6498 case LDKCOption_AccessZ_None: {
6499 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
6504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6505 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
6507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6508 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6509 CHECK(val->result_ok);
6510 LDKDirectionalChannelInfo res_var = (*val->contents.result);
6511 uint64_t res_ref = 0;
6512 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6513 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6514 res_ref = (uint64_t)res_var.inner & ~1;
6517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6518 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6519 CHECK(!val->result_ok);
6520 LDKDecodeError err_var = (*val->contents.err);
6521 uint64_t err_ref = 0;
6522 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6523 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6524 err_ref = (uint64_t)err_var.inner & ~1;
6527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6528 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
6530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6531 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6532 CHECK(val->result_ok);
6533 LDKChannelInfo res_var = (*val->contents.result);
6534 uint64_t res_ref = 0;
6535 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6536 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6537 res_ref = (uint64_t)res_var.inner & ~1;
6540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6541 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6542 CHECK(!val->result_ok);
6543 LDKDecodeError err_var = (*val->contents.err);
6544 uint64_t err_ref = 0;
6545 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6546 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6547 err_ref = (uint64_t)err_var.inner & ~1;
6550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6551 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
6553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6554 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6555 CHECK(val->result_ok);
6556 LDKRoutingFees res_var = (*val->contents.result);
6557 uint64_t res_ref = 0;
6558 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6559 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6560 res_ref = (uint64_t)res_var.inner & ~1;
6563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6564 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6565 CHECK(!val->result_ok);
6566 LDKDecodeError err_var = (*val->contents.err);
6567 uint64_t err_ref = 0;
6568 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6569 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6570 err_ref = (uint64_t)err_var.inner & ~1;
6573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6574 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
6576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6577 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6578 CHECK(val->result_ok);
6579 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
6580 uint64_t res_ref = 0;
6581 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6582 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6583 res_ref = (uint64_t)res_var.inner & ~1;
6586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6587 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6588 CHECK(!val->result_ok);
6589 LDKDecodeError err_var = (*val->contents.err);
6590 uint64_t err_ref = 0;
6591 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6592 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6593 err_ref = (uint64_t)err_var.inner & ~1;
6596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6597 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
6598 ret->datalen = (*env)->GetArrayLength(env, elems);
6599 if (ret->datalen == 0) {
6602 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
6603 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6604 for (size_t i = 0; i < ret->datalen; i++) {
6605 ret->data[i] = java_elems[i];
6607 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6609 return (uint64_t)ret;
6611 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6612 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6613 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6617 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6620 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6621 CHECK(val->result_ok);
6622 LDKNodeInfo res_var = (*val->contents.result);
6623 uint64_t res_ref = 0;
6624 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6625 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6626 res_ref = (uint64_t)res_var.inner & ~1;
6629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6630 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6631 CHECK(!val->result_ok);
6632 LDKDecodeError err_var = (*val->contents.err);
6633 uint64_t err_ref = 0;
6634 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6635 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6636 err_ref = (uint64_t)err_var.inner & ~1;
6639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6640 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6643 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6644 CHECK(val->result_ok);
6645 LDKNetworkGraph res_var = (*val->contents.result);
6646 uint64_t res_ref = 0;
6647 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6648 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6649 res_ref = (uint64_t)res_var.inner & ~1;
6652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6653 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6654 CHECK(!val->result_ok);
6655 LDKDecodeError err_var = (*val->contents.err);
6656 uint64_t err_ref = 0;
6657 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6658 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6659 err_ref = (uint64_t)err_var.inner & ~1;
6662 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6663 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6664 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6665 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6667 LDKCOption_CVec_NetAddressZZ_Some_class =
6668 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;"));
6669 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6670 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6671 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6672 LDKCOption_CVec_NetAddressZZ_None_class =
6673 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;"));
6674 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6675 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6676 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6678 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6679 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6681 case LDKCOption_CVec_NetAddressZZ_Some: {
6682 LDKCVec_NetAddressZ some_var = obj->some;
6683 int64_tArray some_arr = NULL;
6684 some_arr = (*env)->NewLongArray(env, some_var.datalen);
6685 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6686 for (size_t m = 0; m < some_var.datalen; m++) {
6687 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
6688 some_arr_ptr[m] = some_conv_12_ref;
6690 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6691 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6693 case LDKCOption_CVec_NetAddressZZ_None: {
6694 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6700 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6703 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6704 CHECK(val->result_ok);
6705 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6709 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6710 CHECK(!val->result_ok);
6711 LDKDecodeError err_var = (*val->contents.err);
6712 uint64_t err_ref = 0;
6713 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6714 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6715 err_ref = (uint64_t)err_var.inner & ~1;
6718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6719 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6720 ret->datalen = (*env)->GetArrayLength(env, elems);
6721 if (ret->datalen == 0) {
6724 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6725 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6726 for (size_t i = 0; i < ret->datalen; i++) {
6727 int64_t arr_elem = java_elems[i];
6728 LDKUpdateAddHTLC arr_elem_conv;
6729 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6730 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6731 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6732 ret->data[i] = arr_elem_conv;
6734 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6736 return (uint64_t)ret;
6738 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6739 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6740 for (size_t i = 0; i < ret.datalen; i++) {
6741 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6746 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6747 ret->datalen = (*env)->GetArrayLength(env, elems);
6748 if (ret->datalen == 0) {
6751 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6752 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6753 for (size_t i = 0; i < ret->datalen; i++) {
6754 int64_t arr_elem = java_elems[i];
6755 LDKUpdateFulfillHTLC arr_elem_conv;
6756 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6757 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6758 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6759 ret->data[i] = arr_elem_conv;
6761 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6763 return (uint64_t)ret;
6765 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6766 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6767 for (size_t i = 0; i < ret.datalen; i++) {
6768 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6773 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6774 ret->datalen = (*env)->GetArrayLength(env, elems);
6775 if (ret->datalen == 0) {
6778 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6779 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6780 for (size_t i = 0; i < ret->datalen; i++) {
6781 int64_t arr_elem = java_elems[i];
6782 LDKUpdateFailHTLC arr_elem_conv;
6783 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6784 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6785 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6786 ret->data[i] = arr_elem_conv;
6788 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6790 return (uint64_t)ret;
6792 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6793 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6794 for (size_t i = 0; i < ret.datalen; i++) {
6795 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6800 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6801 ret->datalen = (*env)->GetArrayLength(env, elems);
6802 if (ret->datalen == 0) {
6805 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6806 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6807 for (size_t i = 0; i < ret->datalen; i++) {
6808 int64_t arr_elem = java_elems[i];
6809 LDKUpdateFailMalformedHTLC arr_elem_conv;
6810 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6811 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6812 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6813 ret->data[i] = arr_elem_conv;
6815 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6817 return (uint64_t)ret;
6819 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6820 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6821 for (size_t i = 0; i < ret.datalen; i++) {
6822 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6827 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6830 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6831 CHECK(val->result_ok);
6832 LDKAcceptChannel res_var = (*val->contents.result);
6833 uint64_t res_ref = 0;
6834 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6835 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6836 res_ref = (uint64_t)res_var.inner & ~1;
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6840 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6841 CHECK(!val->result_ok);
6842 LDKDecodeError err_var = (*val->contents.err);
6843 uint64_t err_ref = 0;
6844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 err_ref = (uint64_t)err_var.inner & ~1;
6849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6850 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6853 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6854 CHECK(val->result_ok);
6855 LDKAnnouncementSignatures res_var = (*val->contents.result);
6856 uint64_t res_ref = 0;
6857 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6858 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6859 res_ref = (uint64_t)res_var.inner & ~1;
6862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6863 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6864 CHECK(!val->result_ok);
6865 LDKDecodeError err_var = (*val->contents.err);
6866 uint64_t err_ref = 0;
6867 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6868 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6869 err_ref = (uint64_t)err_var.inner & ~1;
6872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6873 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6876 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6877 CHECK(val->result_ok);
6878 LDKChannelReestablish res_var = (*val->contents.result);
6879 uint64_t res_ref = 0;
6880 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6881 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6882 res_ref = (uint64_t)res_var.inner & ~1;
6885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6886 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6887 CHECK(!val->result_ok);
6888 LDKDecodeError err_var = (*val->contents.err);
6889 uint64_t err_ref = 0;
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 err_ref = (uint64_t)err_var.inner & ~1;
6895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6896 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6899 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6900 CHECK(val->result_ok);
6901 LDKClosingSigned res_var = (*val->contents.result);
6902 uint64_t res_ref = 0;
6903 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6904 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6905 res_ref = (uint64_t)res_var.inner & ~1;
6908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6909 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6910 CHECK(!val->result_ok);
6911 LDKDecodeError err_var = (*val->contents.err);
6912 uint64_t err_ref = 0;
6913 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6914 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6915 err_ref = (uint64_t)err_var.inner & ~1;
6918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6919 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6922 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6923 CHECK(val->result_ok);
6924 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6925 uint64_t res_ref = 0;
6926 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6927 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6928 res_ref = (uint64_t)res_var.inner & ~1;
6931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6932 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6933 CHECK(!val->result_ok);
6934 LDKDecodeError err_var = (*val->contents.err);
6935 uint64_t err_ref = 0;
6936 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6937 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6938 err_ref = (uint64_t)err_var.inner & ~1;
6941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6942 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6945 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6946 CHECK(val->result_ok);
6947 LDKCommitmentSigned res_var = (*val->contents.result);
6948 uint64_t res_ref = 0;
6949 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6950 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6951 res_ref = (uint64_t)res_var.inner & ~1;
6954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6955 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6956 CHECK(!val->result_ok);
6957 LDKDecodeError err_var = (*val->contents.err);
6958 uint64_t err_ref = 0;
6959 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6960 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6961 err_ref = (uint64_t)err_var.inner & ~1;
6964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6965 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6968 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6969 CHECK(val->result_ok);
6970 LDKFundingCreated res_var = (*val->contents.result);
6971 uint64_t res_ref = 0;
6972 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6973 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6974 res_ref = (uint64_t)res_var.inner & ~1;
6977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6978 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6979 CHECK(!val->result_ok);
6980 LDKDecodeError err_var = (*val->contents.err);
6981 uint64_t err_ref = 0;
6982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6984 err_ref = (uint64_t)err_var.inner & ~1;
6987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6988 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6991 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6992 CHECK(val->result_ok);
6993 LDKFundingSigned res_var = (*val->contents.result);
6994 uint64_t res_ref = 0;
6995 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6996 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6997 res_ref = (uint64_t)res_var.inner & ~1;
7000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7001 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
7002 CHECK(!val->result_ok);
7003 LDKDecodeError err_var = (*val->contents.err);
7004 uint64_t err_ref = 0;
7005 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7006 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7007 err_ref = (uint64_t)err_var.inner & ~1;
7010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7011 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
7013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7014 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
7015 CHECK(val->result_ok);
7016 LDKFundingLocked res_var = (*val->contents.result);
7017 uint64_t res_ref = 0;
7018 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7019 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7020 res_ref = (uint64_t)res_var.inner & ~1;
7023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7024 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
7025 CHECK(!val->result_ok);
7026 LDKDecodeError err_var = (*val->contents.err);
7027 uint64_t err_ref = 0;
7028 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7029 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7030 err_ref = (uint64_t)err_var.inner & ~1;
7033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7034 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
7036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7037 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
7038 CHECK(val->result_ok);
7039 LDKInit res_var = (*val->contents.result);
7040 uint64_t res_ref = 0;
7041 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7042 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7043 res_ref = (uint64_t)res_var.inner & ~1;
7046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7047 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
7048 CHECK(!val->result_ok);
7049 LDKDecodeError err_var = (*val->contents.err);
7050 uint64_t err_ref = 0;
7051 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7052 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7053 err_ref = (uint64_t)err_var.inner & ~1;
7056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7057 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
7059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7060 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
7061 CHECK(val->result_ok);
7062 LDKOpenChannel res_var = (*val->contents.result);
7063 uint64_t res_ref = 0;
7064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7066 res_ref = (uint64_t)res_var.inner & ~1;
7069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7070 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
7071 CHECK(!val->result_ok);
7072 LDKDecodeError err_var = (*val->contents.err);
7073 uint64_t err_ref = 0;
7074 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7075 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7076 err_ref = (uint64_t)err_var.inner & ~1;
7079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7080 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
7082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7083 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
7084 CHECK(val->result_ok);
7085 LDKRevokeAndACK res_var = (*val->contents.result);
7086 uint64_t res_ref = 0;
7087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7089 res_ref = (uint64_t)res_var.inner & ~1;
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7093 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
7094 CHECK(!val->result_ok);
7095 LDKDecodeError err_var = (*val->contents.err);
7096 uint64_t err_ref = 0;
7097 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7098 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7099 err_ref = (uint64_t)err_var.inner & ~1;
7102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7103 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
7105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7106 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
7107 CHECK(val->result_ok);
7108 LDKShutdown res_var = (*val->contents.result);
7109 uint64_t res_ref = 0;
7110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7112 res_ref = (uint64_t)res_var.inner & ~1;
7115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7116 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
7117 CHECK(!val->result_ok);
7118 LDKDecodeError err_var = (*val->contents.err);
7119 uint64_t err_ref = 0;
7120 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7121 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7122 err_ref = (uint64_t)err_var.inner & ~1;
7125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7126 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
7128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7129 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
7130 CHECK(val->result_ok);
7131 LDKUpdateFailHTLC res_var = (*val->contents.result);
7132 uint64_t res_ref = 0;
7133 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7134 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7135 res_ref = (uint64_t)res_var.inner & ~1;
7138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7139 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
7140 CHECK(!val->result_ok);
7141 LDKDecodeError err_var = (*val->contents.err);
7142 uint64_t err_ref = 0;
7143 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7144 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7145 err_ref = (uint64_t)err_var.inner & ~1;
7148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7149 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
7151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7152 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
7153 CHECK(val->result_ok);
7154 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
7155 uint64_t res_ref = 0;
7156 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7157 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7158 res_ref = (uint64_t)res_var.inner & ~1;
7161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7162 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
7163 CHECK(!val->result_ok);
7164 LDKDecodeError err_var = (*val->contents.err);
7165 uint64_t err_ref = 0;
7166 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7167 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7168 err_ref = (uint64_t)err_var.inner & ~1;
7171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7172 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
7174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7175 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
7176 CHECK(val->result_ok);
7177 LDKUpdateFee res_var = (*val->contents.result);
7178 uint64_t res_ref = 0;
7179 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7180 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7181 res_ref = (uint64_t)res_var.inner & ~1;
7184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7185 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
7186 CHECK(!val->result_ok);
7187 LDKDecodeError err_var = (*val->contents.err);
7188 uint64_t err_ref = 0;
7189 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7190 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7191 err_ref = (uint64_t)err_var.inner & ~1;
7194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7195 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
7197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7198 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
7199 CHECK(val->result_ok);
7200 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
7201 uint64_t res_ref = 0;
7202 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7203 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7204 res_ref = (uint64_t)res_var.inner & ~1;
7207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7208 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
7209 CHECK(!val->result_ok);
7210 LDKDecodeError err_var = (*val->contents.err);
7211 uint64_t err_ref = 0;
7212 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7213 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7214 err_ref = (uint64_t)err_var.inner & ~1;
7217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7218 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
7220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7221 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
7222 CHECK(val->result_ok);
7223 LDKUpdateAddHTLC res_var = (*val->contents.result);
7224 uint64_t res_ref = 0;
7225 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7226 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7227 res_ref = (uint64_t)res_var.inner & ~1;
7230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7231 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
7232 CHECK(!val->result_ok);
7233 LDKDecodeError err_var = (*val->contents.err);
7234 uint64_t err_ref = 0;
7235 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7236 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7237 err_ref = (uint64_t)err_var.inner & ~1;
7240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7241 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
7243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7244 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
7245 CHECK(val->result_ok);
7246 LDKPing res_var = (*val->contents.result);
7247 uint64_t res_ref = 0;
7248 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7249 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7250 res_ref = (uint64_t)res_var.inner & ~1;
7253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7254 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
7255 CHECK(!val->result_ok);
7256 LDKDecodeError err_var = (*val->contents.err);
7257 uint64_t err_ref = 0;
7258 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7259 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7260 err_ref = (uint64_t)err_var.inner & ~1;
7263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7264 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
7266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7267 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
7268 CHECK(val->result_ok);
7269 LDKPong res_var = (*val->contents.result);
7270 uint64_t res_ref = 0;
7271 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7272 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7273 res_ref = (uint64_t)res_var.inner & ~1;
7276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7277 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
7278 CHECK(!val->result_ok);
7279 LDKDecodeError err_var = (*val->contents.err);
7280 uint64_t err_ref = 0;
7281 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7282 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7283 err_ref = (uint64_t)err_var.inner & ~1;
7286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7287 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
7289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7290 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7291 CHECK(val->result_ok);
7292 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
7293 uint64_t res_ref = 0;
7294 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7295 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7296 res_ref = (uint64_t)res_var.inner & ~1;
7299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7300 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7301 CHECK(!val->result_ok);
7302 LDKDecodeError err_var = (*val->contents.err);
7303 uint64_t err_ref = 0;
7304 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7305 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7306 err_ref = (uint64_t)err_var.inner & ~1;
7309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7310 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
7312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7313 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7314 CHECK(val->result_ok);
7315 LDKChannelAnnouncement res_var = (*val->contents.result);
7316 uint64_t res_ref = 0;
7317 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7318 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7319 res_ref = (uint64_t)res_var.inner & ~1;
7322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7323 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
7324 CHECK(!val->result_ok);
7325 LDKDecodeError err_var = (*val->contents.err);
7326 uint64_t err_ref = 0;
7327 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7328 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7329 err_ref = (uint64_t)err_var.inner & ~1;
7332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7333 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
7335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7336 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7337 CHECK(val->result_ok);
7338 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
7339 uint64_t res_ref = 0;
7340 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7341 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7342 res_ref = (uint64_t)res_var.inner & ~1;
7345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7346 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
7347 CHECK(!val->result_ok);
7348 LDKDecodeError err_var = (*val->contents.err);
7349 uint64_t err_ref = 0;
7350 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7351 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7352 err_ref = (uint64_t)err_var.inner & ~1;
7355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7356 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
7358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7359 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7360 CHECK(val->result_ok);
7361 LDKChannelUpdate res_var = (*val->contents.result);
7362 uint64_t res_ref = 0;
7363 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7364 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7365 res_ref = (uint64_t)res_var.inner & ~1;
7368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7369 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
7370 CHECK(!val->result_ok);
7371 LDKDecodeError err_var = (*val->contents.err);
7372 uint64_t err_ref = 0;
7373 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7374 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7375 err_ref = (uint64_t)err_var.inner & ~1;
7378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7379 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
7381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7382 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7383 CHECK(val->result_ok);
7384 LDKErrorMessage res_var = (*val->contents.result);
7385 uint64_t res_ref = 0;
7386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7388 res_ref = (uint64_t)res_var.inner & ~1;
7391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7392 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
7393 CHECK(!val->result_ok);
7394 LDKDecodeError err_var = (*val->contents.err);
7395 uint64_t err_ref = 0;
7396 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7397 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7398 err_ref = (uint64_t)err_var.inner & ~1;
7401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7402 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
7404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7405 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7406 CHECK(val->result_ok);
7407 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
7408 uint64_t res_ref = 0;
7409 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7410 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7411 res_ref = (uint64_t)res_var.inner & ~1;
7414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7415 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
7416 CHECK(!val->result_ok);
7417 LDKDecodeError err_var = (*val->contents.err);
7418 uint64_t err_ref = 0;
7419 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7420 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7421 err_ref = (uint64_t)err_var.inner & ~1;
7424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7425 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
7427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7428 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7429 CHECK(val->result_ok);
7430 LDKNodeAnnouncement res_var = (*val->contents.result);
7431 uint64_t res_ref = 0;
7432 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7433 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7434 res_ref = (uint64_t)res_var.inner & ~1;
7437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7438 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
7439 CHECK(!val->result_ok);
7440 LDKDecodeError err_var = (*val->contents.err);
7441 uint64_t err_ref = 0;
7442 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7443 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7444 err_ref = (uint64_t)err_var.inner & ~1;
7447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7448 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
7450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7451 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7452 CHECK(val->result_ok);
7453 LDKQueryShortChannelIds res_var = (*val->contents.result);
7454 uint64_t res_ref = 0;
7455 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7456 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7457 res_ref = (uint64_t)res_var.inner & ~1;
7460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7461 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
7462 CHECK(!val->result_ok);
7463 LDKDecodeError err_var = (*val->contents.err);
7464 uint64_t err_ref = 0;
7465 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7466 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7467 err_ref = (uint64_t)err_var.inner & ~1;
7470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7471 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
7473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7474 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7475 CHECK(val->result_ok);
7476 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
7477 uint64_t res_ref = 0;
7478 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7479 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7480 res_ref = (uint64_t)res_var.inner & ~1;
7483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7484 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
7485 CHECK(!val->result_ok);
7486 LDKDecodeError err_var = (*val->contents.err);
7487 uint64_t err_ref = 0;
7488 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7489 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7490 err_ref = (uint64_t)err_var.inner & ~1;
7493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7494 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
7496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7497 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7498 CHECK(val->result_ok);
7499 LDKQueryChannelRange res_var = (*val->contents.result);
7500 uint64_t res_ref = 0;
7501 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7502 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7503 res_ref = (uint64_t)res_var.inner & ~1;
7506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7507 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
7508 CHECK(!val->result_ok);
7509 LDKDecodeError err_var = (*val->contents.err);
7510 uint64_t err_ref = 0;
7511 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7512 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7513 err_ref = (uint64_t)err_var.inner & ~1;
7516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7517 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
7519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7520 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7521 CHECK(val->result_ok);
7522 LDKReplyChannelRange res_var = (*val->contents.result);
7523 uint64_t res_ref = 0;
7524 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7525 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7526 res_ref = (uint64_t)res_var.inner & ~1;
7529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7530 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7531 CHECK(!val->result_ok);
7532 LDKDecodeError err_var = (*val->contents.err);
7533 uint64_t err_ref = 0;
7534 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7535 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7536 err_ref = (uint64_t)err_var.inner & ~1;
7539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7540 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
7542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7543 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7544 CHECK(val->result_ok);
7545 LDKGossipTimestampFilter res_var = (*val->contents.result);
7546 uint64_t res_ref = 0;
7547 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7548 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7549 res_ref = (uint64_t)res_var.inner & ~1;
7552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7553 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7554 CHECK(!val->result_ok);
7555 LDKDecodeError err_var = (*val->contents.err);
7556 uint64_t err_ref = 0;
7557 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7558 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7559 err_ref = (uint64_t)err_var.inner & ~1;
7562 static jclass LDKSignOrCreationError_SignError_class = NULL;
7563 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
7564 static jclass LDKSignOrCreationError_CreationError_class = NULL;
7565 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
7566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
7567 LDKSignOrCreationError_SignError_class =
7568 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
7569 CHECK(LDKSignOrCreationError_SignError_class != NULL);
7570 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
7571 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
7572 LDKSignOrCreationError_CreationError_class =
7573 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
7574 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
7575 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
7576 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
7578 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7579 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7581 case LDKSignOrCreationError_SignError: {
7582 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
7584 case LDKSignOrCreationError_CreationError: {
7585 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
7586 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
7591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7592 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
7594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7595 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7596 CHECK(val->result_ok);
7597 LDKInvoice res_var = (*val->contents.result);
7598 uint64_t res_ref = 0;
7599 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7600 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7601 res_ref = (uint64_t)res_var.inner & ~1;
7604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7605 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7606 CHECK(!val->result_ok);
7607 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
7610 typedef struct LDKFilter_JCalls {
7611 atomic_size_t refcnt;
7614 jmethodID register_tx_meth;
7615 jmethodID register_output_meth;
7617 static void LDKFilter_JCalls_free(void* this_arg) {
7618 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7619 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7621 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7622 if (get_jenv_res == JNI_EDETACHED) {
7623 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7625 DO_ASSERT(get_jenv_res == JNI_OK);
7627 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7628 if (get_jenv_res == JNI_EDETACHED) {
7629 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7634 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7635 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7637 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7638 if (get_jenv_res == JNI_EDETACHED) {
7639 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7641 DO_ASSERT(get_jenv_res == JNI_OK);
7643 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7644 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7645 LDKu8slice script_pubkey_var = script_pubkey;
7646 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
7647 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
7648 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7650 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
7651 if ((*env)->ExceptionCheck(env)) {
7652 (*env)->ExceptionDescribe(env);
7653 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
7655 if (get_jenv_res == JNI_EDETACHED) {
7656 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7659 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7660 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7662 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7663 if (get_jenv_res == JNI_EDETACHED) {
7664 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7666 DO_ASSERT(get_jenv_res == JNI_OK);
7668 LDKWatchedOutput output_var = output;
7669 uint64_t output_ref = 0;
7670 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7671 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7672 output_ref = (uint64_t)output_var.inner;
7673 if (output_var.is_owned) {
7676 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7678 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7679 if ((*env)->ExceptionCheck(env)) {
7680 (*env)->ExceptionDescribe(env);
7681 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7683 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7684 CHECK_ACCESS(ret_ptr);
7685 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7686 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7687 if (get_jenv_res == JNI_EDETACHED) {
7688 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7692 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7693 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7694 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7696 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7697 jclass c = (*env)->GetObjectClass(env, o);
7699 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7700 atomic_init(&calls->refcnt, 1);
7701 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7702 calls->o = (*env)->NewWeakGlobalRef(env, o);
7703 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7704 CHECK(calls->register_tx_meth != NULL);
7705 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7706 CHECK(calls->register_output_meth != NULL);
7709 .this_arg = (void*) calls,
7710 .register_tx = register_tx_LDKFilter_jcall,
7711 .register_output = register_output_LDKFilter_jcall,
7712 .free = LDKFilter_JCalls_free,
7716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7717 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7718 *res_ptr = LDKFilter_init(env, clz, o);
7719 return (uint64_t)res_ptr;
7721 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) {
7722 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7723 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7724 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7725 unsigned char txid_arr[32];
7726 CHECK((*env)->GetArrayLength(env, txid) == 32);
7727 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7728 unsigned char (*txid_ref)[32] = &txid_arr;
7729 LDKu8slice script_pubkey_ref;
7730 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7731 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7732 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7733 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7737 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7738 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7739 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7740 LDKWatchedOutput output_conv;
7741 output_conv.inner = (void*)(output & (~1));
7742 output_conv.is_owned = (output & 1) || (output == 0);
7743 output_conv = WatchedOutput_clone(&output_conv);
7744 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7745 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7746 uint64_t ret_ref = (uint64_t)ret_copy;
7750 static jclass LDKCOption_FilterZ_Some_class = NULL;
7751 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7752 static jclass LDKCOption_FilterZ_None_class = NULL;
7753 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7755 LDKCOption_FilterZ_Some_class =
7756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7757 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7758 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7759 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7760 LDKCOption_FilterZ_None_class =
7761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7762 CHECK(LDKCOption_FilterZ_None_class != NULL);
7763 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7764 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7766 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7767 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7769 case LDKCOption_FilterZ_Some: {
7770 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7771 *some_ret = obj->some;
7772 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7773 if ((*some_ret).free == LDKFilter_JCalls_free) {
7774 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7775 LDKFilter_JCalls_cloned(&(*some_ret));
7777 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7779 case LDKCOption_FilterZ_None: {
7780 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7786 return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok;
7788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7789 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7790 CHECK(val->result_ok);
7791 LDKLockedChannelMonitor res_var = (*val->contents.result);
7792 uint64_t res_ref = 0;
7793 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7794 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7795 res_ref = (uint64_t)res_var.inner & ~1;
7798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7799 LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1);
7800 CHECK(!val->result_ok);
7801 return *val->contents.err;
7803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
7804 LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ");
7805 ret->datalen = (*env)->GetArrayLength(env, elems);
7806 if (ret->datalen == 0) {
7809 ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data");
7810 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
7811 for (size_t i = 0; i < ret->datalen; i++) {
7812 int64_t arr_elem = java_elems[i];
7813 LDKOutPoint arr_elem_conv;
7814 arr_elem_conv.inner = (void*)(arr_elem & (~1));
7815 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
7816 arr_elem_conv = OutPoint_clone(&arr_elem_conv);
7817 ret->data[i] = arr_elem_conv;
7819 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
7821 return (uint64_t)ret;
7823 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7824 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7825 for (size_t i = 0; i < ret.datalen; i++) {
7826 ret.data[i] = OutPoint_clone(&orig->data[i]);
7830 typedef struct LDKMessageSendEventsProvider_JCalls {
7831 atomic_size_t refcnt;
7834 jmethodID get_and_clear_pending_msg_events_meth;
7835 } LDKMessageSendEventsProvider_JCalls;
7836 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7837 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7838 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7847 if (get_jenv_res == JNI_EDETACHED) {
7848 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7853 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7854 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7856 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7857 if (get_jenv_res == JNI_EDETACHED) {
7858 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7860 DO_ASSERT(get_jenv_res == JNI_OK);
7862 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7864 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7865 if ((*env)->ExceptionCheck(env)) {
7866 (*env)->ExceptionDescribe(env);
7867 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7869 LDKCVec_MessageSendEventZ ret_constr;
7870 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7871 if (ret_constr.datalen > 0)
7872 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7874 ret_constr.data = NULL;
7875 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7876 for (size_t s = 0; s < ret_constr.datalen; s++) {
7877 int64_t ret_conv_18 = ret_vals[s];
7878 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
7879 CHECK_ACCESS(ret_conv_18_ptr);
7880 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7881 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7882 ret_constr.data[s] = ret_conv_18_conv;
7884 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7885 if (get_jenv_res == JNI_EDETACHED) {
7886 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7890 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7891 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7892 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7894 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7895 jclass c = (*env)->GetObjectClass(env, o);
7897 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7898 atomic_init(&calls->refcnt, 1);
7899 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7900 calls->o = (*env)->NewWeakGlobalRef(env, o);
7901 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7902 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7904 LDKMessageSendEventsProvider ret = {
7905 .this_arg = (void*) calls,
7906 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7907 .free = LDKMessageSendEventsProvider_JCalls_free,
7911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7912 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7913 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7914 return (uint64_t)res_ptr;
7916 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7917 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7918 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7919 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7920 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7921 int64_tArray ret_arr = NULL;
7922 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7923 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7924 for (size_t s = 0; s < ret_var.datalen; s++) {
7925 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7926 *ret_conv_18_copy = ret_var.data[s];
7927 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7928 ret_arr_ptr[s] = ret_conv_18_ref;
7930 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7935 typedef struct LDKEventHandler_JCalls {
7936 atomic_size_t refcnt;
7939 jmethodID handle_event_meth;
7940 } LDKEventHandler_JCalls;
7941 static void LDKEventHandler_JCalls_free(void* this_arg) {
7942 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7943 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7945 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7946 if (get_jenv_res == JNI_EDETACHED) {
7947 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7949 DO_ASSERT(get_jenv_res == JNI_OK);
7951 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7952 if (get_jenv_res == JNI_EDETACHED) {
7953 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7958 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7959 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7961 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7962 if (get_jenv_res == JNI_EDETACHED) {
7963 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7965 DO_ASSERT(get_jenv_res == JNI_OK);
7967 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7968 *ret_event = Event_clone(event);
7969 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7971 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7972 if ((*env)->ExceptionCheck(env)) {
7973 (*env)->ExceptionDescribe(env);
7974 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7976 if (get_jenv_res == JNI_EDETACHED) {
7977 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7980 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7981 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7982 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7984 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7985 jclass c = (*env)->GetObjectClass(env, o);
7987 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7988 atomic_init(&calls->refcnt, 1);
7989 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7990 calls->o = (*env)->NewWeakGlobalRef(env, o);
7991 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7992 CHECK(calls->handle_event_meth != NULL);
7994 LDKEventHandler ret = {
7995 .this_arg = (void*) calls,
7996 .handle_event = handle_event_LDKEventHandler_jcall,
7997 .free = LDKEventHandler_JCalls_free,
8001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
8002 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8003 *res_ptr = LDKEventHandler_init(env, clz, o);
8004 return (uint64_t)res_ptr;
8006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
8007 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8008 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8009 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8010 LDKEvent* event_conv = (LDKEvent*)event;
8011 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8014 typedef struct LDKEventsProvider_JCalls {
8015 atomic_size_t refcnt;
8018 jmethodID process_pending_events_meth;
8019 } LDKEventsProvider_JCalls;
8020 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8021 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8022 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8024 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8025 if (get_jenv_res == JNI_EDETACHED) {
8026 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8028 DO_ASSERT(get_jenv_res == JNI_OK);
8030 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8031 if (get_jenv_res == JNI_EDETACHED) {
8032 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8037 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8038 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8040 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8041 if (get_jenv_res == JNI_EDETACHED) {
8042 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8044 DO_ASSERT(get_jenv_res == JNI_OK);
8046 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8047 *handler_ret = handler;
8048 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8050 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
8051 if ((*env)->ExceptionCheck(env)) {
8052 (*env)->ExceptionDescribe(env);
8053 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
8055 if (get_jenv_res == JNI_EDETACHED) {
8056 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8059 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8060 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8061 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8063 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
8064 jclass c = (*env)->GetObjectClass(env, o);
8066 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8067 atomic_init(&calls->refcnt, 1);
8068 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8069 calls->o = (*env)->NewWeakGlobalRef(env, o);
8070 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
8071 CHECK(calls->process_pending_events_meth != NULL);
8073 LDKEventsProvider ret = {
8074 .this_arg = (void*) calls,
8075 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8076 .free = LDKEventsProvider_JCalls_free,
8080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8081 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8082 *res_ptr = LDKEventsProvider_init(env, clz, o);
8083 return (uint64_t)res_ptr;
8085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
8086 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8087 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8088 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8089 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
8090 CHECK_ACCESS(handler_ptr);
8091 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8092 if (handler_conv.free == LDKEventHandler_JCalls_free) {
8093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8094 LDKEventHandler_JCalls_cloned(&handler_conv);
8096 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8099 typedef struct LDKListen_JCalls {
8100 atomic_size_t refcnt;
8103 jmethodID block_connected_meth;
8104 jmethodID block_disconnected_meth;
8106 static void LDKListen_JCalls_free(void* this_arg) {
8107 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8108 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8110 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8111 if (get_jenv_res == JNI_EDETACHED) {
8112 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8114 DO_ASSERT(get_jenv_res == JNI_OK);
8116 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8117 if (get_jenv_res == JNI_EDETACHED) {
8118 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8123 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8124 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8126 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8127 if (get_jenv_res == JNI_EDETACHED) {
8128 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8130 DO_ASSERT(get_jenv_res == JNI_OK);
8132 LDKu8slice block_var = block;
8133 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
8134 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
8135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8137 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
8138 if ((*env)->ExceptionCheck(env)) {
8139 (*env)->ExceptionDescribe(env);
8140 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
8142 if (get_jenv_res == JNI_EDETACHED) {
8143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8146 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8147 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8149 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8150 if (get_jenv_res == JNI_EDETACHED) {
8151 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8153 DO_ASSERT(get_jenv_res == JNI_OK);
8155 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
8156 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
8157 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8159 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
8160 if ((*env)->ExceptionCheck(env)) {
8161 (*env)->ExceptionDescribe(env);
8162 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
8164 if (get_jenv_res == JNI_EDETACHED) {
8165 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8168 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8169 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8170 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8172 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
8173 jclass c = (*env)->GetObjectClass(env, o);
8175 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8176 atomic_init(&calls->refcnt, 1);
8177 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8178 calls->o = (*env)->NewWeakGlobalRef(env, o);
8179 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
8180 CHECK(calls->block_connected_meth != NULL);
8181 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
8182 CHECK(calls->block_disconnected_meth != NULL);
8185 .this_arg = (void*) calls,
8186 .block_connected = block_connected_LDKListen_jcall,
8187 .block_disconnected = block_disconnected_LDKListen_jcall,
8188 .free = LDKListen_JCalls_free,
8192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
8193 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8194 *res_ptr = LDKListen_init(env, clz, o);
8195 return (uint64_t)res_ptr;
8197 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) {
8198 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8199 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8200 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8201 LDKu8slice block_ref;
8202 block_ref.datalen = (*env)->GetArrayLength(env, block);
8203 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
8204 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8205 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
8208 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) {
8209 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8210 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8211 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8212 unsigned char header_arr[80];
8213 CHECK((*env)->GetArrayLength(env, header) == 80);
8214 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8215 unsigned char (*header_ref)[80] = &header_arr;
8216 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8219 typedef struct LDKConfirm_JCalls {
8220 atomic_size_t refcnt;
8223 jmethodID transactions_confirmed_meth;
8224 jmethodID transaction_unconfirmed_meth;
8225 jmethodID best_block_updated_meth;
8226 jmethodID get_relevant_txids_meth;
8227 } LDKConfirm_JCalls;
8228 static void LDKConfirm_JCalls_free(void* this_arg) {
8229 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8230 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8233 if (get_jenv_res == JNI_EDETACHED) {
8234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8236 DO_ASSERT(get_jenv_res == JNI_OK);
8238 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8239 if (get_jenv_res == JNI_EDETACHED) {
8240 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8245 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8246 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8248 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8249 if (get_jenv_res == JNI_EDETACHED) {
8250 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8252 DO_ASSERT(get_jenv_res == JNI_OK);
8254 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
8255 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
8256 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8257 int64_tArray txdata_arr = NULL;
8258 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
8259 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
8260 for (size_t c = 0; c < txdata_var.datalen; c++) {
8261 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8262 *txdata_conv_28_conv = txdata_var.data[c];
8263 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
8265 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
8266 FREE(txdata_var.data);
8267 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8269 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
8270 if ((*env)->ExceptionCheck(env)) {
8271 (*env)->ExceptionDescribe(env);
8272 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
8274 if (get_jenv_res == JNI_EDETACHED) {
8275 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8278 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8279 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8282 if (get_jenv_res == JNI_EDETACHED) {
8283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8285 DO_ASSERT(get_jenv_res == JNI_OK);
8287 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
8288 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
8289 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8291 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
8292 if ((*env)->ExceptionCheck(env)) {
8293 (*env)->ExceptionDescribe(env);
8294 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
8296 if (get_jenv_res == JNI_EDETACHED) {
8297 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8300 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8301 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8303 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8304 if (get_jenv_res == JNI_EDETACHED) {
8305 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8307 DO_ASSERT(get_jenv_res == JNI_OK);
8309 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
8310 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
8311 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8313 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
8314 if ((*env)->ExceptionCheck(env)) {
8315 (*env)->ExceptionDescribe(env);
8316 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
8318 if (get_jenv_res == JNI_EDETACHED) {
8319 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8322 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8323 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8325 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8326 if (get_jenv_res == JNI_EDETACHED) {
8327 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8329 DO_ASSERT(get_jenv_res == JNI_OK);
8331 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8333 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
8334 if ((*env)->ExceptionCheck(env)) {
8335 (*env)->ExceptionDescribe(env);
8336 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
8338 LDKCVec_TxidZ ret_constr;
8339 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8340 if (ret_constr.datalen > 0)
8341 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8343 ret_constr.data = NULL;
8344 for (size_t i = 0; i < ret_constr.datalen; i++) {
8345 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
8346 LDKThirtyTwoBytes ret_conv_8_ref;
8347 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
8348 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
8349 ret_constr.data[i] = ret_conv_8_ref;
8351 if (get_jenv_res == JNI_EDETACHED) {
8352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8356 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8357 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8358 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8360 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
8361 jclass c = (*env)->GetObjectClass(env, o);
8363 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8364 atomic_init(&calls->refcnt, 1);
8365 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8366 calls->o = (*env)->NewWeakGlobalRef(env, o);
8367 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
8368 CHECK(calls->transactions_confirmed_meth != NULL);
8369 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
8370 CHECK(calls->transaction_unconfirmed_meth != NULL);
8371 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
8372 CHECK(calls->best_block_updated_meth != NULL);
8373 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
8374 CHECK(calls->get_relevant_txids_meth != NULL);
8377 .this_arg = (void*) calls,
8378 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8379 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8380 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8381 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8382 .free = LDKConfirm_JCalls_free,
8386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
8387 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8388 *res_ptr = LDKConfirm_init(env, clz, o);
8389 return (uint64_t)res_ptr;
8391 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) {
8392 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8393 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8394 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8395 unsigned char header_arr[80];
8396 CHECK((*env)->GetArrayLength(env, header) == 80);
8397 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8398 unsigned char (*header_ref)[80] = &header_arr;
8399 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8400 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8401 if (txdata_constr.datalen > 0)
8402 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8404 txdata_constr.data = NULL;
8405 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8406 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8407 int64_t txdata_conv_28 = txdata_vals[c];
8408 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
8409 CHECK_ACCESS(txdata_conv_28_ptr);
8410 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8411 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
8412 txdata_constr.data[c] = txdata_conv_28_conv;
8414 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8415 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
8419 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8420 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8421 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8422 unsigned char txid_arr[32];
8423 CHECK((*env)->GetArrayLength(env, txid) == 32);
8424 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
8425 unsigned char (*txid_ref)[32] = &txid_arr;
8426 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8429 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) {
8430 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8431 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8432 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8433 unsigned char header_arr[80];
8434 CHECK((*env)->GetArrayLength(env, header) == 80);
8435 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8436 unsigned char (*header_ref)[80] = &header_arr;
8437 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8440 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
8441 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8442 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8443 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8444 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8445 jobjectArray ret_arr = NULL;
8446 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8448 for (size_t i = 0; i < ret_var.datalen; i++) {
8449 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
8450 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
8451 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
8458 typedef struct LDKPersist_JCalls {
8459 atomic_size_t refcnt;
8462 jmethodID persist_new_channel_meth;
8463 jmethodID update_persisted_channel_meth;
8464 } LDKPersist_JCalls;
8465 static void LDKPersist_JCalls_free(void* this_arg) {
8466 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8467 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8476 if (get_jenv_res == JNI_EDETACHED) {
8477 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8482 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8483 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8485 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8486 if (get_jenv_res == JNI_EDETACHED) {
8487 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8489 DO_ASSERT(get_jenv_res == JNI_OK);
8491 LDKOutPoint channel_id_var = channel_id;
8492 uint64_t channel_id_ref = 0;
8493 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8494 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8495 channel_id_ref = (uint64_t)channel_id_var.inner;
8496 if (channel_id_var.is_owned) {
8497 channel_id_ref |= 1;
8499 LDKChannelMonitor data_var = *data;
8500 uint64_t data_ref = 0;
8501 data_var = ChannelMonitor_clone(data);
8502 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8503 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8504 data_ref = (uint64_t)data_var.inner;
8505 if (data_var.is_owned) {
8508 LDKMonitorUpdateId update_id_var = update_id;
8509 uint64_t update_id_ref = 0;
8510 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8511 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8512 update_id_ref = (uint64_t)update_id_var.inner;
8513 if (update_id_var.is_owned) {
8516 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8518 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
8519 if ((*env)->ExceptionCheck(env)) {
8520 (*env)->ExceptionDescribe(env);
8521 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
8523 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8524 CHECK_ACCESS(ret_ptr);
8525 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8526 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8527 if (get_jenv_res == JNI_EDETACHED) {
8528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8532 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8533 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8535 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8536 if (get_jenv_res == JNI_EDETACHED) {
8537 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8539 DO_ASSERT(get_jenv_res == JNI_OK);
8541 LDKOutPoint channel_id_var = channel_id;
8542 uint64_t channel_id_ref = 0;
8543 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8544 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8545 channel_id_ref = (uint64_t)channel_id_var.inner;
8546 if (channel_id_var.is_owned) {
8547 channel_id_ref |= 1;
8549 LDKChannelMonitorUpdate update_var = *update;
8550 uint64_t update_ref = 0;
8551 if ((uint64_t)update_var.inner > 4096) {
8552 update_var = ChannelMonitorUpdate_clone(update);
8553 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8554 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8555 update_ref = (uint64_t)update_var.inner;
8556 if (update_var.is_owned) {
8560 LDKChannelMonitor data_var = *data;
8561 uint64_t data_ref = 0;
8562 data_var = ChannelMonitor_clone(data);
8563 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8564 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8565 data_ref = (uint64_t)data_var.inner;
8566 if (data_var.is_owned) {
8569 LDKMonitorUpdateId update_id_var = update_id;
8570 uint64_t update_id_ref = 0;
8571 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8572 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8573 update_id_ref = (uint64_t)update_id_var.inner;
8574 if (update_id_var.is_owned) {
8577 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8579 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
8580 if ((*env)->ExceptionCheck(env)) {
8581 (*env)->ExceptionDescribe(env);
8582 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
8584 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8585 CHECK_ACCESS(ret_ptr);
8586 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8587 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
8588 if (get_jenv_res == JNI_EDETACHED) {
8589 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8593 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8594 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8595 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8597 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
8598 jclass c = (*env)->GetObjectClass(env, o);
8600 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8601 atomic_init(&calls->refcnt, 1);
8602 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8603 calls->o = (*env)->NewWeakGlobalRef(env, o);
8604 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
8605 CHECK(calls->persist_new_channel_meth != NULL);
8606 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
8607 CHECK(calls->update_persisted_channel_meth != NULL);
8610 .this_arg = (void*) calls,
8611 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8612 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8613 .free = LDKPersist_JCalls_free,
8617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
8618 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8619 *res_ptr = LDKPersist_init(env, clz, o);
8620 return (uint64_t)res_ptr;
8622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
8623 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8624 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8625 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8626 LDKOutPoint channel_id_conv;
8627 channel_id_conv.inner = (void*)(channel_id & (~1));
8628 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8629 channel_id_conv = OutPoint_clone(&channel_id_conv);
8630 LDKChannelMonitor data_conv;
8631 data_conv.inner = (void*)(data & (~1));
8632 data_conv.is_owned = false;
8633 LDKMonitorUpdateId update_id_conv;
8634 update_id_conv.inner = (void*)(update_id & (~1));
8635 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8636 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8637 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8638 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8639 return (uint64_t)ret_conv;
8642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
8643 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8644 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8645 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8646 LDKOutPoint channel_id_conv;
8647 channel_id_conv.inner = (void*)(channel_id & (~1));
8648 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8649 channel_id_conv = OutPoint_clone(&channel_id_conv);
8650 LDKChannelMonitorUpdate update_conv;
8651 update_conv.inner = (void*)(update & (~1));
8652 update_conv.is_owned = false;
8653 LDKChannelMonitor data_conv;
8654 data_conv.inner = (void*)(data & (~1));
8655 data_conv.is_owned = false;
8656 LDKMonitorUpdateId update_id_conv;
8657 update_id_conv.inner = (void*)(update_id & (~1));
8658 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8659 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8660 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8661 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8662 return (uint64_t)ret_conv;
8665 typedef struct LDKChannelMessageHandler_JCalls {
8666 atomic_size_t refcnt;
8669 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8670 jmethodID handle_open_channel_meth;
8671 jmethodID handle_accept_channel_meth;
8672 jmethodID handle_funding_created_meth;
8673 jmethodID handle_funding_signed_meth;
8674 jmethodID handle_funding_locked_meth;
8675 jmethodID handle_shutdown_meth;
8676 jmethodID handle_closing_signed_meth;
8677 jmethodID handle_update_add_htlc_meth;
8678 jmethodID handle_update_fulfill_htlc_meth;
8679 jmethodID handle_update_fail_htlc_meth;
8680 jmethodID handle_update_fail_malformed_htlc_meth;
8681 jmethodID handle_commitment_signed_meth;
8682 jmethodID handle_revoke_and_ack_meth;
8683 jmethodID handle_update_fee_meth;
8684 jmethodID handle_announcement_signatures_meth;
8685 jmethodID peer_disconnected_meth;
8686 jmethodID peer_connected_meth;
8687 jmethodID handle_channel_reestablish_meth;
8688 jmethodID handle_channel_update_meth;
8689 jmethodID handle_error_meth;
8690 } LDKChannelMessageHandler_JCalls;
8691 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8692 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8693 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8695 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8696 if (get_jenv_res == JNI_EDETACHED) {
8697 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8699 DO_ASSERT(get_jenv_res == JNI_OK);
8701 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8702 if (get_jenv_res == JNI_EDETACHED) {
8703 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8708 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8709 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8712 if (get_jenv_res == JNI_EDETACHED) {
8713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8715 DO_ASSERT(get_jenv_res == JNI_OK);
8717 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8718 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8719 LDKInitFeatures their_features_var = their_features;
8720 uint64_t their_features_ref = 0;
8721 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8722 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8723 their_features_ref = (uint64_t)their_features_var.inner;
8724 if (their_features_var.is_owned) {
8725 their_features_ref |= 1;
8727 LDKOpenChannel msg_var = *msg;
8728 uint64_t msg_ref = 0;
8729 msg_var = OpenChannel_clone(msg);
8730 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8731 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8732 msg_ref = (uint64_t)msg_var.inner;
8733 if (msg_var.is_owned) {
8736 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8738 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8739 if ((*env)->ExceptionCheck(env)) {
8740 (*env)->ExceptionDescribe(env);
8741 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
8743 if (get_jenv_res == JNI_EDETACHED) {
8744 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8747 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8748 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8750 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8751 if (get_jenv_res == JNI_EDETACHED) {
8752 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8754 DO_ASSERT(get_jenv_res == JNI_OK);
8756 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8757 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8758 LDKInitFeatures their_features_var = their_features;
8759 uint64_t their_features_ref = 0;
8760 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8761 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8762 their_features_ref = (uint64_t)their_features_var.inner;
8763 if (their_features_var.is_owned) {
8764 their_features_ref |= 1;
8766 LDKAcceptChannel msg_var = *msg;
8767 uint64_t msg_ref = 0;
8768 msg_var = AcceptChannel_clone(msg);
8769 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8770 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8771 msg_ref = (uint64_t)msg_var.inner;
8772 if (msg_var.is_owned) {
8775 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8777 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8778 if ((*env)->ExceptionCheck(env)) {
8779 (*env)->ExceptionDescribe(env);
8780 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
8782 if (get_jenv_res == JNI_EDETACHED) {
8783 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8786 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8787 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8789 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8790 if (get_jenv_res == JNI_EDETACHED) {
8791 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8793 DO_ASSERT(get_jenv_res == JNI_OK);
8795 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8796 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8797 LDKFundingCreated msg_var = *msg;
8798 uint64_t msg_ref = 0;
8799 msg_var = FundingCreated_clone(msg);
8800 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8801 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8802 msg_ref = (uint64_t)msg_var.inner;
8803 if (msg_var.is_owned) {
8806 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8808 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8809 if ((*env)->ExceptionCheck(env)) {
8810 (*env)->ExceptionDescribe(env);
8811 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8813 if (get_jenv_res == JNI_EDETACHED) {
8814 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8817 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8818 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8820 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8821 if (get_jenv_res == JNI_EDETACHED) {
8822 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8824 DO_ASSERT(get_jenv_res == JNI_OK);
8826 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8827 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8828 LDKFundingSigned msg_var = *msg;
8829 uint64_t msg_ref = 0;
8830 msg_var = FundingSigned_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 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_funding_signed_meth, their_node_id_arr, msg_ref);
8840 if ((*env)->ExceptionCheck(env)) {
8841 (*env)->ExceptionDescribe(env);
8842 (*env)->FatalError(env, "A call to handle_funding_signed 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 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8849 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8851 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8852 if (get_jenv_res == JNI_EDETACHED) {
8853 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8855 DO_ASSERT(get_jenv_res == JNI_OK);
8857 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8858 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8859 LDKFundingLocked msg_var = *msg;
8860 uint64_t msg_ref = 0;
8861 msg_var = FundingLocked_clone(msg);
8862 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8863 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8864 msg_ref = (uint64_t)msg_var.inner;
8865 if (msg_var.is_owned) {
8868 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8870 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8871 if ((*env)->ExceptionCheck(env)) {
8872 (*env)->ExceptionDescribe(env);
8873 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8875 if (get_jenv_res == JNI_EDETACHED) {
8876 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8879 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8880 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8882 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8883 if (get_jenv_res == JNI_EDETACHED) {
8884 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8886 DO_ASSERT(get_jenv_res == JNI_OK);
8888 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8889 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8890 LDKInitFeatures their_features_var = *their_features;
8891 uint64_t their_features_ref = 0;
8892 their_features_var = InitFeatures_clone(their_features);
8893 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8894 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8895 their_features_ref = (uint64_t)their_features_var.inner;
8896 if (their_features_var.is_owned) {
8897 their_features_ref |= 1;
8899 LDKShutdown msg_var = *msg;
8900 uint64_t msg_ref = 0;
8901 msg_var = Shutdown_clone(msg);
8902 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8903 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8904 msg_ref = (uint64_t)msg_var.inner;
8905 if (msg_var.is_owned) {
8908 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8910 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8911 if ((*env)->ExceptionCheck(env)) {
8912 (*env)->ExceptionDescribe(env);
8913 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8915 if (get_jenv_res == JNI_EDETACHED) {
8916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8919 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8920 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8922 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8923 if (get_jenv_res == JNI_EDETACHED) {
8924 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8926 DO_ASSERT(get_jenv_res == JNI_OK);
8928 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8929 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8930 LDKClosingSigned msg_var = *msg;
8931 uint64_t msg_ref = 0;
8932 msg_var = ClosingSigned_clone(msg);
8933 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8934 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8935 msg_ref = (uint64_t)msg_var.inner;
8936 if (msg_var.is_owned) {
8939 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8941 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8942 if ((*env)->ExceptionCheck(env)) {
8943 (*env)->ExceptionDescribe(env);
8944 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8946 if (get_jenv_res == JNI_EDETACHED) {
8947 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8950 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8951 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8953 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8954 if (get_jenv_res == JNI_EDETACHED) {
8955 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8957 DO_ASSERT(get_jenv_res == JNI_OK);
8959 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8960 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8961 LDKUpdateAddHTLC msg_var = *msg;
8962 uint64_t msg_ref = 0;
8963 msg_var = UpdateAddHTLC_clone(msg);
8964 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8965 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8966 msg_ref = (uint64_t)msg_var.inner;
8967 if (msg_var.is_owned) {
8970 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8972 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8973 if ((*env)->ExceptionCheck(env)) {
8974 (*env)->ExceptionDescribe(env);
8975 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8977 if (get_jenv_res == JNI_EDETACHED) {
8978 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8981 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8985 if (get_jenv_res == JNI_EDETACHED) {
8986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8988 DO_ASSERT(get_jenv_res == JNI_OK);
8990 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8991 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8992 LDKUpdateFulfillHTLC msg_var = *msg;
8993 uint64_t msg_ref = 0;
8994 msg_var = UpdateFulfillHTLC_clone(msg);
8995 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8996 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8997 msg_ref = (uint64_t)msg_var.inner;
8998 if (msg_var.is_owned) {
9001 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9003 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
9004 if ((*env)->ExceptionCheck(env)) {
9005 (*env)->ExceptionDescribe(env);
9006 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
9008 if (get_jenv_res == JNI_EDETACHED) {
9009 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9012 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9013 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9015 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9016 if (get_jenv_res == JNI_EDETACHED) {
9017 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9019 DO_ASSERT(get_jenv_res == JNI_OK);
9021 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9022 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9023 LDKUpdateFailHTLC msg_var = *msg;
9024 uint64_t msg_ref = 0;
9025 msg_var = UpdateFailHTLC_clone(msg);
9026 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9027 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9028 msg_ref = (uint64_t)msg_var.inner;
9029 if (msg_var.is_owned) {
9032 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9034 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
9035 if ((*env)->ExceptionCheck(env)) {
9036 (*env)->ExceptionDescribe(env);
9037 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
9039 if (get_jenv_res == JNI_EDETACHED) {
9040 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9043 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9044 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9046 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9047 if (get_jenv_res == JNI_EDETACHED) {
9048 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9050 DO_ASSERT(get_jenv_res == JNI_OK);
9052 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9053 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9054 LDKUpdateFailMalformedHTLC msg_var = *msg;
9055 uint64_t msg_ref = 0;
9056 msg_var = UpdateFailMalformedHTLC_clone(msg);
9057 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9058 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9059 msg_ref = (uint64_t)msg_var.inner;
9060 if (msg_var.is_owned) {
9063 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9065 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
9066 if ((*env)->ExceptionCheck(env)) {
9067 (*env)->ExceptionDescribe(env);
9068 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
9070 if (get_jenv_res == JNI_EDETACHED) {
9071 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9074 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9075 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9077 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9078 if (get_jenv_res == JNI_EDETACHED) {
9079 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9081 DO_ASSERT(get_jenv_res == JNI_OK);
9083 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9084 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9085 LDKCommitmentSigned msg_var = *msg;
9086 uint64_t msg_ref = 0;
9087 msg_var = CommitmentSigned_clone(msg);
9088 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9089 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9090 msg_ref = (uint64_t)msg_var.inner;
9091 if (msg_var.is_owned) {
9094 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9096 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
9097 if ((*env)->ExceptionCheck(env)) {
9098 (*env)->ExceptionDescribe(env);
9099 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
9101 if (get_jenv_res == JNI_EDETACHED) {
9102 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9105 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9106 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9108 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9109 if (get_jenv_res == JNI_EDETACHED) {
9110 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9112 DO_ASSERT(get_jenv_res == JNI_OK);
9114 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9115 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9116 LDKRevokeAndACK msg_var = *msg;
9117 uint64_t msg_ref = 0;
9118 msg_var = RevokeAndACK_clone(msg);
9119 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9120 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9121 msg_ref = (uint64_t)msg_var.inner;
9122 if (msg_var.is_owned) {
9125 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9127 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
9128 if ((*env)->ExceptionCheck(env)) {
9129 (*env)->ExceptionDescribe(env);
9130 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
9132 if (get_jenv_res == JNI_EDETACHED) {
9133 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9136 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9137 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9139 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9140 if (get_jenv_res == JNI_EDETACHED) {
9141 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9143 DO_ASSERT(get_jenv_res == JNI_OK);
9145 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9146 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9147 LDKUpdateFee msg_var = *msg;
9148 uint64_t msg_ref = 0;
9149 msg_var = UpdateFee_clone(msg);
9150 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9151 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9152 msg_ref = (uint64_t)msg_var.inner;
9153 if (msg_var.is_owned) {
9156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9158 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
9159 if ((*env)->ExceptionCheck(env)) {
9160 (*env)->ExceptionDescribe(env);
9161 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
9163 if (get_jenv_res == JNI_EDETACHED) {
9164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9167 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9168 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9170 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9171 if (get_jenv_res == JNI_EDETACHED) {
9172 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9174 DO_ASSERT(get_jenv_res == JNI_OK);
9176 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9177 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9178 LDKAnnouncementSignatures msg_var = *msg;
9179 uint64_t msg_ref = 0;
9180 msg_var = AnnouncementSignatures_clone(msg);
9181 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9182 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9183 msg_ref = (uint64_t)msg_var.inner;
9184 if (msg_var.is_owned) {
9187 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9189 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
9190 if ((*env)->ExceptionCheck(env)) {
9191 (*env)->ExceptionDescribe(env);
9192 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
9194 if (get_jenv_res == JNI_EDETACHED) {
9195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9198 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9199 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9201 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9202 if (get_jenv_res == JNI_EDETACHED) {
9203 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9205 DO_ASSERT(get_jenv_res == JNI_OK);
9207 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9208 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9209 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9211 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
9212 if ((*env)->ExceptionCheck(env)) {
9213 (*env)->ExceptionDescribe(env);
9214 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
9216 if (get_jenv_res == JNI_EDETACHED) {
9217 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9220 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9221 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9223 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9224 if (get_jenv_res == JNI_EDETACHED) {
9225 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9227 DO_ASSERT(get_jenv_res == JNI_OK);
9229 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9230 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9231 LDKInit msg_var = *msg;
9232 uint64_t msg_ref = 0;
9233 msg_var = Init_clone(msg);
9234 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9235 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9236 msg_ref = (uint64_t)msg_var.inner;
9237 if (msg_var.is_owned) {
9240 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9242 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
9243 if ((*env)->ExceptionCheck(env)) {
9244 (*env)->ExceptionDescribe(env);
9245 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
9247 if (get_jenv_res == JNI_EDETACHED) {
9248 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9251 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9252 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9254 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9255 if (get_jenv_res == JNI_EDETACHED) {
9256 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9258 DO_ASSERT(get_jenv_res == JNI_OK);
9260 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9261 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9262 LDKChannelReestablish msg_var = *msg;
9263 uint64_t msg_ref = 0;
9264 msg_var = ChannelReestablish_clone(msg);
9265 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9266 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9267 msg_ref = (uint64_t)msg_var.inner;
9268 if (msg_var.is_owned) {
9271 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9273 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
9274 if ((*env)->ExceptionCheck(env)) {
9275 (*env)->ExceptionDescribe(env);
9276 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
9278 if (get_jenv_res == JNI_EDETACHED) {
9279 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9282 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9283 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9285 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9286 if (get_jenv_res == JNI_EDETACHED) {
9287 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9289 DO_ASSERT(get_jenv_res == JNI_OK);
9291 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9292 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9293 LDKChannelUpdate msg_var = *msg;
9294 uint64_t msg_ref = 0;
9295 msg_var = ChannelUpdate_clone(msg);
9296 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9297 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9298 msg_ref = (uint64_t)msg_var.inner;
9299 if (msg_var.is_owned) {
9302 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9304 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
9305 if ((*env)->ExceptionCheck(env)) {
9306 (*env)->ExceptionDescribe(env);
9307 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
9309 if (get_jenv_res == JNI_EDETACHED) {
9310 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9313 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9314 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9316 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9317 if (get_jenv_res == JNI_EDETACHED) {
9318 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9320 DO_ASSERT(get_jenv_res == JNI_OK);
9322 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9323 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9324 LDKErrorMessage msg_var = *msg;
9325 uint64_t msg_ref = 0;
9326 msg_var = ErrorMessage_clone(msg);
9327 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9328 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9329 msg_ref = (uint64_t)msg_var.inner;
9330 if (msg_var.is_owned) {
9333 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9335 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
9336 if ((*env)->ExceptionCheck(env)) {
9337 (*env)->ExceptionDescribe(env);
9338 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
9340 if (get_jenv_res == JNI_EDETACHED) {
9341 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9344 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9345 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9346 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9347 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9349 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9350 jclass c = (*env)->GetObjectClass(env, o);
9352 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9353 atomic_init(&calls->refcnt, 1);
9354 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9355 calls->o = (*env)->NewWeakGlobalRef(env, o);
9356 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
9357 CHECK(calls->handle_open_channel_meth != NULL);
9358 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
9359 CHECK(calls->handle_accept_channel_meth != NULL);
9360 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
9361 CHECK(calls->handle_funding_created_meth != NULL);
9362 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
9363 CHECK(calls->handle_funding_signed_meth != NULL);
9364 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
9365 CHECK(calls->handle_funding_locked_meth != NULL);
9366 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
9367 CHECK(calls->handle_shutdown_meth != NULL);
9368 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
9369 CHECK(calls->handle_closing_signed_meth != NULL);
9370 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
9371 CHECK(calls->handle_update_add_htlc_meth != NULL);
9372 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
9373 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
9374 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
9375 CHECK(calls->handle_update_fail_htlc_meth != NULL);
9376 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
9377 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
9378 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
9379 CHECK(calls->handle_commitment_signed_meth != NULL);
9380 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
9381 CHECK(calls->handle_revoke_and_ack_meth != NULL);
9382 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
9383 CHECK(calls->handle_update_fee_meth != NULL);
9384 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
9385 CHECK(calls->handle_announcement_signatures_meth != NULL);
9386 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
9387 CHECK(calls->peer_disconnected_meth != NULL);
9388 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
9389 CHECK(calls->peer_connected_meth != NULL);
9390 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
9391 CHECK(calls->handle_channel_reestablish_meth != NULL);
9392 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
9393 CHECK(calls->handle_channel_update_meth != NULL);
9394 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
9395 CHECK(calls->handle_error_meth != NULL);
9397 LDKChannelMessageHandler ret = {
9398 .this_arg = (void*) calls,
9399 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9400 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9401 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9402 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9403 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
9404 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9405 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9406 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9407 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9408 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9409 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9410 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9411 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9412 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9413 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9414 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9415 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9416 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9417 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9418 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9419 .free = LDKChannelMessageHandler_JCalls_free,
9420 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9422 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9426 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9427 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9428 return (uint64_t)res_ptr;
9430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9431 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
9432 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9433 DO_ASSERT((res_ptr & 1) == 0);
9434 return (int64_t)(res_ptr | 1);
9436 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) {
9437 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9438 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9439 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9440 LDKPublicKey their_node_id_ref;
9441 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9442 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9443 LDKInitFeatures their_features_conv;
9444 their_features_conv.inner = (void*)(their_features & (~1));
9445 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9446 their_features_conv = InitFeatures_clone(&their_features_conv);
9447 LDKOpenChannel msg_conv;
9448 msg_conv.inner = (void*)(msg & (~1));
9449 msg_conv.is_owned = false;
9450 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9453 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) {
9454 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9456 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9457 LDKPublicKey their_node_id_ref;
9458 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9459 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9460 LDKInitFeatures their_features_conv;
9461 their_features_conv.inner = (void*)(their_features & (~1));
9462 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
9463 their_features_conv = InitFeatures_clone(&their_features_conv);
9464 LDKAcceptChannel msg_conv;
9465 msg_conv.inner = (void*)(msg & (~1));
9466 msg_conv.is_owned = false;
9467 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9470 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) {
9471 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9472 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9473 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9474 LDKPublicKey their_node_id_ref;
9475 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9476 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9477 LDKFundingCreated msg_conv;
9478 msg_conv.inner = (void*)(msg & (~1));
9479 msg_conv.is_owned = false;
9480 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9483 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) {
9484 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9485 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9486 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9487 LDKPublicKey their_node_id_ref;
9488 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9489 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9490 LDKFundingSigned msg_conv;
9491 msg_conv.inner = (void*)(msg & (~1));
9492 msg_conv.is_owned = false;
9493 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9496 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) {
9497 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9498 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9499 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9500 LDKPublicKey their_node_id_ref;
9501 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9502 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9503 LDKFundingLocked msg_conv;
9504 msg_conv.inner = (void*)(msg & (~1));
9505 msg_conv.is_owned = false;
9506 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9509 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) {
9510 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9511 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9512 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9513 LDKPublicKey their_node_id_ref;
9514 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9515 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9516 LDKInitFeatures their_features_conv;
9517 their_features_conv.inner = (void*)(their_features & (~1));
9518 their_features_conv.is_owned = false;
9519 LDKShutdown msg_conv;
9520 msg_conv.inner = (void*)(msg & (~1));
9521 msg_conv.is_owned = false;
9522 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9525 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) {
9526 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9527 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9528 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9529 LDKPublicKey their_node_id_ref;
9530 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9531 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9532 LDKClosingSigned msg_conv;
9533 msg_conv.inner = (void*)(msg & (~1));
9534 msg_conv.is_owned = false;
9535 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9538 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) {
9539 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9540 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9542 LDKPublicKey their_node_id_ref;
9543 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9544 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9545 LDKUpdateAddHTLC msg_conv;
9546 msg_conv.inner = (void*)(msg & (~1));
9547 msg_conv.is_owned = false;
9548 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9551 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) {
9552 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9553 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9554 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9555 LDKPublicKey their_node_id_ref;
9556 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9557 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9558 LDKUpdateFulfillHTLC msg_conv;
9559 msg_conv.inner = (void*)(msg & (~1));
9560 msg_conv.is_owned = false;
9561 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9564 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) {
9565 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9566 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9567 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9568 LDKPublicKey their_node_id_ref;
9569 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9570 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9571 LDKUpdateFailHTLC msg_conv;
9572 msg_conv.inner = (void*)(msg & (~1));
9573 msg_conv.is_owned = false;
9574 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9577 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) {
9578 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9580 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9581 LDKPublicKey their_node_id_ref;
9582 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9583 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9584 LDKUpdateFailMalformedHTLC msg_conv;
9585 msg_conv.inner = (void*)(msg & (~1));
9586 msg_conv.is_owned = false;
9587 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9590 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) {
9591 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9592 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9593 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9594 LDKPublicKey their_node_id_ref;
9595 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9596 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9597 LDKCommitmentSigned msg_conv;
9598 msg_conv.inner = (void*)(msg & (~1));
9599 msg_conv.is_owned = false;
9600 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9603 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) {
9604 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9607 LDKPublicKey their_node_id_ref;
9608 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9609 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9610 LDKRevokeAndACK msg_conv;
9611 msg_conv.inner = (void*)(msg & (~1));
9612 msg_conv.is_owned = false;
9613 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9616 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) {
9617 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9618 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9619 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9620 LDKPublicKey their_node_id_ref;
9621 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9622 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9623 LDKUpdateFee msg_conv;
9624 msg_conv.inner = (void*)(msg & (~1));
9625 msg_conv.is_owned = false;
9626 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9629 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) {
9630 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9631 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9632 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9633 LDKPublicKey their_node_id_ref;
9634 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9635 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9636 LDKAnnouncementSignatures msg_conv;
9637 msg_conv.inner = (void*)(msg & (~1));
9638 msg_conv.is_owned = false;
9639 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9642 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) {
9643 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9644 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9645 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9646 LDKPublicKey their_node_id_ref;
9647 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9648 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9649 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9652 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) {
9653 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9654 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9655 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9656 LDKPublicKey their_node_id_ref;
9657 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9658 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9660 msg_conv.inner = (void*)(msg & (~1));
9661 msg_conv.is_owned = false;
9662 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9665 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) {
9666 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9667 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9668 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9669 LDKPublicKey their_node_id_ref;
9670 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9671 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9672 LDKChannelReestablish msg_conv;
9673 msg_conv.inner = (void*)(msg & (~1));
9674 msg_conv.is_owned = false;
9675 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9678 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) {
9679 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9680 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9681 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9682 LDKPublicKey their_node_id_ref;
9683 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9684 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9685 LDKChannelUpdate msg_conv;
9686 msg_conv.inner = (void*)(msg & (~1));
9687 msg_conv.is_owned = false;
9688 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9691 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) {
9692 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
9693 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9694 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9695 LDKPublicKey their_node_id_ref;
9696 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9697 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9698 LDKErrorMessage msg_conv;
9699 msg_conv.inner = (void*)(msg & (~1));
9700 msg_conv.is_owned = false;
9701 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9704 typedef struct LDKRoutingMessageHandler_JCalls {
9705 atomic_size_t refcnt;
9708 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9709 jmethodID handle_node_announcement_meth;
9710 jmethodID handle_channel_announcement_meth;
9711 jmethodID handle_channel_update_meth;
9712 jmethodID get_next_channel_announcements_meth;
9713 jmethodID get_next_node_announcements_meth;
9714 jmethodID sync_routing_table_meth;
9715 jmethodID handle_reply_channel_range_meth;
9716 jmethodID handle_reply_short_channel_ids_end_meth;
9717 jmethodID handle_query_channel_range_meth;
9718 jmethodID handle_query_short_channel_ids_meth;
9719 } LDKRoutingMessageHandler_JCalls;
9720 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9721 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9722 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9724 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9725 if (get_jenv_res == JNI_EDETACHED) {
9726 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9728 DO_ASSERT(get_jenv_res == JNI_OK);
9730 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9731 if (get_jenv_res == JNI_EDETACHED) {
9732 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9737 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9738 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9740 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9741 if (get_jenv_res == JNI_EDETACHED) {
9742 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9744 DO_ASSERT(get_jenv_res == JNI_OK);
9746 LDKNodeAnnouncement msg_var = *msg;
9747 uint64_t msg_ref = 0;
9748 msg_var = NodeAnnouncement_clone(msg);
9749 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9750 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9751 msg_ref = (uint64_t)msg_var.inner;
9752 if (msg_var.is_owned) {
9755 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9757 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
9758 if ((*env)->ExceptionCheck(env)) {
9759 (*env)->ExceptionDescribe(env);
9760 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9762 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9763 CHECK_ACCESS(ret_ptr);
9764 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9765 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9766 if (get_jenv_res == JNI_EDETACHED) {
9767 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9771 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9772 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9774 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9775 if (get_jenv_res == JNI_EDETACHED) {
9776 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9778 DO_ASSERT(get_jenv_res == JNI_OK);
9780 LDKChannelAnnouncement msg_var = *msg;
9781 uint64_t msg_ref = 0;
9782 msg_var = ChannelAnnouncement_clone(msg);
9783 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9784 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9785 msg_ref = (uint64_t)msg_var.inner;
9786 if (msg_var.is_owned) {
9789 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9791 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
9792 if ((*env)->ExceptionCheck(env)) {
9793 (*env)->ExceptionDescribe(env);
9794 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9796 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9797 CHECK_ACCESS(ret_ptr);
9798 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9799 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9800 if (get_jenv_res == JNI_EDETACHED) {
9801 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9805 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9806 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9808 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9809 if (get_jenv_res == JNI_EDETACHED) {
9810 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9812 DO_ASSERT(get_jenv_res == JNI_OK);
9814 LDKChannelUpdate msg_var = *msg;
9815 uint64_t msg_ref = 0;
9816 msg_var = ChannelUpdate_clone(msg);
9817 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9818 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9819 msg_ref = (uint64_t)msg_var.inner;
9820 if (msg_var.is_owned) {
9823 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9825 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
9826 if ((*env)->ExceptionCheck(env)) {
9827 (*env)->ExceptionDescribe(env);
9828 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
9830 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9831 CHECK_ACCESS(ret_ptr);
9832 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9833 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9834 if (get_jenv_res == JNI_EDETACHED) {
9835 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9839 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9840 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9842 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9843 if (get_jenv_res == JNI_EDETACHED) {
9844 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9846 DO_ASSERT(get_jenv_res == JNI_OK);
9848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9850 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
9851 if ((*env)->ExceptionCheck(env)) {
9852 (*env)->ExceptionDescribe(env);
9853 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9855 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9856 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9857 if (ret_constr.datalen > 0)
9858 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9860 ret_constr.data = NULL;
9861 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9862 for (size_t h = 0; h < ret_constr.datalen; h++) {
9863 int64_t ret_conv_59 = ret_vals[h];
9864 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
9865 CHECK_ACCESS(ret_conv_59_ptr);
9866 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9867 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
9868 ret_constr.data[h] = ret_conv_59_conv;
9870 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9871 if (get_jenv_res == JNI_EDETACHED) {
9872 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9876 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9877 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9879 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9880 if (get_jenv_res == JNI_EDETACHED) {
9881 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9883 DO_ASSERT(get_jenv_res == JNI_OK);
9885 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9886 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9887 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9889 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9890 if ((*env)->ExceptionCheck(env)) {
9891 (*env)->ExceptionDescribe(env);
9892 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9894 LDKCVec_NodeAnnouncementZ ret_constr;
9895 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9896 if (ret_constr.datalen > 0)
9897 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9899 ret_constr.data = NULL;
9900 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9901 for (size_t s = 0; s < ret_constr.datalen; s++) {
9902 int64_t ret_conv_18 = ret_vals[s];
9903 LDKNodeAnnouncement ret_conv_18_conv;
9904 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9905 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9906 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9907 ret_constr.data[s] = ret_conv_18_conv;
9909 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9910 if (get_jenv_res == JNI_EDETACHED) {
9911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9915 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9916 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9918 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9919 if (get_jenv_res == JNI_EDETACHED) {
9920 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9922 DO_ASSERT(get_jenv_res == JNI_OK);
9924 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9925 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9926 LDKInit init_var = *init;
9927 uint64_t init_ref = 0;
9928 init_var = Init_clone(init);
9929 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9930 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9931 init_ref = (uint64_t)init_var.inner;
9932 if (init_var.is_owned) {
9935 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9937 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9938 if ((*env)->ExceptionCheck(env)) {
9939 (*env)->ExceptionDescribe(env);
9940 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9942 if (get_jenv_res == JNI_EDETACHED) {
9943 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9946 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9947 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9950 if (get_jenv_res == JNI_EDETACHED) {
9951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9953 DO_ASSERT(get_jenv_res == JNI_OK);
9955 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9956 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9957 LDKReplyChannelRange msg_var = msg;
9958 uint64_t msg_ref = 0;
9959 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9960 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9961 msg_ref = (uint64_t)msg_var.inner;
9962 if (msg_var.is_owned) {
9965 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9967 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9968 if ((*env)->ExceptionCheck(env)) {
9969 (*env)->ExceptionDescribe(env);
9970 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9972 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
9973 CHECK_ACCESS(ret_ptr);
9974 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9975 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9976 if (get_jenv_res == JNI_EDETACHED) {
9977 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9981 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9982 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9985 if (get_jenv_res == JNI_EDETACHED) {
9986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9988 DO_ASSERT(get_jenv_res == JNI_OK);
9990 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9991 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9992 LDKReplyShortChannelIdsEnd msg_var = msg;
9993 uint64_t msg_ref = 0;
9994 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9995 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9996 msg_ref = (uint64_t)msg_var.inner;
9997 if (msg_var.is_owned) {
10000 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10001 CHECK(obj != NULL);
10002 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
10003 if ((*env)->ExceptionCheck(env)) {
10004 (*env)->ExceptionDescribe(env);
10005 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
10007 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10008 CHECK_ACCESS(ret_ptr);
10009 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10010 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
10011 if (get_jenv_res == JNI_EDETACHED) {
10012 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10016 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10017 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10020 if (get_jenv_res == JNI_EDETACHED) {
10021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10023 DO_ASSERT(get_jenv_res == JNI_OK);
10025 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10026 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10027 LDKQueryChannelRange msg_var = msg;
10028 uint64_t msg_ref = 0;
10029 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10030 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10031 msg_ref = (uint64_t)msg_var.inner;
10032 if (msg_var.is_owned) {
10035 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10036 CHECK(obj != NULL);
10037 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
10038 if ((*env)->ExceptionCheck(env)) {
10039 (*env)->ExceptionDescribe(env);
10040 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
10042 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10043 CHECK_ACCESS(ret_ptr);
10044 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10045 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
10046 if (get_jenv_res == JNI_EDETACHED) {
10047 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10051 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10052 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10054 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10055 if (get_jenv_res == JNI_EDETACHED) {
10056 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10058 DO_ASSERT(get_jenv_res == JNI_OK);
10060 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10061 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10062 LDKQueryShortChannelIds msg_var = msg;
10063 uint64_t msg_ref = 0;
10064 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10065 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10066 msg_ref = (uint64_t)msg_var.inner;
10067 if (msg_var.is_owned) {
10070 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10071 CHECK(obj != NULL);
10072 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
10073 if ((*env)->ExceptionCheck(env)) {
10074 (*env)->ExceptionDescribe(env);
10075 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
10077 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10078 CHECK_ACCESS(ret_ptr);
10079 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10080 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
10081 if (get_jenv_res == JNI_EDETACHED) {
10082 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10086 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10087 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10088 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10089 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10091 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
10092 jclass c = (*env)->GetObjectClass(env, o);
10094 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10095 atomic_init(&calls->refcnt, 1);
10096 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10097 calls->o = (*env)->NewWeakGlobalRef(env, o);
10098 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
10099 CHECK(calls->handle_node_announcement_meth != NULL);
10100 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
10101 CHECK(calls->handle_channel_announcement_meth != NULL);
10102 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
10103 CHECK(calls->handle_channel_update_meth != NULL);
10104 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
10105 CHECK(calls->get_next_channel_announcements_meth != NULL);
10106 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
10107 CHECK(calls->get_next_node_announcements_meth != NULL);
10108 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
10109 CHECK(calls->sync_routing_table_meth != NULL);
10110 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
10111 CHECK(calls->handle_reply_channel_range_meth != NULL);
10112 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
10113 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
10114 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
10115 CHECK(calls->handle_query_channel_range_meth != NULL);
10116 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
10117 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
10119 LDKRoutingMessageHandler ret = {
10120 .this_arg = (void*) calls,
10121 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10122 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10123 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10124 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
10125 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
10126 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
10127 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10128 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10129 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10130 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10131 .free = LDKRoutingMessageHandler_JCalls_free,
10132 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
10134 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
10138 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10139 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
10140 return (uint64_t)res_ptr;
10142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
10143 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
10144 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
10145 DO_ASSERT((res_ptr & 1) == 0);
10146 return (int64_t)(res_ptr | 1);
10148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
10149 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10150 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10151 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10152 LDKNodeAnnouncement msg_conv;
10153 msg_conv.inner = (void*)(msg & (~1));
10154 msg_conv.is_owned = false;
10155 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10156 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10157 return (uint64_t)ret_conv;
10160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
10161 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10162 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10163 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10164 LDKChannelAnnouncement msg_conv;
10165 msg_conv.inner = (void*)(msg & (~1));
10166 msg_conv.is_owned = false;
10167 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10168 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10169 return (uint64_t)ret_conv;
10172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
10173 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10174 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10175 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10176 LDKChannelUpdate msg_conv;
10177 msg_conv.inner = (void*)(msg & (~1));
10178 msg_conv.is_owned = false;
10179 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10180 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10181 return (uint64_t)ret_conv;
10184 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) {
10185 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10186 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10187 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10188 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
10189 int64_tArray ret_arr = NULL;
10190 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10191 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10192 for (size_t h = 0; h < ret_var.datalen; h++) {
10193 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
10194 *ret_conv_59_conv = ret_var.data[h];
10195 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
10197 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10198 FREE(ret_var.data);
10202 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) {
10203 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10204 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10205 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10206 LDKPublicKey starting_point_ref;
10207 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
10208 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
10209 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
10210 int64_tArray ret_arr = NULL;
10211 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10212 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10213 for (size_t s = 0; s < ret_var.datalen; s++) {
10214 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
10215 uint64_t ret_conv_18_ref = 0;
10216 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10217 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10218 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
10219 if (ret_conv_18_var.is_owned) {
10220 ret_conv_18_ref |= 1;
10222 ret_arr_ptr[s] = ret_conv_18_ref;
10224 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10225 FREE(ret_var.data);
10229 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) {
10230 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10231 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10232 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10233 LDKPublicKey their_node_id_ref;
10234 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10235 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10237 init_conv.inner = (void*)(init & (~1));
10238 init_conv.is_owned = false;
10239 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10242 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) {
10243 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10244 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10245 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10246 LDKPublicKey their_node_id_ref;
10247 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10248 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10249 LDKReplyChannelRange msg_conv;
10250 msg_conv.inner = (void*)(msg & (~1));
10251 msg_conv.is_owned = (msg & 1) || (msg == 0);
10252 msg_conv = ReplyChannelRange_clone(&msg_conv);
10253 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10254 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10255 return (uint64_t)ret_conv;
10258 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) {
10259 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10260 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10261 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10262 LDKPublicKey their_node_id_ref;
10263 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10264 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10265 LDKReplyShortChannelIdsEnd msg_conv;
10266 msg_conv.inner = (void*)(msg & (~1));
10267 msg_conv.is_owned = (msg & 1) || (msg == 0);
10268 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10269 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10270 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10271 return (uint64_t)ret_conv;
10274 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) {
10275 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10276 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10277 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10278 LDKPublicKey their_node_id_ref;
10279 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10280 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10281 LDKQueryChannelRange msg_conv;
10282 msg_conv.inner = (void*)(msg & (~1));
10283 msg_conv.is_owned = (msg & 1) || (msg == 0);
10284 msg_conv = QueryChannelRange_clone(&msg_conv);
10285 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10286 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10287 return (uint64_t)ret_conv;
10290 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) {
10291 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10292 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10293 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10294 LDKPublicKey their_node_id_ref;
10295 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10296 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10297 LDKQueryShortChannelIds msg_conv;
10298 msg_conv.inner = (void*)(msg & (~1));
10299 msg_conv.is_owned = (msg & 1) || (msg == 0);
10300 msg_conv = QueryShortChannelIds_clone(&msg_conv);
10301 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10302 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10303 return (uint64_t)ret_conv;
10306 typedef struct LDKCustomMessageReader_JCalls {
10307 atomic_size_t refcnt;
10310 jmethodID read_meth;
10311 } LDKCustomMessageReader_JCalls;
10312 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10313 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10314 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10316 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10317 if (get_jenv_res == JNI_EDETACHED) {
10318 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10320 DO_ASSERT(get_jenv_res == JNI_OK);
10322 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10323 if (get_jenv_res == JNI_EDETACHED) {
10324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10329 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10330 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10332 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10333 if (get_jenv_res == JNI_EDETACHED) {
10334 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10336 DO_ASSERT(get_jenv_res == JNI_OK);
10338 LDKu8slice buffer_var = buffer;
10339 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
10340 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
10341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10342 CHECK(obj != NULL);
10343 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
10344 if ((*env)->ExceptionCheck(env)) {
10345 (*env)->ExceptionDescribe(env);
10346 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
10348 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10349 CHECK_ACCESS(ret_ptr);
10350 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10351 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
10352 if (get_jenv_res == JNI_EDETACHED) {
10353 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10357 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10358 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10359 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10361 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
10362 jclass c = (*env)->GetObjectClass(env, o);
10364 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10365 atomic_init(&calls->refcnt, 1);
10366 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10367 calls->o = (*env)->NewWeakGlobalRef(env, o);
10368 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
10369 CHECK(calls->read_meth != NULL);
10371 LDKCustomMessageReader ret = {
10372 .this_arg = (void*) calls,
10373 .read = read_LDKCustomMessageReader_jcall,
10374 .free = LDKCustomMessageReader_JCalls_free,
10378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
10379 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10380 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
10381 return (uint64_t)res_ptr;
10383 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) {
10384 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10385 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10386 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10387 LDKu8slice buffer_ref;
10388 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
10389 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
10390 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10391 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10392 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
10393 return (uint64_t)ret_conv;
10396 typedef struct LDKCustomMessageHandler_JCalls {
10397 atomic_size_t refcnt;
10400 LDKCustomMessageReader_JCalls* CustomMessageReader;
10401 jmethodID handle_custom_message_meth;
10402 jmethodID get_and_clear_pending_msg_meth;
10403 } LDKCustomMessageHandler_JCalls;
10404 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10405 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10406 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10408 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10409 if (get_jenv_res == JNI_EDETACHED) {
10410 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10412 DO_ASSERT(get_jenv_res == JNI_OK);
10414 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10415 if (get_jenv_res == JNI_EDETACHED) {
10416 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10421 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10422 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10424 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10425 if (get_jenv_res == JNI_EDETACHED) {
10426 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10428 DO_ASSERT(get_jenv_res == JNI_OK);
10430 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10432 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
10433 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
10434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10435 CHECK(obj != NULL);
10436 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
10437 if ((*env)->ExceptionCheck(env)) {
10438 (*env)->ExceptionDescribe(env);
10439 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
10441 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10442 CHECK_ACCESS(ret_ptr);
10443 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10444 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
10445 if (get_jenv_res == JNI_EDETACHED) {
10446 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10450 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10451 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10453 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10454 if (get_jenv_res == JNI_EDETACHED) {
10455 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10457 DO_ASSERT(get_jenv_res == JNI_OK);
10459 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10460 CHECK(obj != NULL);
10461 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
10462 if ((*env)->ExceptionCheck(env)) {
10463 (*env)->ExceptionDescribe(env);
10464 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
10466 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10467 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10468 if (ret_constr.datalen > 0)
10469 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10471 ret_constr.data = NULL;
10472 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10473 for (size_t z = 0; z < ret_constr.datalen; z++) {
10474 int64_t ret_conv_25 = ret_vals[z];
10475 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
10476 CHECK_ACCESS(ret_conv_25_ptr);
10477 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10478 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
10479 ret_constr.data[z] = ret_conv_25_conv;
10481 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10482 if (get_jenv_res == JNI_EDETACHED) {
10483 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10487 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10488 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10489 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10490 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10492 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
10493 jclass c = (*env)->GetObjectClass(env, o);
10495 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10496 atomic_init(&calls->refcnt, 1);
10497 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10498 calls->o = (*env)->NewWeakGlobalRef(env, o);
10499 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
10500 CHECK(calls->handle_custom_message_meth != NULL);
10501 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
10502 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
10504 LDKCustomMessageHandler ret = {
10505 .this_arg = (void*) calls,
10506 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10507 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10508 .free = LDKCustomMessageHandler_JCalls_free,
10509 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
10511 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
10515 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10516 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
10517 return (uint64_t)res_ptr;
10519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
10520 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
10521 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
10522 DO_ASSERT((res_ptr & 1) == 0);
10523 return (int64_t)(res_ptr | 1);
10525 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) {
10526 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10527 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10528 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10529 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
10530 CHECK_ACCESS(msg_ptr);
10531 LDKType msg_conv = *(LDKType*)(msg_ptr);
10532 if (msg_conv.free == LDKType_JCalls_free) {
10533 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10534 LDKType_JCalls_cloned(&msg_conv);
10536 LDKPublicKey sender_node_id_ref;
10537 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
10538 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
10539 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10540 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10541 return (uint64_t)ret_conv;
10544 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
10545 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10546 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10547 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10548 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10549 int64_tArray ret_arr = NULL;
10550 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10551 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10552 for (size_t z = 0; z < ret_var.datalen; z++) {
10553 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10554 *ret_conv_25_conv = ret_var.data[z];
10555 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
10557 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10558 FREE(ret_var.data);
10562 typedef struct LDKSocketDescriptor_JCalls {
10563 atomic_size_t refcnt;
10566 jmethodID send_data_meth;
10567 jmethodID disconnect_socket_meth;
10569 jmethodID hash_meth;
10570 } LDKSocketDescriptor_JCalls;
10571 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10572 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10573 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10576 if (get_jenv_res == JNI_EDETACHED) {
10577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10579 DO_ASSERT(get_jenv_res == JNI_OK);
10581 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10582 if (get_jenv_res == JNI_EDETACHED) {
10583 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10588 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10589 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10591 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10592 if (get_jenv_res == JNI_EDETACHED) {
10593 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10595 DO_ASSERT(get_jenv_res == JNI_OK);
10597 LDKu8slice data_var = data;
10598 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
10599 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
10600 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10601 CHECK(obj != NULL);
10602 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
10603 if ((*env)->ExceptionCheck(env)) {
10604 (*env)->ExceptionDescribe(env);
10605 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
10607 if (get_jenv_res == JNI_EDETACHED) {
10608 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10612 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10613 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10615 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10616 if (get_jenv_res == JNI_EDETACHED) {
10617 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10619 DO_ASSERT(get_jenv_res == JNI_OK);
10621 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10622 CHECK(obj != NULL);
10623 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
10624 if ((*env)->ExceptionCheck(env)) {
10625 (*env)->ExceptionDescribe(env);
10626 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
10628 if (get_jenv_res == JNI_EDETACHED) {
10629 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10632 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10633 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10635 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10636 if (get_jenv_res == JNI_EDETACHED) {
10637 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10639 DO_ASSERT(get_jenv_res == JNI_OK);
10641 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10642 *other_arg_clone = SocketDescriptor_clone(other_arg);
10643 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10644 CHECK(obj != NULL);
10645 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
10646 if ((*env)->ExceptionCheck(env)) {
10647 (*env)->ExceptionDescribe(env);
10648 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
10650 if (get_jenv_res == JNI_EDETACHED) {
10651 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10655 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10656 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10658 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10659 if (get_jenv_res == JNI_EDETACHED) {
10660 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10662 DO_ASSERT(get_jenv_res == JNI_OK);
10664 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10665 CHECK(obj != NULL);
10666 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
10667 if ((*env)->ExceptionCheck(env)) {
10668 (*env)->ExceptionDescribe(env);
10669 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
10671 if (get_jenv_res == JNI_EDETACHED) {
10672 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10676 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10677 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10678 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10680 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
10681 jclass c = (*env)->GetObjectClass(env, o);
10683 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10684 atomic_init(&calls->refcnt, 1);
10685 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10686 calls->o = (*env)->NewWeakGlobalRef(env, o);
10687 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
10688 CHECK(calls->send_data_meth != NULL);
10689 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
10690 CHECK(calls->disconnect_socket_meth != NULL);
10691 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
10692 CHECK(calls->eq_meth != NULL);
10693 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
10694 CHECK(calls->hash_meth != NULL);
10696 LDKSocketDescriptor ret = {
10697 .this_arg = (void*) calls,
10698 .send_data = send_data_LDKSocketDescriptor_jcall,
10699 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10700 .eq = eq_LDKSocketDescriptor_jcall,
10701 .hash = hash_LDKSocketDescriptor_jcall,
10702 .cloned = LDKSocketDescriptor_JCalls_cloned,
10703 .free = LDKSocketDescriptor_JCalls_free,
10707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
10708 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10709 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
10710 return (uint64_t)res_ptr;
10712 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) {
10713 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10714 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10715 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10716 LDKu8slice data_ref;
10717 data_ref.datalen = (*env)->GetArrayLength(env, data);
10718 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
10719 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10720 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
10724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
10725 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10726 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10727 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10728 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
10732 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10733 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10734 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10735 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
10739 typedef struct LDKScore_JCalls {
10740 atomic_size_t refcnt;
10743 jmethodID channel_penalty_msat_meth;
10744 jmethodID payment_path_failed_meth;
10745 jmethodID write_meth;
10747 static void LDKScore_JCalls_free(void* this_arg) {
10748 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10749 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10751 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10752 if (get_jenv_res == JNI_EDETACHED) {
10753 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10755 DO_ASSERT(get_jenv_res == JNI_OK);
10757 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10758 if (get_jenv_res == JNI_EDETACHED) {
10759 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10764 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) {
10765 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10767 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10768 if (get_jenv_res == JNI_EDETACHED) {
10769 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10771 DO_ASSERT(get_jenv_res == JNI_OK);
10773 LDKNodeId source_var = *source;
10774 uint64_t source_ref = 0;
10775 source_var = NodeId_clone(source);
10776 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10777 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10778 source_ref = (uint64_t)source_var.inner;
10779 if (source_var.is_owned) {
10782 LDKNodeId target_var = *target;
10783 uint64_t target_ref = 0;
10784 target_var = NodeId_clone(target);
10785 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10786 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10787 target_ref = (uint64_t)target_var.inner;
10788 if (target_var.is_owned) {
10791 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10792 CHECK(obj != NULL);
10793 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref);
10794 if ((*env)->ExceptionCheck(env)) {
10795 (*env)->ExceptionDescribe(env);
10796 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
10798 if (get_jenv_res == JNI_EDETACHED) {
10799 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10803 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10804 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10806 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10807 if (get_jenv_res == JNI_EDETACHED) {
10808 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10810 DO_ASSERT(get_jenv_res == JNI_OK);
10812 LDKCVec_RouteHopZ path_var = path;
10813 int64_tArray path_arr = NULL;
10814 path_arr = (*env)->NewLongArray(env, path_var.datalen);
10815 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
10816 for (size_t k = 0; k < path_var.datalen; k++) {
10817 LDKRouteHop path_conv_10_var = path_var.data[k];
10818 uint64_t path_conv_10_ref = 0;
10819 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10820 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10821 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
10822 if (path_conv_10_var.is_owned) {
10823 path_conv_10_ref |= 1;
10825 path_arr_ptr[k] = path_conv_10_ref;
10827 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
10828 FREE(path_var.data);
10829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10830 CHECK(obj != NULL);
10831 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
10832 if ((*env)->ExceptionCheck(env)) {
10833 (*env)->ExceptionDescribe(env);
10834 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
10836 if (get_jenv_res == JNI_EDETACHED) {
10837 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10840 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10841 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10843 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10844 if (get_jenv_res == JNI_EDETACHED) {
10845 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10847 DO_ASSERT(get_jenv_res == JNI_OK);
10849 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10850 CHECK(obj != NULL);
10851 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10852 if ((*env)->ExceptionCheck(env)) {
10853 (*env)->ExceptionDescribe(env);
10854 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
10856 LDKCVec_u8Z ret_ref;
10857 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10858 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10859 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10860 if (get_jenv_res == JNI_EDETACHED) {
10861 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10865 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10866 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10867 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10869 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
10870 jclass c = (*env)->GetObjectClass(env, o);
10872 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10873 atomic_init(&calls->refcnt, 1);
10874 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10875 calls->o = (*env)->NewWeakGlobalRef(env, o);
10876 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
10877 CHECK(calls->channel_penalty_msat_meth != NULL);
10878 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
10879 CHECK(calls->payment_path_failed_meth != NULL);
10880 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10881 CHECK(calls->write_meth != NULL);
10884 .this_arg = (void*) calls,
10885 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10886 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10887 .write = write_LDKScore_jcall,
10888 .free = LDKScore_JCalls_free,
10892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10893 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10894 *res_ptr = LDKScore_init(env, clz, o);
10895 return (uint64_t)res_ptr;
10897 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, int64_t source, int64_t target) {
10898 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10899 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10900 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10901 LDKNodeId source_conv;
10902 source_conv.inner = (void*)(source & (~1));
10903 source_conv.is_owned = false;
10904 LDKNodeId target_conv;
10905 target_conv.inner = (void*)(target & (~1));
10906 target_conv.is_owned = false;
10907 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv);
10911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10912 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10913 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10914 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10915 LDKCVec_RouteHopZ path_constr;
10916 path_constr.datalen = (*env)->GetArrayLength(env, path);
10917 if (path_constr.datalen > 0)
10918 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10920 path_constr.data = NULL;
10921 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10922 for (size_t k = 0; k < path_constr.datalen; k++) {
10923 int64_t path_conv_10 = path_vals[k];
10924 LDKRouteHop path_conv_10_conv;
10925 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
10926 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
10927 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10928 path_constr.data[k] = path_conv_10_conv;
10930 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10931 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10935 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
10936 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10937 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10938 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10939 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10940 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10941 CVec_u8Z_free(ret_var);
10945 typedef struct LDKChannelManagerPersister_JCalls {
10946 atomic_size_t refcnt;
10949 jmethodID persist_manager_meth;
10950 } LDKChannelManagerPersister_JCalls;
10951 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
10952 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10953 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10955 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10956 if (get_jenv_res == JNI_EDETACHED) {
10957 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10959 DO_ASSERT(get_jenv_res == JNI_OK);
10961 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10962 if (get_jenv_res == JNI_EDETACHED) {
10963 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10968 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10969 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
10971 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10972 if (get_jenv_res == JNI_EDETACHED) {
10973 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10975 DO_ASSERT(get_jenv_res == JNI_OK);
10977 LDKChannelManager channel_manager_var = *channel_manager;
10978 uint64_t channel_manager_ref = 0;
10979 // Warning: we may need a move here but no clone is available for LDKChannelManager
10980 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10981 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10982 channel_manager_ref = (uint64_t)channel_manager_var.inner;
10983 if (channel_manager_var.is_owned) {
10984 channel_manager_ref |= 1;
10986 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10987 CHECK(obj != NULL);
10988 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10989 if ((*env)->ExceptionCheck(env)) {
10990 (*env)->ExceptionDescribe(env);
10991 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
10993 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
10994 CHECK_ACCESS(ret_ptr);
10995 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10996 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
10997 if (get_jenv_res == JNI_EDETACHED) {
10998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11002 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
11003 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
11004 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11006 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
11007 jclass c = (*env)->GetObjectClass(env, o);
11009 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
11010 atomic_init(&calls->refcnt, 1);
11011 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11012 calls->o = (*env)->NewWeakGlobalRef(env, o);
11013 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
11014 CHECK(calls->persist_manager_meth != NULL);
11016 LDKChannelManagerPersister ret = {
11017 .this_arg = (void*) calls,
11018 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
11019 .free = LDKChannelManagerPersister_JCalls_free,
11023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
11024 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
11025 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
11026 return (uint64_t)res_ptr;
11028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
11029 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11031 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
11032 LDKChannelManager channel_manager_conv;
11033 channel_manager_conv.inner = (void*)(channel_manager & (~1));
11034 channel_manager_conv.is_owned = false;
11035 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
11036 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
11037 return (uint64_t)ret_conv;
11040 static jclass LDKFallback_SegWitProgram_class = NULL;
11041 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
11042 static jclass LDKFallback_PubKeyHash_class = NULL;
11043 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
11044 static jclass LDKFallback_ScriptHash_class = NULL;
11045 static jmethodID LDKFallback_ScriptHash_meth = NULL;
11046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
11047 LDKFallback_SegWitProgram_class =
11048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
11049 CHECK(LDKFallback_SegWitProgram_class != NULL);
11050 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
11051 CHECK(LDKFallback_SegWitProgram_meth != NULL);
11052 LDKFallback_PubKeyHash_class =
11053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
11054 CHECK(LDKFallback_PubKeyHash_class != NULL);
11055 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
11056 CHECK(LDKFallback_PubKeyHash_meth != NULL);
11057 LDKFallback_ScriptHash_class =
11058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
11059 CHECK(LDKFallback_ScriptHash_class != NULL);
11060 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
11061 CHECK(LDKFallback_ScriptHash_meth != NULL);
11063 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11064 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
11066 case LDKFallback_SegWitProgram: {
11067 uint8_t version_val = obj->seg_wit_program.version._0;
11068 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11069 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
11070 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
11071 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
11073 case LDKFallback_PubKeyHash: {
11074 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
11075 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
11076 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
11078 case LDKFallback_ScriptHash: {
11079 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
11080 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
11081 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
11086 typedef struct LDKPayer_JCalls {
11087 atomic_size_t refcnt;
11090 jmethodID node_id_meth;
11091 jmethodID first_hops_meth;
11092 jmethodID send_payment_meth;
11093 jmethodID retry_payment_meth;
11095 static void LDKPayer_JCalls_free(void* this_arg) {
11096 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11097 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11099 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11100 if (get_jenv_res == JNI_EDETACHED) {
11101 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11103 DO_ASSERT(get_jenv_res == JNI_OK);
11105 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11106 if (get_jenv_res == JNI_EDETACHED) {
11107 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11112 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
11113 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11116 if (get_jenv_res == JNI_EDETACHED) {
11117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11119 DO_ASSERT(get_jenv_res == JNI_OK);
11121 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11122 CHECK(obj != NULL);
11123 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
11124 if ((*env)->ExceptionCheck(env)) {
11125 (*env)->ExceptionDescribe(env);
11126 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
11128 LDKPublicKey ret_ref;
11129 CHECK((*env)->GetArrayLength(env, ret) == 33);
11130 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
11131 if (get_jenv_res == JNI_EDETACHED) {
11132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11136 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
11137 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11139 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11140 if (get_jenv_res == JNI_EDETACHED) {
11141 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11143 DO_ASSERT(get_jenv_res == JNI_OK);
11145 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11146 CHECK(obj != NULL);
11147 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
11148 if ((*env)->ExceptionCheck(env)) {
11149 (*env)->ExceptionDescribe(env);
11150 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
11152 LDKCVec_ChannelDetailsZ ret_constr;
11153 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11154 if (ret_constr.datalen > 0)
11155 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11157 ret_constr.data = NULL;
11158 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11159 for (size_t q = 0; q < ret_constr.datalen; q++) {
11160 int64_t ret_conv_16 = ret_vals[q];
11161 LDKChannelDetails ret_conv_16_conv;
11162 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
11163 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
11164 ret_conv_16_conv = ChannelDetails_clone(&ret_conv_16_conv);
11165 ret_constr.data[q] = ret_conv_16_conv;
11167 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11168 if (get_jenv_res == JNI_EDETACHED) {
11169 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11173 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
11174 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11176 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11177 if (get_jenv_res == JNI_EDETACHED) {
11178 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11180 DO_ASSERT(get_jenv_res == JNI_OK);
11182 LDKRoute route_var = *route;
11183 uint64_t route_ref = 0;
11184 route_var = Route_clone(route);
11185 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11186 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11187 route_ref = (uint64_t)route_var.inner;
11188 if (route_var.is_owned) {
11191 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11192 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
11193 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
11194 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
11195 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11196 CHECK(obj != NULL);
11197 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
11198 if ((*env)->ExceptionCheck(env)) {
11199 (*env)->ExceptionDescribe(env);
11200 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
11202 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11203 CHECK_ACCESS(ret_ptr);
11204 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
11205 ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone((LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)ret) & ~1));
11206 if (get_jenv_res == JNI_EDETACHED) {
11207 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11211 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
11212 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11214 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11215 if (get_jenv_res == JNI_EDETACHED) {
11216 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11218 DO_ASSERT(get_jenv_res == JNI_OK);
11220 LDKRoute route_var = *route;
11221 uint64_t route_ref = 0;
11222 route_var = Route_clone(route);
11223 CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11224 CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11225 route_ref = (uint64_t)route_var.inner;
11226 if (route_var.is_owned) {
11229 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
11230 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
11231 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11232 CHECK(obj != NULL);
11233 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
11234 if ((*env)->ExceptionCheck(env)) {
11235 (*env)->ExceptionDescribe(env);
11236 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
11238 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11239 CHECK_ACCESS(ret_ptr);
11240 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11241 ret_conv = CResult_NonePaymentSendFailureZ_clone((LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)ret) & ~1));
11242 if (get_jenv_res == JNI_EDETACHED) {
11243 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11247 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
11248 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
11249 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11251 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
11252 jclass c = (*env)->GetObjectClass(env, o);
11254 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
11255 atomic_init(&calls->refcnt, 1);
11256 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11257 calls->o = (*env)->NewWeakGlobalRef(env, o);
11258 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
11259 CHECK(calls->node_id_meth != NULL);
11260 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
11261 CHECK(calls->first_hops_meth != NULL);
11262 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
11263 CHECK(calls->send_payment_meth != NULL);
11264 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
11265 CHECK(calls->retry_payment_meth != NULL);
11268 .this_arg = (void*) calls,
11269 .node_id = node_id_LDKPayer_jcall,
11270 .first_hops = first_hops_LDKPayer_jcall,
11271 .send_payment = send_payment_LDKPayer_jcall,
11272 .retry_payment = retry_payment_LDKPayer_jcall,
11273 .free = LDKPayer_JCalls_free,
11277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
11278 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
11279 *res_ptr = LDKPayer_init(env, clz, o);
11280 return (uint64_t)res_ptr;
11282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11283 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11285 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11286 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11287 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
11291 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
11292 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11293 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11294 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11295 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
11296 int64_tArray ret_arr = NULL;
11297 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11298 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11299 for (size_t q = 0; q < ret_var.datalen; q++) {
11300 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11301 uint64_t ret_conv_16_ref = 0;
11302 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11303 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11304 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
11305 if (ret_conv_16_var.is_owned) {
11306 ret_conv_16_ref |= 1;
11308 ret_arr_ptr[q] = ret_conv_16_ref;
11310 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11311 FREE(ret_var.data);
11315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11316 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11317 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11318 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11319 LDKRoute route_conv;
11320 route_conv.inner = (void*)(route & (~1));
11321 route_conv.is_owned = false;
11322 LDKThirtyTwoBytes payment_hash_ref;
11323 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
11324 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
11325 LDKThirtyTwoBytes payment_secret_ref;
11326 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
11327 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
11328 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
11329 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
11330 return (uint64_t)ret_conv;
11333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
11334 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11335 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11336 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11337 LDKRoute route_conv;
11338 route_conv.inner = (void*)(route & (~1));
11339 route_conv.is_owned = false;
11340 LDKThirtyTwoBytes payment_id_ref;
11341 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
11342 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
11343 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11344 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
11345 return (uint64_t)ret_conv;
11348 typedef struct LDKRouter_JCalls {
11349 atomic_size_t refcnt;
11352 jmethodID find_route_meth;
11353 } LDKRouter_JCalls;
11354 static void LDKRouter_JCalls_free(void* this_arg) {
11355 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11356 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11358 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11359 if (get_jenv_res == JNI_EDETACHED) {
11360 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11362 DO_ASSERT(get_jenv_res == JNI_OK);
11364 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11365 if (get_jenv_res == JNI_EDETACHED) {
11366 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11371 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
11372 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11374 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11375 if (get_jenv_res == JNI_EDETACHED) {
11376 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11378 DO_ASSERT(get_jenv_res == JNI_OK);
11380 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
11381 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
11382 LDKRouteParameters params_var = *params;
11383 uint64_t params_ref = 0;
11384 params_var = RouteParameters_clone(params);
11385 CHECK((((uint64_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11386 CHECK((((uint64_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11387 params_ref = (uint64_t)params_var.inner;
11388 if (params_var.is_owned) {
11391 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
11392 int64_tArray first_hops_arr = NULL;
11393 if (first_hops != NULL) {
11394 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
11395 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
11396 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
11397 for (size_t q = 0; q < first_hops_var.datalen; q++) {
11398 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
11399 uint64_t first_hops_conv_16_ref = 0;
11400 CHECK((((uint64_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11401 CHECK((((uint64_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11402 first_hops_conv_16_ref = (uint64_t)first_hops_conv_16_var.inner;
11403 if (first_hops_conv_16_var.is_owned) {
11404 first_hops_conv_16_ref |= 1;
11406 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
11408 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
11410 // WARNING: This object doesn't live past this scope, needs clone!
11411 uint64_t ret_scorer = ((uint64_t)scorer) | 1;
11412 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11413 CHECK(obj != NULL);
11414 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer);
11415 if ((*env)->ExceptionCheck(env)) {
11416 (*env)->ExceptionDescribe(env);
11417 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
11419 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
11420 CHECK_ACCESS(ret_ptr);
11421 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
11422 ret_conv = CResult_RouteLightningErrorZ_clone((LDKCResult_RouteLightningErrorZ*)(((uint64_t)ret) & ~1));
11423 if (get_jenv_res == JNI_EDETACHED) {
11424 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11428 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
11429 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
11430 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11432 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
11433 jclass c = (*env)->GetObjectClass(env, o);
11435 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
11436 atomic_init(&calls->refcnt, 1);
11437 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11438 calls->o = (*env)->NewWeakGlobalRef(env, o);
11439 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
11440 CHECK(calls->find_route_meth != NULL);
11443 .this_arg = (void*) calls,
11444 .find_route = find_route_LDKRouter_jcall,
11445 .free = LDKRouter_JCalls_free,
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
11450 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
11451 *res_ptr = LDKRouter_init(env, clz, o);
11452 return (uint64_t)res_ptr;
11454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int64_tArray first_hops, int64_t scorer) {
11455 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
11456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11457 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11458 LDKPublicKey payer_ref;
11459 CHECK((*env)->GetArrayLength(env, payer) == 33);
11460 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
11461 LDKRouteParameters params_conv;
11462 params_conv.inner = (void*)(params & (~1));
11463 params_conv.is_owned = false;
11464 LDKCVec_ChannelDetailsZ first_hops_constr;
11465 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11466 if (first_hops != NULL) {
11467 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
11468 if (first_hops_constr.datalen > 0)
11469 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11471 first_hops_constr.data = NULL;
11472 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
11473 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11474 int64_t first_hops_conv_16 = first_hops_vals[q];
11475 LDKChannelDetails first_hops_conv_16_conv;
11476 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
11477 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
11478 first_hops_constr.data[q] = first_hops_conv_16_conv;
11480 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
11481 first_hops_ptr = &first_hops_constr;
11483 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
11484 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
11485 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
11486 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11487 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv);
11488 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11489 return (uint64_t)ret_conv;
11492 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
11493 LDKStr ret_str = _ldk_get_compiled_version();
11494 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11499 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
11500 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11501 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11507 LDKTransaction _res_ref;
11508 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11509 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11510 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11511 _res_ref.data_is_owned = true;
11512 Transaction_free(_res_ref);
11515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
11516 LDKCVec_u8Z script_pubkey_ref;
11517 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
11518 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11519 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
11520 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11521 *ret_ref = TxOut_new(script_pubkey_ref, value);
11522 return (uint64_t)ret_ref;
11525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
11526 if ((_res & 1) != 0) return;
11527 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11528 CHECK_ACCESS(_res_ptr);
11529 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11531 TxOut_free(_res_conv);
11534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11535 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
11536 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11537 *ret_ref = TxOut_clone(orig_conv);
11538 return (uint64_t)ret_ref;
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
11542 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11547 LDKSecretKey o_ref;
11548 CHECK((*env)->GetArrayLength(env, o) == 32);
11549 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
11550 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11551 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11552 return (uint64_t)ret_conv;
11555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11556 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11557 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11558 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11559 return (uint64_t)ret_conv;
11562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11563 if ((_res & 1) != 0) return;
11564 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11565 CHECK_ACCESS(_res_ptr);
11566 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11568 CResult_SecretKeyErrorZ_free(_res_conv);
11571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11572 LDKPublicKey o_ref;
11573 CHECK((*env)->GetArrayLength(env, o) == 33);
11574 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
11575 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11576 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11577 return (uint64_t)ret_conv;
11580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11581 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11582 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11583 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11584 return (uint64_t)ret_conv;
11587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11588 if ((_res & 1) != 0) return;
11589 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11590 CHECK_ACCESS(_res_ptr);
11591 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11593 CResult_PublicKeyErrorZ_free(_res_conv);
11596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11597 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
11598 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11599 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11600 return (uint64_t)ret_conv;
11603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11604 LDKTxCreationKeys o_conv;
11605 o_conv.inner = (void*)(o & (~1));
11606 o_conv.is_owned = (o & 1) || (o == 0);
11607 o_conv = TxCreationKeys_clone(&o_conv);
11608 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11609 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11610 return (uint64_t)ret_conv;
11613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11614 LDKDecodeError e_conv;
11615 e_conv.inner = (void*)(e & (~1));
11616 e_conv.is_owned = (e & 1) || (e == 0);
11617 e_conv = DecodeError_clone(&e_conv);
11618 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11619 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11620 return (uint64_t)ret_conv;
11623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11624 if ((_res & 1) != 0) return;
11625 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11626 CHECK_ACCESS(_res_ptr);
11627 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11629 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11633 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
11634 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11635 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11636 return (uint64_t)ret_conv;
11639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11640 LDKChannelPublicKeys o_conv;
11641 o_conv.inner = (void*)(o & (~1));
11642 o_conv.is_owned = (o & 1) || (o == 0);
11643 o_conv = ChannelPublicKeys_clone(&o_conv);
11644 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11645 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11646 return (uint64_t)ret_conv;
11649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11650 LDKDecodeError e_conv;
11651 e_conv.inner = (void*)(e & (~1));
11652 e_conv.is_owned = (e & 1) || (e == 0);
11653 e_conv = DecodeError_clone(&e_conv);
11654 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11655 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11656 return (uint64_t)ret_conv;
11659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11660 if ((_res & 1) != 0) return;
11661 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11662 CHECK_ACCESS(_res_ptr);
11663 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11665 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11669 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
11670 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11671 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11672 return (uint64_t)ret_conv;
11675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11676 LDKTxCreationKeys o_conv;
11677 o_conv.inner = (void*)(o & (~1));
11678 o_conv.is_owned = (o & 1) || (o == 0);
11679 o_conv = TxCreationKeys_clone(&o_conv);
11680 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11681 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11682 return (uint64_t)ret_conv;
11685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11686 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11687 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11688 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11689 return (uint64_t)ret_conv;
11692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11693 if ((_res & 1) != 0) return;
11694 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11695 CHECK_ACCESS(_res_ptr);
11696 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11698 CResult_TxCreationKeysErrorZ_free(_res_conv);
11701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11702 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
11703 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11704 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11705 return (uint64_t)ret_conv;
11708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
11709 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11710 *ret_copy = COption_u32Z_some(o);
11711 uint64_t ret_ref = (uint64_t)ret_copy;
11715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
11716 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11717 *ret_copy = COption_u32Z_none();
11718 uint64_t ret_ref = (uint64_t)ret_copy;
11722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11723 if ((_res & 1) != 0) return;
11724 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11725 CHECK_ACCESS(_res_ptr);
11726 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11728 COption_u32Z_free(_res_conv);
11731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11732 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
11733 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11734 *ret_copy = COption_u32Z_clone(orig_conv);
11735 uint64_t ret_ref = (uint64_t)ret_copy;
11739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11740 LDKHTLCOutputInCommitment o_conv;
11741 o_conv.inner = (void*)(o & (~1));
11742 o_conv.is_owned = (o & 1) || (o == 0);
11743 o_conv = HTLCOutputInCommitment_clone(&o_conv);
11744 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11745 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11746 return (uint64_t)ret_conv;
11749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11750 LDKDecodeError e_conv;
11751 e_conv.inner = (void*)(e & (~1));
11752 e_conv.is_owned = (e & 1) || (e == 0);
11753 e_conv = DecodeError_clone(&e_conv);
11754 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11755 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11756 return (uint64_t)ret_conv;
11759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11760 if ((_res & 1) != 0) return;
11761 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11762 CHECK_ACCESS(_res_ptr);
11763 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11765 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11769 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
11770 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11771 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11772 return (uint64_t)ret_conv;
11775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11776 LDKCounterpartyChannelTransactionParameters o_conv;
11777 o_conv.inner = (void*)(o & (~1));
11778 o_conv.is_owned = (o & 1) || (o == 0);
11779 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11780 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11781 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11782 return (uint64_t)ret_conv;
11785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11786 LDKDecodeError e_conv;
11787 e_conv.inner = (void*)(e & (~1));
11788 e_conv.is_owned = (e & 1) || (e == 0);
11789 e_conv = DecodeError_clone(&e_conv);
11790 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11791 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11792 return (uint64_t)ret_conv;
11795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11796 if ((_res & 1) != 0) return;
11797 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11798 CHECK_ACCESS(_res_ptr);
11799 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11801 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11805 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11806 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11807 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11808 return (uint64_t)ret_conv;
11811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11812 LDKChannelTransactionParameters o_conv;
11813 o_conv.inner = (void*)(o & (~1));
11814 o_conv.is_owned = (o & 1) || (o == 0);
11815 o_conv = ChannelTransactionParameters_clone(&o_conv);
11816 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11817 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11818 return (uint64_t)ret_conv;
11821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11822 LDKDecodeError e_conv;
11823 e_conv.inner = (void*)(e & (~1));
11824 e_conv.is_owned = (e & 1) || (e == 0);
11825 e_conv = DecodeError_clone(&e_conv);
11826 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11827 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11828 return (uint64_t)ret_conv;
11831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11832 if ((_res & 1) != 0) return;
11833 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11834 CHECK_ACCESS(_res_ptr);
11835 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11837 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11841 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11842 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11843 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11844 return (uint64_t)ret_conv;
11847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11848 LDKCVec_SignatureZ _res_constr;
11849 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11850 if (_res_constr.datalen > 0)
11851 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11853 _res_constr.data = NULL;
11854 for (size_t i = 0; i < _res_constr.datalen; i++) {
11855 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11856 LDKSignature _res_conv_8_ref;
11857 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
11858 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
11859 _res_constr.data[i] = _res_conv_8_ref;
11861 CVec_SignatureZ_free(_res_constr);
11864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11865 LDKHolderCommitmentTransaction o_conv;
11866 o_conv.inner = (void*)(o & (~1));
11867 o_conv.is_owned = (o & 1) || (o == 0);
11868 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11869 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11870 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11871 return (uint64_t)ret_conv;
11874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11875 LDKDecodeError e_conv;
11876 e_conv.inner = (void*)(e & (~1));
11877 e_conv.is_owned = (e & 1) || (e == 0);
11878 e_conv = DecodeError_clone(&e_conv);
11879 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11880 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11881 return (uint64_t)ret_conv;
11884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11885 if ((_res & 1) != 0) return;
11886 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11887 CHECK_ACCESS(_res_ptr);
11888 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11890 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11894 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11895 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11896 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11897 return (uint64_t)ret_conv;
11900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11901 LDKBuiltCommitmentTransaction o_conv;
11902 o_conv.inner = (void*)(o & (~1));
11903 o_conv.is_owned = (o & 1) || (o == 0);
11904 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11905 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11906 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11907 return (uint64_t)ret_conv;
11910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11911 LDKDecodeError e_conv;
11912 e_conv.inner = (void*)(e & (~1));
11913 e_conv.is_owned = (e & 1) || (e == 0);
11914 e_conv = DecodeError_clone(&e_conv);
11915 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11916 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11917 return (uint64_t)ret_conv;
11920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11921 if ((_res & 1) != 0) return;
11922 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11923 CHECK_ACCESS(_res_ptr);
11924 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11926 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11930 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11931 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11932 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11933 return (uint64_t)ret_conv;
11936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11937 LDKTrustedClosingTransaction o_conv;
11938 o_conv.inner = (void*)(o & (~1));
11939 o_conv.is_owned = (o & 1) || (o == 0);
11940 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
11941 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11942 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11943 return (uint64_t)ret_conv;
11946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
11947 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11948 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11949 return (uint64_t)ret_conv;
11952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11953 if ((_res & 1) != 0) return;
11954 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11955 CHECK_ACCESS(_res_ptr);
11956 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11958 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11962 LDKCommitmentTransaction o_conv;
11963 o_conv.inner = (void*)(o & (~1));
11964 o_conv.is_owned = (o & 1) || (o == 0);
11965 o_conv = CommitmentTransaction_clone(&o_conv);
11966 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11967 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11968 return (uint64_t)ret_conv;
11971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11972 LDKDecodeError e_conv;
11973 e_conv.inner = (void*)(e & (~1));
11974 e_conv.is_owned = (e & 1) || (e == 0);
11975 e_conv = DecodeError_clone(&e_conv);
11976 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11977 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11978 return (uint64_t)ret_conv;
11981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11982 if ((_res & 1) != 0) return;
11983 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11984 CHECK_ACCESS(_res_ptr);
11985 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11987 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11991 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11992 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11993 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11994 return (uint64_t)ret_conv;
11997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11998 LDKTrustedCommitmentTransaction o_conv;
11999 o_conv.inner = (void*)(o & (~1));
12000 o_conv.is_owned = (o & 1) || (o == 0);
12001 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12002 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12003 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12004 return (uint64_t)ret_conv;
12007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
12008 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12009 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12010 return (uint64_t)ret_conv;
12013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12014 if ((_res & 1) != 0) return;
12015 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12016 CHECK_ACCESS(_res_ptr);
12017 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12019 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
12023 LDKCVec_SignatureZ o_constr;
12024 o_constr.datalen = (*env)->GetArrayLength(env, o);
12025 if (o_constr.datalen > 0)
12026 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12028 o_constr.data = NULL;
12029 for (size_t i = 0; i < o_constr.datalen; i++) {
12030 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
12031 LDKSignature o_conv_8_ref;
12032 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
12033 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
12034 o_constr.data[i] = o_conv_8_ref;
12036 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12037 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12038 return (uint64_t)ret_conv;
12041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
12042 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12043 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12044 return (uint64_t)ret_conv;
12047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12048 if ((_res & 1) != 0) return;
12049 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12050 CHECK_ACCESS(_res_ptr);
12051 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12053 CResult_CVec_SignatureZNoneZ_free(_res_conv);
12056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12057 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
12058 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12059 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12060 return (uint64_t)ret_conv;
12063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12064 LDKShutdownScript o_conv;
12065 o_conv.inner = (void*)(o & (~1));
12066 o_conv.is_owned = (o & 1) || (o == 0);
12067 o_conv = ShutdownScript_clone(&o_conv);
12068 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12069 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12070 return (uint64_t)ret_conv;
12073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12074 LDKDecodeError e_conv;
12075 e_conv.inner = (void*)(e & (~1));
12076 e_conv.is_owned = (e & 1) || (e == 0);
12077 e_conv = DecodeError_clone(&e_conv);
12078 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12079 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12080 return (uint64_t)ret_conv;
12083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12084 if ((_res & 1) != 0) return;
12085 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12086 CHECK_ACCESS(_res_ptr);
12087 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12089 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12093 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
12094 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12095 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12096 return (uint64_t)ret_conv;
12099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12100 LDKShutdownScript o_conv;
12101 o_conv.inner = (void*)(o & (~1));
12102 o_conv.is_owned = (o & 1) || (o == 0);
12103 o_conv = ShutdownScript_clone(&o_conv);
12104 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12105 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12106 return (uint64_t)ret_conv;
12109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12110 LDKInvalidShutdownScript e_conv;
12111 e_conv.inner = (void*)(e & (~1));
12112 e_conv.is_owned = (e & 1) || (e == 0);
12113 e_conv = InvalidShutdownScript_clone(&e_conv);
12114 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12115 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12116 return (uint64_t)ret_conv;
12119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12120 if ((_res & 1) != 0) return;
12121 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12122 CHECK_ACCESS(_res_ptr);
12123 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12125 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12129 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
12130 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12131 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12132 return (uint64_t)ret_conv;
12135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
12136 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12137 *ret_conv = CResult_NoneErrorZ_ok();
12138 return (uint64_t)ret_conv;
12141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12142 LDKIOError e_conv = LDKIOError_from_java(env, e);
12143 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12144 *ret_conv = CResult_NoneErrorZ_err(e_conv);
12145 return (uint64_t)ret_conv;
12148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12149 if ((_res & 1) != 0) return;
12150 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12151 CHECK_ACCESS(_res_ptr);
12152 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
12154 CResult_NoneErrorZ_free(_res_conv);
12157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12158 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
12159 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12160 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
12161 return (uint64_t)ret_conv;
12164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12165 LDKRouteHop o_conv;
12166 o_conv.inner = (void*)(o & (~1));
12167 o_conv.is_owned = (o & 1) || (o == 0);
12168 o_conv = RouteHop_clone(&o_conv);
12169 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12170 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12171 return (uint64_t)ret_conv;
12174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12175 LDKDecodeError e_conv;
12176 e_conv.inner = (void*)(e & (~1));
12177 e_conv.is_owned = (e & 1) || (e == 0);
12178 e_conv = DecodeError_clone(&e_conv);
12179 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12180 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12181 return (uint64_t)ret_conv;
12184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12185 if ((_res & 1) != 0) return;
12186 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12187 CHECK_ACCESS(_res_ptr);
12188 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12190 CResult_RouteHopDecodeErrorZ_free(_res_conv);
12193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12194 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
12195 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12196 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12197 return (uint64_t)ret_conv;
12200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12201 LDKCVec_RouteHopZ _res_constr;
12202 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12203 if (_res_constr.datalen > 0)
12204 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12206 _res_constr.data = NULL;
12207 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12208 for (size_t k = 0; k < _res_constr.datalen; k++) {
12209 int64_t _res_conv_10 = _res_vals[k];
12210 LDKRouteHop _res_conv_10_conv;
12211 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
12212 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
12213 _res_constr.data[k] = _res_conv_10_conv;
12215 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12216 CVec_RouteHopZ_free(_res_constr);
12219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12220 LDKCVec_CVec_RouteHopZZ _res_constr;
12221 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12222 if (_res_constr.datalen > 0)
12223 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12225 _res_constr.data = NULL;
12226 for (size_t m = 0; m < _res_constr.datalen; m++) {
12227 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
12228 LDKCVec_RouteHopZ _res_conv_12_constr;
12229 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
12230 if (_res_conv_12_constr.datalen > 0)
12231 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12233 _res_conv_12_constr.data = NULL;
12234 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
12235 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12236 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12237 LDKRouteHop _res_conv_12_conv_10_conv;
12238 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
12239 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
12240 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12242 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
12243 _res_constr.data[m] = _res_conv_12_constr;
12245 CVec_CVec_RouteHopZZ_free(_res_constr);
12248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12250 o_conv.inner = (void*)(o & (~1));
12251 o_conv.is_owned = (o & 1) || (o == 0);
12252 o_conv = Route_clone(&o_conv);
12253 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12254 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12255 return (uint64_t)ret_conv;
12258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12259 LDKDecodeError e_conv;
12260 e_conv.inner = (void*)(e & (~1));
12261 e_conv.is_owned = (e & 1) || (e == 0);
12262 e_conv = DecodeError_clone(&e_conv);
12263 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12264 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12265 return (uint64_t)ret_conv;
12268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12269 if ((_res & 1) != 0) return;
12270 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12271 CHECK_ACCESS(_res_ptr);
12272 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12274 CResult_RouteDecodeErrorZ_free(_res_conv);
12277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12278 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
12279 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12280 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12281 return (uint64_t)ret_conv;
12284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12285 LDKRouteParameters o_conv;
12286 o_conv.inner = (void*)(o & (~1));
12287 o_conv.is_owned = (o & 1) || (o == 0);
12288 o_conv = RouteParameters_clone(&o_conv);
12289 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12290 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12291 return (uint64_t)ret_conv;
12294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12295 LDKDecodeError e_conv;
12296 e_conv.inner = (void*)(e & (~1));
12297 e_conv.is_owned = (e & 1) || (e == 0);
12298 e_conv = DecodeError_clone(&e_conv);
12299 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12300 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12301 return (uint64_t)ret_conv;
12304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12305 if ((_res & 1) != 0) return;
12306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12307 CHECK_ACCESS(_res_ptr);
12308 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12310 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12314 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
12315 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12316 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12317 return (uint64_t)ret_conv;
12320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12321 LDKCVec_RouteHintZ _res_constr;
12322 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12323 if (_res_constr.datalen > 0)
12324 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12326 _res_constr.data = NULL;
12327 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12328 for (size_t l = 0; l < _res_constr.datalen; l++) {
12329 int64_t _res_conv_11 = _res_vals[l];
12330 LDKRouteHint _res_conv_11_conv;
12331 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
12332 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
12333 _res_constr.data[l] = _res_conv_11_conv;
12335 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12336 CVec_RouteHintZ_free(_res_constr);
12339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
12340 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12341 *ret_copy = COption_u64Z_some(o);
12342 uint64_t ret_ref = (uint64_t)ret_copy;
12346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
12347 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12348 *ret_copy = COption_u64Z_none();
12349 uint64_t ret_ref = (uint64_t)ret_copy;
12353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12354 if ((_res & 1) != 0) return;
12355 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12356 CHECK_ACCESS(_res_ptr);
12357 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12359 COption_u64Z_free(_res_conv);
12362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12363 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
12364 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12365 *ret_copy = COption_u64Z_clone(orig_conv);
12366 uint64_t ret_ref = (uint64_t)ret_copy;
12370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12372 o_conv.inner = (void*)(o & (~1));
12373 o_conv.is_owned = (o & 1) || (o == 0);
12374 o_conv = Payee_clone(&o_conv);
12375 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12376 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
12377 return (uint64_t)ret_conv;
12380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12381 LDKDecodeError e_conv;
12382 e_conv.inner = (void*)(e & (~1));
12383 e_conv.is_owned = (e & 1) || (e == 0);
12384 e_conv = DecodeError_clone(&e_conv);
12385 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12386 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
12387 return (uint64_t)ret_conv;
12390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12391 if ((_res & 1) != 0) return;
12392 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12393 CHECK_ACCESS(_res_ptr);
12394 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
12396 CResult_PayeeDecodeErrorZ_free(_res_conv);
12399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12400 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
12401 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
12402 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
12403 return (uint64_t)ret_conv;
12406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12407 LDKCVec_RouteHintHopZ _res_constr;
12408 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12409 if (_res_constr.datalen > 0)
12410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12412 _res_constr.data = NULL;
12413 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12414 for (size_t o = 0; o < _res_constr.datalen; o++) {
12415 int64_t _res_conv_14 = _res_vals[o];
12416 LDKRouteHintHop _res_conv_14_conv;
12417 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12418 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12419 _res_constr.data[o] = _res_conv_14_conv;
12421 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12422 CVec_RouteHintHopZ_free(_res_constr);
12425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12426 LDKRouteHint o_conv;
12427 o_conv.inner = (void*)(o & (~1));
12428 o_conv.is_owned = (o & 1) || (o == 0);
12429 o_conv = RouteHint_clone(&o_conv);
12430 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12431 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12432 return (uint64_t)ret_conv;
12435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12436 LDKDecodeError e_conv;
12437 e_conv.inner = (void*)(e & (~1));
12438 e_conv.is_owned = (e & 1) || (e == 0);
12439 e_conv = DecodeError_clone(&e_conv);
12440 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12441 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12442 return (uint64_t)ret_conv;
12445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12446 if ((_res & 1) != 0) return;
12447 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12448 CHECK_ACCESS(_res_ptr);
12449 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12451 CResult_RouteHintDecodeErrorZ_free(_res_conv);
12454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12455 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
12456 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12457 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12458 return (uint64_t)ret_conv;
12461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12462 LDKRouteHintHop o_conv;
12463 o_conv.inner = (void*)(o & (~1));
12464 o_conv.is_owned = (o & 1) || (o == 0);
12465 o_conv = RouteHintHop_clone(&o_conv);
12466 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12467 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12468 return (uint64_t)ret_conv;
12471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12472 LDKDecodeError e_conv;
12473 e_conv.inner = (void*)(e & (~1));
12474 e_conv.is_owned = (e & 1) || (e == 0);
12475 e_conv = DecodeError_clone(&e_conv);
12476 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12477 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12478 return (uint64_t)ret_conv;
12481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12482 if ((_res & 1) != 0) return;
12483 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12484 CHECK_ACCESS(_res_ptr);
12485 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12487 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12491 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
12492 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12493 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12494 return (uint64_t)ret_conv;
12497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12498 LDKCVec_ChannelDetailsZ _res_constr;
12499 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12500 if (_res_constr.datalen > 0)
12501 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12503 _res_constr.data = NULL;
12504 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12505 for (size_t q = 0; q < _res_constr.datalen; q++) {
12506 int64_t _res_conv_16 = _res_vals[q];
12507 LDKChannelDetails _res_conv_16_conv;
12508 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12509 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12510 _res_constr.data[q] = _res_conv_16_conv;
12512 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12513 CVec_ChannelDetailsZ_free(_res_constr);
12516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12518 o_conv.inner = (void*)(o & (~1));
12519 o_conv.is_owned = (o & 1) || (o == 0);
12520 o_conv = Route_clone(&o_conv);
12521 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12522 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12523 return (uint64_t)ret_conv;
12526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12527 LDKLightningError e_conv;
12528 e_conv.inner = (void*)(e & (~1));
12529 e_conv.is_owned = (e & 1) || (e == 0);
12530 e_conv = LightningError_clone(&e_conv);
12531 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12532 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12533 return (uint64_t)ret_conv;
12536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12537 if ((_res & 1) != 0) return;
12538 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12539 CHECK_ACCESS(_res_ptr);
12540 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12542 CResult_RouteLightningErrorZ_free(_res_conv);
12545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12546 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12547 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12548 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12549 return (uint64_t)ret_conv;
12552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12553 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12554 CHECK_ACCESS(o_ptr);
12555 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12556 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
12557 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12558 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12559 return (uint64_t)ret_conv;
12562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12563 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
12564 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12565 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12566 return (uint64_t)ret_conv;
12569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12570 if ((_res & 1) != 0) return;
12571 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12572 CHECK_ACCESS(_res_ptr);
12573 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12575 CResult_TxOutAccessErrorZ_free(_res_conv);
12578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12579 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
12580 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12581 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12582 return (uint64_t)ret_conv;
12585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12586 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12587 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12588 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12589 return ((uint64_t)ret_conv);
12592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
12593 LDKTransaction b_ref;
12594 b_ref.datalen = (*env)->GetArrayLength(env, b);
12595 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12596 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12597 b_ref.data_is_owned = true;
12598 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12599 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12600 return ((uint64_t)ret_conv);
12603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12604 if ((_res & 1) != 0) return;
12605 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12606 CHECK_ACCESS(_res_ptr);
12607 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12609 C2Tuple_usizeTransactionZ_free(_res_conv);
12612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12613 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12614 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12615 if (_res_constr.datalen > 0)
12616 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12618 _res_constr.data = NULL;
12619 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12620 for (size_t c = 0; c < _res_constr.datalen; c++) {
12621 int64_t _res_conv_28 = _res_vals[c];
12622 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
12623 CHECK_ACCESS(_res_conv_28_ptr);
12624 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12625 FREE((void*)_res_conv_28);
12626 _res_constr.data[c] = _res_conv_28_conv;
12628 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12629 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12633 LDKCVec_TxidZ _res_constr;
12634 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12635 if (_res_constr.datalen > 0)
12636 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12638 _res_constr.data = NULL;
12639 for (size_t i = 0; i < _res_constr.datalen; i++) {
12640 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12641 LDKThirtyTwoBytes _res_conv_8_ref;
12642 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
12643 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
12644 _res_constr.data[i] = _res_conv_8_ref;
12646 CVec_TxidZ_free(_res_constr);
12649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
12650 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12651 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12652 return (uint64_t)ret_conv;
12655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
12656 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
12657 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12658 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
12659 return (uint64_t)ret_conv;
12662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12663 if ((_res & 1) != 0) return;
12664 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12665 CHECK_ACCESS(_res_ptr);
12666 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
12668 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
12671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12672 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
12673 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12674 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
12675 return (uint64_t)ret_conv;
12678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12679 LDKCVec_MonitorEventZ _res_constr;
12680 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12681 if (_res_constr.datalen > 0)
12682 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12684 _res_constr.data = NULL;
12685 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12686 for (size_t o = 0; o < _res_constr.datalen; o++) {
12687 int64_t _res_conv_14 = _res_vals[o];
12688 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
12689 CHECK_ACCESS(_res_conv_14_ptr);
12690 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
12691 FREE((void*)_res_conv_14);
12692 _res_constr.data[o] = _res_conv_14_conv;
12694 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12695 CVec_MonitorEventZ_free(_res_constr);
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
12699 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12700 CHECK_ACCESS(o_ptr);
12701 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
12702 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
12703 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12704 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
12705 uint64_t ret_ref = (uint64_t)ret_copy;
12709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
12710 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12711 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
12712 uint64_t ret_ref = (uint64_t)ret_copy;
12716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12717 if ((_res & 1) != 0) return;
12718 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12719 CHECK_ACCESS(_res_ptr);
12720 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
12722 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
12725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12726 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
12727 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12728 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
12729 uint64_t ret_ref = (uint64_t)ret_copy;
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
12734 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12735 CHECK_ACCESS(o_ptr);
12736 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12737 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
12738 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12739 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12740 uint64_t ret_ref = (uint64_t)ret_copy;
12744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
12745 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12746 *ret_copy = COption_NetworkUpdateZ_none();
12747 uint64_t ret_ref = (uint64_t)ret_copy;
12751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12752 if ((_res & 1) != 0) return;
12753 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12754 CHECK_ACCESS(_res_ptr);
12755 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12757 COption_NetworkUpdateZ_free(_res_conv);
12760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12761 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12762 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12763 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12764 uint64_t ret_ref = (uint64_t)ret_copy;
12768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12769 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12770 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12771 if (_res_constr.datalen > 0)
12772 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12774 _res_constr.data = NULL;
12775 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12776 for (size_t b = 0; b < _res_constr.datalen; b++) {
12777 int64_t _res_conv_27 = _res_vals[b];
12778 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
12779 CHECK_ACCESS(_res_conv_27_ptr);
12780 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12781 FREE((void*)_res_conv_27);
12782 _res_constr.data[b] = _res_conv_27_conv;
12784 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12785 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12789 LDKCVec_MessageSendEventZ _res_constr;
12790 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12791 if (_res_constr.datalen > 0)
12792 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12794 _res_constr.data = NULL;
12795 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12796 for (size_t s = 0; s < _res_constr.datalen; s++) {
12797 int64_t _res_conv_18 = _res_vals[s];
12798 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
12799 CHECK_ACCESS(_res_conv_18_ptr);
12800 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12801 FREE((void*)_res_conv_18);
12802 _res_constr.data[s] = _res_conv_18_conv;
12804 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12805 CVec_MessageSendEventZ_free(_res_constr);
12808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12809 LDKInitFeatures o_conv;
12810 o_conv.inner = (void*)(o & (~1));
12811 o_conv.is_owned = (o & 1) || (o == 0);
12812 o_conv = InitFeatures_clone(&o_conv);
12813 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12814 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12815 return (uint64_t)ret_conv;
12818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12819 LDKDecodeError e_conv;
12820 e_conv.inner = (void*)(e & (~1));
12821 e_conv.is_owned = (e & 1) || (e == 0);
12822 e_conv = DecodeError_clone(&e_conv);
12823 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12824 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12825 return (uint64_t)ret_conv;
12828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12829 if ((_res & 1) != 0) return;
12830 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12831 CHECK_ACCESS(_res_ptr);
12832 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12834 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12838 LDKNodeFeatures o_conv;
12839 o_conv.inner = (void*)(o & (~1));
12840 o_conv.is_owned = (o & 1) || (o == 0);
12841 o_conv = NodeFeatures_clone(&o_conv);
12842 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12843 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12844 return (uint64_t)ret_conv;
12847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12848 LDKDecodeError e_conv;
12849 e_conv.inner = (void*)(e & (~1));
12850 e_conv.is_owned = (e & 1) || (e == 0);
12851 e_conv = DecodeError_clone(&e_conv);
12852 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12853 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12854 return (uint64_t)ret_conv;
12857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12858 if ((_res & 1) != 0) return;
12859 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12860 CHECK_ACCESS(_res_ptr);
12861 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12863 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12867 LDKChannelFeatures o_conv;
12868 o_conv.inner = (void*)(o & (~1));
12869 o_conv.is_owned = (o & 1) || (o == 0);
12870 o_conv = ChannelFeatures_clone(&o_conv);
12871 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12872 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12873 return (uint64_t)ret_conv;
12876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12877 LDKDecodeError e_conv;
12878 e_conv.inner = (void*)(e & (~1));
12879 e_conv.is_owned = (e & 1) || (e == 0);
12880 e_conv = DecodeError_clone(&e_conv);
12881 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12882 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12883 return (uint64_t)ret_conv;
12886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12887 if ((_res & 1) != 0) return;
12888 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12889 CHECK_ACCESS(_res_ptr);
12890 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12892 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12896 LDKInvoiceFeatures o_conv;
12897 o_conv.inner = (void*)(o & (~1));
12898 o_conv.is_owned = (o & 1) || (o == 0);
12899 o_conv = InvoiceFeatures_clone(&o_conv);
12900 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12901 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12902 return (uint64_t)ret_conv;
12905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12906 LDKDecodeError e_conv;
12907 e_conv.inner = (void*)(e & (~1));
12908 e_conv.is_owned = (e & 1) || (e == 0);
12909 e_conv = DecodeError_clone(&e_conv);
12910 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12911 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12912 return (uint64_t)ret_conv;
12915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12916 if ((_res & 1) != 0) return;
12917 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12918 CHECK_ACCESS(_res_ptr);
12919 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12921 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12925 LDKScoringParameters o_conv;
12926 o_conv.inner = (void*)(o & (~1));
12927 o_conv.is_owned = (o & 1) || (o == 0);
12928 // Warning: we need a move here but no clone is available for LDKScoringParameters
12929 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12930 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12931 return (uint64_t)ret_conv;
12934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12935 LDKDecodeError e_conv;
12936 e_conv.inner = (void*)(e & (~1));
12937 e_conv.is_owned = (e & 1) || (e == 0);
12938 e_conv = DecodeError_clone(&e_conv);
12939 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12940 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12941 return (uint64_t)ret_conv;
12944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12945 if ((_res & 1) != 0) return;
12946 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12947 CHECK_ACCESS(_res_ptr);
12948 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12950 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12955 o_conv.inner = (void*)(o & (~1));
12956 o_conv.is_owned = (o & 1) || (o == 0);
12957 // Warning: we need a move here but no clone is available for LDKScorer
12958 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12959 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
12960 return (uint64_t)ret_conv;
12963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12964 LDKDecodeError e_conv;
12965 e_conv.inner = (void*)(e & (~1));
12966 e_conv.is_owned = (e & 1) || (e == 0);
12967 e_conv = DecodeError_clone(&e_conv);
12968 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12969 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
12970 return (uint64_t)ret_conv;
12973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12974 if ((_res & 1) != 0) return;
12975 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12976 CHECK_ACCESS(_res_ptr);
12977 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
12979 CResult_ScorerDecodeErrorZ_free(_res_conv);
12982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12983 LDKDelayedPaymentOutputDescriptor o_conv;
12984 o_conv.inner = (void*)(o & (~1));
12985 o_conv.is_owned = (o & 1) || (o == 0);
12986 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
12987 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12988 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
12989 return (uint64_t)ret_conv;
12992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12993 LDKDecodeError e_conv;
12994 e_conv.inner = (void*)(e & (~1));
12995 e_conv.is_owned = (e & 1) || (e == 0);
12996 e_conv = DecodeError_clone(&e_conv);
12997 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12998 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
12999 return (uint64_t)ret_conv;
13002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13003 if ((_res & 1) != 0) return;
13004 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13005 CHECK_ACCESS(_res_ptr);
13006 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13008 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13012 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13013 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13014 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13015 return (uint64_t)ret_conv;
13018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13019 LDKStaticPaymentOutputDescriptor o_conv;
13020 o_conv.inner = (void*)(o & (~1));
13021 o_conv.is_owned = (o & 1) || (o == 0);
13022 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
13023 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13024 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13025 return (uint64_t)ret_conv;
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13029 LDKDecodeError e_conv;
13030 e_conv.inner = (void*)(e & (~1));
13031 e_conv.is_owned = (e & 1) || (e == 0);
13032 e_conv = DecodeError_clone(&e_conv);
13033 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13034 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13035 return (uint64_t)ret_conv;
13038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13039 if ((_res & 1) != 0) return;
13040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13041 CHECK_ACCESS(_res_ptr);
13042 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13044 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13048 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13049 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13050 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13051 return (uint64_t)ret_conv;
13054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13055 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13056 CHECK_ACCESS(o_ptr);
13057 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
13058 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
13059 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13060 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
13061 return (uint64_t)ret_conv;
13064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13065 LDKDecodeError e_conv;
13066 e_conv.inner = (void*)(e & (~1));
13067 e_conv.is_owned = (e & 1) || (e == 0);
13068 e_conv = DecodeError_clone(&e_conv);
13069 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13070 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
13071 return (uint64_t)ret_conv;
13074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13075 if ((_res & 1) != 0) return;
13076 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13077 CHECK_ACCESS(_res_ptr);
13078 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
13080 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
13083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13084 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
13085 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13086 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
13087 return (uint64_t)ret_conv;
13090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13091 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13092 *ret_conv = CResult_NoneNoneZ_ok();
13093 return (uint64_t)ret_conv;
13096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13097 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13098 *ret_conv = CResult_NoneNoneZ_err();
13099 return (uint64_t)ret_conv;
13102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13103 if ((_res & 1) != 0) return;
13104 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13105 CHECK_ACCESS(_res_ptr);
13106 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13108 CResult_NoneNoneZ_free(_res_conv);
13111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13112 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
13113 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13114 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13115 return (uint64_t)ret_conv;
13118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13119 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
13120 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13121 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
13122 return ((uint64_t)ret_conv);
13125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
13126 LDKSignature a_ref;
13127 CHECK((*env)->GetArrayLength(env, a) == 64);
13128 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
13129 LDKCVec_SignatureZ b_constr;
13130 b_constr.datalen = (*env)->GetArrayLength(env, b);
13131 if (b_constr.datalen > 0)
13132 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13134 b_constr.data = NULL;
13135 for (size_t i = 0; i < b_constr.datalen; i++) {
13136 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
13137 LDKSignature b_conv_8_ref;
13138 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
13139 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
13140 b_constr.data[i] = b_conv_8_ref;
13142 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13143 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
13144 return ((uint64_t)ret_conv);
13147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13148 if ((_res & 1) != 0) return;
13149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13150 CHECK_ACCESS(_res_ptr);
13151 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
13153 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
13156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13157 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13158 CHECK_ACCESS(o_ptr);
13159 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
13160 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
13161 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13162 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
13163 return (uint64_t)ret_conv;
13166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
13167 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13168 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
13169 return (uint64_t)ret_conv;
13172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_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_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
13178 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
13181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13182 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
13183 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13184 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
13185 return (uint64_t)ret_conv;
13188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13189 LDKSignature o_ref;
13190 CHECK((*env)->GetArrayLength(env, o) == 64);
13191 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
13192 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13193 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
13194 return (uint64_t)ret_conv;
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
13198 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13199 *ret_conv = CResult_SignatureNoneZ_err();
13200 return (uint64_t)ret_conv;
13203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13204 if ((_res & 1) != 0) return;
13205 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13206 CHECK_ACCESS(_res_ptr);
13207 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
13209 CResult_SignatureNoneZ_free(_res_conv);
13212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13213 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
13214 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13215 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
13216 return (uint64_t)ret_conv;
13219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13220 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13221 CHECK_ACCESS(o_ptr);
13222 LDKSign o_conv = *(LDKSign*)(o_ptr);
13223 if (o_conv.free == LDKSign_JCalls_free) {
13224 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13225 LDKSign_JCalls_cloned(&o_conv);
13227 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13228 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
13229 return (uint64_t)ret_conv;
13232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13233 LDKDecodeError e_conv;
13234 e_conv.inner = (void*)(e & (~1));
13235 e_conv.is_owned = (e & 1) || (e == 0);
13236 e_conv = DecodeError_clone(&e_conv);
13237 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13238 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
13239 return (uint64_t)ret_conv;
13242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13243 if ((_res & 1) != 0) return;
13244 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13245 CHECK_ACCESS(_res_ptr);
13246 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
13248 CResult_SignDecodeErrorZ_free(_res_conv);
13251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13252 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
13253 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13254 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
13255 return (uint64_t)ret_conv;
13258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13259 LDKCVec_u8Z _res_ref;
13260 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13261 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
13262 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13263 CVec_u8Z_free(_res_ref);
13266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
13267 LDKRecoverableSignature arg_ref;
13268 CHECK((*env)->GetArrayLength(env, arg) == 68);
13269 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
13270 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13271 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
13272 return (uint64_t)ret_conv;
13275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
13276 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13277 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
13278 return (uint64_t)ret_conv;
13281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13282 if ((_res & 1) != 0) return;
13283 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13284 CHECK_ACCESS(_res_ptr);
13285 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
13287 CResult_RecoverableSignatureNoneZ_free(_res_conv);
13290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13291 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
13292 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13293 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
13294 return (uint64_t)ret_conv;
13297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13298 LDKCVec_CVec_u8ZZ _res_constr;
13299 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13300 if (_res_constr.datalen > 0)
13301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13303 _res_constr.data = NULL;
13304 for (size_t i = 0; i < _res_constr.datalen; i++) {
13305 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13306 LDKCVec_u8Z _res_conv_8_ref;
13307 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
13308 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
13309 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
13310 _res_constr.data[i] = _res_conv_8_ref;
13312 CVec_CVec_u8ZZ_free(_res_constr);
13315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
13316 LDKCVec_CVec_u8ZZ o_constr;
13317 o_constr.datalen = (*env)->GetArrayLength(env, o);
13318 if (o_constr.datalen > 0)
13319 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13321 o_constr.data = NULL;
13322 for (size_t i = 0; i < o_constr.datalen; i++) {
13323 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
13324 LDKCVec_u8Z o_conv_8_ref;
13325 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
13326 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
13327 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
13328 o_constr.data[i] = o_conv_8_ref;
13330 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13331 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
13332 return (uint64_t)ret_conv;
13335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
13336 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13337 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
13338 return (uint64_t)ret_conv;
13341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13342 if ((_res & 1) != 0) return;
13343 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13344 CHECK_ACCESS(_res_ptr);
13345 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
13347 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
13350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13351 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
13352 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13353 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
13354 return (uint64_t)ret_conv;
13357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13358 LDKInMemorySigner o_conv;
13359 o_conv.inner = (void*)(o & (~1));
13360 o_conv.is_owned = (o & 1) || (o == 0);
13361 o_conv = InMemorySigner_clone(&o_conv);
13362 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13363 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
13364 return (uint64_t)ret_conv;
13367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13368 LDKDecodeError e_conv;
13369 e_conv.inner = (void*)(e & (~1));
13370 e_conv.is_owned = (e & 1) || (e == 0);
13371 e_conv = DecodeError_clone(&e_conv);
13372 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13373 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
13374 return (uint64_t)ret_conv;
13377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13378 if ((_res & 1) != 0) return;
13379 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13380 CHECK_ACCESS(_res_ptr);
13381 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
13383 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
13386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13387 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
13388 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13389 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
13390 return (uint64_t)ret_conv;
13393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13394 LDKCVec_TxOutZ _res_constr;
13395 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13396 if (_res_constr.datalen > 0)
13397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13399 _res_constr.data = NULL;
13400 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13401 for (size_t h = 0; h < _res_constr.datalen; h++) {
13402 int64_t _res_conv_7 = _res_vals[h];
13403 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
13404 CHECK_ACCESS(_res_conv_7_ptr);
13405 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
13406 FREE((void*)_res_conv_7);
13407 _res_constr.data[h] = _res_conv_7_conv;
13409 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13410 CVec_TxOutZ_free(_res_constr);
13413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13414 LDKTransaction o_ref;
13415 o_ref.datalen = (*env)->GetArrayLength(env, o);
13416 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
13417 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13418 o_ref.data_is_owned = true;
13419 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13420 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
13421 return (uint64_t)ret_conv;
13424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
13425 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13426 *ret_conv = CResult_TransactionNoneZ_err();
13427 return (uint64_t)ret_conv;
13430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13431 if ((_res & 1) != 0) return;
13432 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13433 CHECK_ACCESS(_res_ptr);
13434 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
13436 CResult_TransactionNoneZ_free(_res_conv);
13439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13440 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
13441 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13442 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
13443 return (uint64_t)ret_conv;
13446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13447 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
13448 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
13449 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
13450 return ((uint64_t)ret_conv);
13453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
13454 LDKThirtyTwoBytes a_ref;
13455 CHECK((*env)->GetArrayLength(env, a) == 32);
13456 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13457 LDKChannelMonitor b_conv;
13458 b_conv.inner = (void*)(b & (~1));
13459 b_conv.is_owned = (b & 1) || (b == 0);
13460 b_conv = ChannelMonitor_clone(&b_conv);
13461 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
13462 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
13463 return ((uint64_t)ret_conv);
13466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13467 if ((_res & 1) != 0) return;
13468 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13469 CHECK_ACCESS(_res_ptr);
13470 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
13472 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
13475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13476 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
13477 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13478 if (_res_constr.datalen > 0)
13479 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
13481 _res_constr.data = NULL;
13482 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13483 for (size_t j = 0; j < _res_constr.datalen; j++) {
13484 int64_t _res_conv_35 = _res_vals[j];
13485 void* _res_conv_35_ptr = (void*)(((uint64_t)_res_conv_35) & ~1);
13486 CHECK_ACCESS(_res_conv_35_ptr);
13487 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
13488 FREE((void*)_res_conv_35);
13489 _res_constr.data[j] = _res_conv_35_conv;
13491 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13492 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
13495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
13496 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
13497 o_constr.datalen = (*env)->GetArrayLength(env, o);
13498 if (o_constr.datalen > 0)
13499 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
13501 o_constr.data = NULL;
13502 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
13503 for (size_t j = 0; j < o_constr.datalen; j++) {
13504 int64_t o_conv_35 = o_vals[j];
13505 void* o_conv_35_ptr = (void*)(((uint64_t)o_conv_35) & ~1);
13506 CHECK_ACCESS(o_conv_35_ptr);
13507 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
13508 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
13509 o_constr.data[j] = o_conv_35_conv;
13511 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
13512 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
13513 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
13514 return (uint64_t)ret_conv;
13517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13518 LDKIOError e_conv = LDKIOError_from_java(env, e);
13519 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
13520 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
13521 return (uint64_t)ret_conv;
13524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13525 if ((_res & 1) != 0) return;
13526 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13527 CHECK_ACCESS(_res_ptr);
13528 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
13530 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
13533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13534 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
13535 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
13536 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
13537 return (uint64_t)ret_conv;
13540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
13541 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13542 *ret_copy = COption_u16Z_some(o);
13543 uint64_t ret_ref = (uint64_t)ret_copy;
13547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
13548 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13549 *ret_copy = COption_u16Z_none();
13550 uint64_t ret_ref = (uint64_t)ret_copy;
13554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13555 if ((_res & 1) != 0) return;
13556 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13557 CHECK_ACCESS(_res_ptr);
13558 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
13560 COption_u16Z_free(_res_conv);
13563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13564 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
13565 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13566 *ret_copy = COption_u16Z_clone(orig_conv);
13567 uint64_t ret_ref = (uint64_t)ret_copy;
13571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
13572 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13573 *ret_conv = CResult_NoneAPIErrorZ_ok();
13574 return (uint64_t)ret_conv;
13577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13578 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13579 CHECK_ACCESS(e_ptr);
13580 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13581 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
13582 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13583 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
13584 return (uint64_t)ret_conv;
13587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13588 if ((_res & 1) != 0) return;
13589 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13590 CHECK_ACCESS(_res_ptr);
13591 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
13593 CResult_NoneAPIErrorZ_free(_res_conv);
13596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13597 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
13598 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13599 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
13600 return (uint64_t)ret_conv;
13603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13604 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
13605 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13606 if (_res_constr.datalen > 0)
13607 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
13609 _res_constr.data = NULL;
13610 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13611 for (size_t w = 0; w < _res_constr.datalen; w++) {
13612 int64_t _res_conv_22 = _res_vals[w];
13613 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
13614 CHECK_ACCESS(_res_conv_22_ptr);
13615 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
13616 FREE((void*)_res_conv_22);
13617 _res_constr.data[w] = _res_conv_22_conv;
13619 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13620 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
13623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13624 LDKCVec_APIErrorZ _res_constr;
13625 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13626 if (_res_constr.datalen > 0)
13627 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
13629 _res_constr.data = NULL;
13630 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13631 for (size_t k = 0; k < _res_constr.datalen; k++) {
13632 int64_t _res_conv_10 = _res_vals[k];
13633 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
13634 CHECK_ACCESS(_res_conv_10_ptr);
13635 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
13636 FREE((void*)_res_conv_10);
13637 _res_constr.data[k] = _res_conv_10_conv;
13639 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13640 CVec_APIErrorZ_free(_res_constr);
13643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13644 LDKThirtyTwoBytes o_ref;
13645 CHECK((*env)->GetArrayLength(env, o) == 32);
13646 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
13647 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13648 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
13649 return (uint64_t)ret_conv;
13652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13653 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13654 CHECK_ACCESS(e_ptr);
13655 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13656 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
13657 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13658 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
13659 return (uint64_t)ret_conv;
13662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13663 if ((_res & 1) != 0) return;
13664 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13665 CHECK_ACCESS(_res_ptr);
13666 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
13668 CResult__u832APIErrorZ_free(_res_conv);
13671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13672 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
13673 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13674 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
13675 return (uint64_t)ret_conv;
13678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13679 LDKThirtyTwoBytes o_ref;
13680 CHECK((*env)->GetArrayLength(env, o) == 32);
13681 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
13682 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13683 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
13684 return (uint64_t)ret_conv;
13687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13688 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13689 CHECK_ACCESS(e_ptr);
13690 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13691 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
13692 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13693 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
13694 return (uint64_t)ret_conv;
13697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13698 if ((_res & 1) != 0) return;
13699 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13700 CHECK_ACCESS(_res_ptr);
13701 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
13703 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
13706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13707 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
13708 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13709 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
13710 return (uint64_t)ret_conv;
13713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
13714 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13715 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
13716 return (uint64_t)ret_conv;
13719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13720 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13721 CHECK_ACCESS(e_ptr);
13722 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13723 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
13724 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13725 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
13726 return (uint64_t)ret_conv;
13729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13730 if ((_res & 1) != 0) return;
13731 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13732 CHECK_ACCESS(_res_ptr);
13733 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
13735 CResult_NonePaymentSendFailureZ_free(_res_conv);
13738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13739 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
13740 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13741 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
13742 return (uint64_t)ret_conv;
13745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13746 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
13747 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
13748 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
13749 return ((uint64_t)ret_conv);
13752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
13753 LDKThirtyTwoBytes a_ref;
13754 CHECK((*env)->GetArrayLength(env, a) == 32);
13755 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13756 LDKThirtyTwoBytes b_ref;
13757 CHECK((*env)->GetArrayLength(env, b) == 32);
13758 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
13759 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
13760 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
13761 return ((uint64_t)ret_conv);
13764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13765 if ((_res & 1) != 0) return;
13766 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13767 CHECK_ACCESS(_res_ptr);
13768 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
13770 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
13773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13774 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13775 CHECK_ACCESS(o_ptr);
13776 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
13777 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
13778 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
13779 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
13780 return (uint64_t)ret_conv;
13783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13784 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13785 CHECK_ACCESS(e_ptr);
13786 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13787 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
13788 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
13789 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
13790 return (uint64_t)ret_conv;
13793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13794 if ((_res & 1) != 0) return;
13795 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13796 CHECK_ACCESS(_res_ptr);
13797 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
13799 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
13802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13803 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
13804 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
13805 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
13806 return (uint64_t)ret_conv;
13809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13810 LDKCVec_NetAddressZ _res_constr;
13811 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13812 if (_res_constr.datalen > 0)
13813 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13815 _res_constr.data = NULL;
13816 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13817 for (size_t m = 0; m < _res_constr.datalen; m++) {
13818 int64_t _res_conv_12 = _res_vals[m];
13819 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
13820 CHECK_ACCESS(_res_conv_12_ptr);
13821 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
13822 FREE((void*)_res_conv_12);
13823 _res_constr.data[m] = _res_conv_12_conv;
13825 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13826 CVec_NetAddressZ_free(_res_constr);
13829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13830 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
13831 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
13832 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
13833 return ((uint64_t)ret_conv);
13836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
13837 LDKThirtyTwoBytes a_ref;
13838 CHECK((*env)->GetArrayLength(env, a) == 32);
13839 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13840 LDKThirtyTwoBytes b_ref;
13841 CHECK((*env)->GetArrayLength(env, b) == 32);
13842 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
13843 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
13844 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
13845 return ((uint64_t)ret_conv);
13848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13849 if ((_res & 1) != 0) return;
13850 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13851 CHECK_ACCESS(_res_ptr);
13852 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
13854 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
13857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13858 LDKThirtyTwoBytes o_ref;
13859 CHECK((*env)->GetArrayLength(env, o) == 32);
13860 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
13861 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
13862 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
13863 return (uint64_t)ret_conv;
13866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13867 void* e_ptr = (void*)(((uint64_t)e) & ~1);
13868 CHECK_ACCESS(e_ptr);
13869 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13870 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
13871 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
13872 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
13873 return (uint64_t)ret_conv;
13876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13877 if ((_res & 1) != 0) return;
13878 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13879 CHECK_ACCESS(_res_ptr);
13880 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
13882 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
13885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13886 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
13887 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
13888 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
13889 return (uint64_t)ret_conv;
13892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13893 LDKCVec_ChannelMonitorZ _res_constr;
13894 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13895 if (_res_constr.datalen > 0)
13896 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
13898 _res_constr.data = NULL;
13899 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13900 for (size_t q = 0; q < _res_constr.datalen; q++) {
13901 int64_t _res_conv_16 = _res_vals[q];
13902 LDKChannelMonitor _res_conv_16_conv;
13903 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13904 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13905 _res_constr.data[q] = _res_conv_16_conv;
13907 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13908 CVec_ChannelMonitorZ_free(_res_constr);
13911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
13912 LDKThirtyTwoBytes a_ref;
13913 CHECK((*env)->GetArrayLength(env, a) == 32);
13914 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13915 LDKChannelManager b_conv;
13916 b_conv.inner = (void*)(b & (~1));
13917 b_conv.is_owned = (b & 1) || (b == 0);
13918 // Warning: we need a move here but no clone is available for LDKChannelManager
13919 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
13920 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
13921 return ((uint64_t)ret_conv);
13924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13925 if ((_res & 1) != 0) return;
13926 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13927 CHECK_ACCESS(_res_ptr);
13928 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
13930 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
13933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13934 void* o_ptr = (void*)(((uint64_t)o) & ~1);
13935 CHECK_ACCESS(o_ptr);
13936 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
13937 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
13938 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
13939 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
13940 return (uint64_t)ret_conv;
13943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13944 LDKDecodeError e_conv;
13945 e_conv.inner = (void*)(e & (~1));
13946 e_conv.is_owned = (e & 1) || (e == 0);
13947 e_conv = DecodeError_clone(&e_conv);
13948 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
13949 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
13950 return (uint64_t)ret_conv;
13953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13954 if ((_res & 1) != 0) return;
13955 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13956 CHECK_ACCESS(_res_ptr);
13957 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
13959 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
13962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13963 LDKChannelConfig o_conv;
13964 o_conv.inner = (void*)(o & (~1));
13965 o_conv.is_owned = (o & 1) || (o == 0);
13966 o_conv = ChannelConfig_clone(&o_conv);
13967 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13968 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
13969 return (uint64_t)ret_conv;
13972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13973 LDKDecodeError e_conv;
13974 e_conv.inner = (void*)(e & (~1));
13975 e_conv.is_owned = (e & 1) || (e == 0);
13976 e_conv = DecodeError_clone(&e_conv);
13977 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13978 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
13979 return (uint64_t)ret_conv;
13982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13983 if ((_res & 1) != 0) return;
13984 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13985 CHECK_ACCESS(_res_ptr);
13986 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
13988 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
13991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13992 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
13993 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13994 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
13995 return (uint64_t)ret_conv;
13998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13999 LDKOutPoint o_conv;
14000 o_conv.inner = (void*)(o & (~1));
14001 o_conv.is_owned = (o & 1) || (o == 0);
14002 o_conv = OutPoint_clone(&o_conv);
14003 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14004 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
14005 return (uint64_t)ret_conv;
14008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14009 LDKDecodeError e_conv;
14010 e_conv.inner = (void*)(e & (~1));
14011 e_conv.is_owned = (e & 1) || (e == 0);
14012 e_conv = DecodeError_clone(&e_conv);
14013 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14014 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
14015 return (uint64_t)ret_conv;
14018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14019 if ((_res & 1) != 0) return;
14020 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14021 CHECK_ACCESS(_res_ptr);
14022 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
14024 CResult_OutPointDecodeErrorZ_free(_res_conv);
14027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14028 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
14029 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14030 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
14031 return (uint64_t)ret_conv;
14034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14035 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14036 CHECK_ACCESS(o_ptr);
14037 LDKType o_conv = *(LDKType*)(o_ptr);
14038 if (o_conv.free == LDKType_JCalls_free) {
14039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14040 LDKType_JCalls_cloned(&o_conv);
14042 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14043 *ret_copy = COption_TypeZ_some(o_conv);
14044 uint64_t ret_ref = (uint64_t)ret_copy;
14048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
14049 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14050 *ret_copy = COption_TypeZ_none();
14051 uint64_t ret_ref = (uint64_t)ret_copy;
14055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14056 if ((_res & 1) != 0) return;
14057 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14058 CHECK_ACCESS(_res_ptr);
14059 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
14061 COption_TypeZ_free(_res_conv);
14064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14065 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
14066 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14067 *ret_copy = COption_TypeZ_clone(orig_conv);
14068 uint64_t ret_ref = (uint64_t)ret_copy;
14072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14073 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14074 CHECK_ACCESS(o_ptr);
14075 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
14076 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
14077 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14078 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
14079 return (uint64_t)ret_conv;
14082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14083 LDKDecodeError e_conv;
14084 e_conv.inner = (void*)(e & (~1));
14085 e_conv.is_owned = (e & 1) || (e == 0);
14086 e_conv = DecodeError_clone(&e_conv);
14087 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14088 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
14089 return (uint64_t)ret_conv;
14092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14093 if ((_res & 1) != 0) return;
14094 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14095 CHECK_ACCESS(_res_ptr);
14096 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
14098 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
14101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14102 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
14103 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14104 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
14105 return (uint64_t)ret_conv;
14108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14109 LDKThirtyTwoBytes o_ref;
14110 CHECK((*env)->GetArrayLength(env, o) == 32);
14111 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
14112 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14113 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
14114 return (uint64_t)ret_conv;
14117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14118 void* e_ptr = (void*)(((uint64_t)e) & ~1);
14119 CHECK_ACCESS(e_ptr);
14120 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
14121 e_conv = PaymentError_clone((LDKPaymentError*)(((uint64_t)e) & ~1));
14122 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14123 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
14124 return (uint64_t)ret_conv;
14127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14128 if ((_res & 1) != 0) return;
14129 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14130 CHECK_ACCESS(_res_ptr);
14131 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
14133 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
14136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14137 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
14138 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14139 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
14140 return (uint64_t)ret_conv;
14143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
14144 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
14145 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14146 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
14147 return (uint64_t)ret_conv;
14150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
14151 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14152 *ret_conv = CResult_SiPrefixNoneZ_err();
14153 return (uint64_t)ret_conv;
14156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14157 if ((_res & 1) != 0) return;
14158 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14159 CHECK_ACCESS(_res_ptr);
14160 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
14162 CResult_SiPrefixNoneZ_free(_res_conv);
14165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14166 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
14167 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14168 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
14169 return (uint64_t)ret_conv;
14172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14174 o_conv.inner = (void*)(o & (~1));
14175 o_conv.is_owned = (o & 1) || (o == 0);
14176 o_conv = Invoice_clone(&o_conv);
14177 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14178 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
14179 return (uint64_t)ret_conv;
14182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
14183 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14184 *ret_conv = CResult_InvoiceNoneZ_err();
14185 return (uint64_t)ret_conv;
14188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14189 if ((_res & 1) != 0) return;
14190 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14191 CHECK_ACCESS(_res_ptr);
14192 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
14194 CResult_InvoiceNoneZ_free(_res_conv);
14197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14198 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
14199 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14200 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
14201 return (uint64_t)ret_conv;
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14205 LDKSignedRawInvoice o_conv;
14206 o_conv.inner = (void*)(o & (~1));
14207 o_conv.is_owned = (o & 1) || (o == 0);
14208 o_conv = SignedRawInvoice_clone(&o_conv);
14209 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
14210 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
14211 return (uint64_t)ret_conv;
14214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
14215 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
14216 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
14217 return (uint64_t)ret_conv;
14220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_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_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
14226 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
14229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14230 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
14231 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
14232 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
14233 return (uint64_t)ret_conv;
14236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14237 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
14238 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
14239 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
14240 return ((uint64_t)ret_conv);
14243 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) {
14244 LDKRawInvoice a_conv;
14245 a_conv.inner = (void*)(a & (~1));
14246 a_conv.is_owned = (a & 1) || (a == 0);
14247 a_conv = RawInvoice_clone(&a_conv);
14248 LDKThirtyTwoBytes b_ref;
14249 CHECK((*env)->GetArrayLength(env, b) == 32);
14250 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
14251 LDKInvoiceSignature c_conv;
14252 c_conv.inner = (void*)(c & (~1));
14253 c_conv.is_owned = (c & 1) || (c == 0);
14254 c_conv = InvoiceSignature_clone(&c_conv);
14255 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
14256 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
14257 return ((uint64_t)ret_conv);
14260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14261 if ((_res & 1) != 0) return;
14262 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14263 CHECK_ACCESS(_res_ptr);
14264 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
14266 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
14269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14270 LDKPayeePubKey o_conv;
14271 o_conv.inner = (void*)(o & (~1));
14272 o_conv.is_owned = (o & 1) || (o == 0);
14273 o_conv = PayeePubKey_clone(&o_conv);
14274 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
14275 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
14276 return (uint64_t)ret_conv;
14279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14280 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14281 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
14282 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
14283 return (uint64_t)ret_conv;
14286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14287 if ((_res & 1) != 0) return;
14288 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14289 CHECK_ACCESS(_res_ptr);
14290 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
14292 CResult_PayeePubKeyErrorZ_free(_res_conv);
14295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14296 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
14297 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
14298 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
14299 return (uint64_t)ret_conv;
14302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14303 LDKCVec_PrivateRouteZ _res_constr;
14304 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14305 if (_res_constr.datalen > 0)
14306 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
14308 _res_constr.data = NULL;
14309 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14310 for (size_t o = 0; o < _res_constr.datalen; o++) {
14311 int64_t _res_conv_14 = _res_vals[o];
14312 LDKPrivateRoute _res_conv_14_conv;
14313 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
14314 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
14315 _res_constr.data[o] = _res_conv_14_conv;
14317 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14318 CVec_PrivateRouteZ_free(_res_constr);
14321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14322 LDKPositiveTimestamp o_conv;
14323 o_conv.inner = (void*)(o & (~1));
14324 o_conv.is_owned = (o & 1) || (o == 0);
14325 o_conv = PositiveTimestamp_clone(&o_conv);
14326 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
14327 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
14328 return (uint64_t)ret_conv;
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14332 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
14333 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
14334 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
14335 return (uint64_t)ret_conv;
14338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14339 if ((_res & 1) != 0) return;
14340 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14341 CHECK_ACCESS(_res_ptr);
14342 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
14344 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14348 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
14349 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
14350 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
14351 return (uint64_t)ret_conv;
14354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
14355 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
14356 *ret_conv = CResult_NoneSemanticErrorZ_ok();
14357 return (uint64_t)ret_conv;
14360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14361 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
14362 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
14363 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
14364 return (uint64_t)ret_conv;
14367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14368 if ((_res & 1) != 0) return;
14369 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14370 CHECK_ACCESS(_res_ptr);
14371 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
14373 CResult_NoneSemanticErrorZ_free(_res_conv);
14376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14377 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
14378 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
14379 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
14380 return (uint64_t)ret_conv;
14383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14385 o_conv.inner = (void*)(o & (~1));
14386 o_conv.is_owned = (o & 1) || (o == 0);
14387 o_conv = Invoice_clone(&o_conv);
14388 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
14389 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
14390 return (uint64_t)ret_conv;
14393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14394 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
14395 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
14396 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
14397 return (uint64_t)ret_conv;
14400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14401 if ((_res & 1) != 0) return;
14402 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14403 CHECK_ACCESS(_res_ptr);
14404 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
14406 CResult_InvoiceSemanticErrorZ_free(_res_conv);
14409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14410 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
14411 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
14412 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
14413 return (uint64_t)ret_conv;
14416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14417 LDKDescription o_conv;
14418 o_conv.inner = (void*)(o & (~1));
14419 o_conv.is_owned = (o & 1) || (o == 0);
14420 o_conv = Description_clone(&o_conv);
14421 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
14422 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
14423 return (uint64_t)ret_conv;
14426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14427 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
14428 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
14429 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
14430 return (uint64_t)ret_conv;
14433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14434 if ((_res & 1) != 0) return;
14435 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14436 CHECK_ACCESS(_res_ptr);
14437 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
14439 CResult_DescriptionCreationErrorZ_free(_res_conv);
14442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14443 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
14444 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
14445 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
14446 return (uint64_t)ret_conv;
14449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14450 LDKExpiryTime o_conv;
14451 o_conv.inner = (void*)(o & (~1));
14452 o_conv.is_owned = (o & 1) || (o == 0);
14453 o_conv = ExpiryTime_clone(&o_conv);
14454 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
14455 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
14456 return (uint64_t)ret_conv;
14459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14460 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
14461 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
14462 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
14463 return (uint64_t)ret_conv;
14466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14467 if ((_res & 1) != 0) return;
14468 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14469 CHECK_ACCESS(_res_ptr);
14470 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
14472 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
14475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14476 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
14477 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
14478 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
14479 return (uint64_t)ret_conv;
14482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14483 LDKPrivateRoute o_conv;
14484 o_conv.inner = (void*)(o & (~1));
14485 o_conv.is_owned = (o & 1) || (o == 0);
14486 o_conv = PrivateRoute_clone(&o_conv);
14487 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
14488 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
14489 return (uint64_t)ret_conv;
14492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14493 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
14494 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
14495 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
14496 return (uint64_t)ret_conv;
14499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14500 if ((_res & 1) != 0) return;
14501 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14502 CHECK_ACCESS(_res_ptr);
14503 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
14505 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
14508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14509 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
14510 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
14511 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
14512 return (uint64_t)ret_conv;
14515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
14516 LDKStr o_conv = java_to_owned_str(env, o);
14517 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
14518 *ret_conv = CResult_StringErrorZ_ok(o_conv);
14519 return (uint64_t)ret_conv;
14522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14523 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14524 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
14525 *ret_conv = CResult_StringErrorZ_err(e_conv);
14526 return (uint64_t)ret_conv;
14529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14530 if ((_res & 1) != 0) return;
14531 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14532 CHECK_ACCESS(_res_ptr);
14533 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
14535 CResult_StringErrorZ_free(_res_conv);
14538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14539 LDKChannelMonitorUpdate o_conv;
14540 o_conv.inner = (void*)(o & (~1));
14541 o_conv.is_owned = (o & 1) || (o == 0);
14542 o_conv = ChannelMonitorUpdate_clone(&o_conv);
14543 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14544 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
14545 return (uint64_t)ret_conv;
14548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14549 LDKDecodeError e_conv;
14550 e_conv.inner = (void*)(e & (~1));
14551 e_conv.is_owned = (e & 1) || (e == 0);
14552 e_conv = DecodeError_clone(&e_conv);
14553 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14554 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
14555 return (uint64_t)ret_conv;
14558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14559 if ((_res & 1) != 0) return;
14560 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14561 CHECK_ACCESS(_res_ptr);
14562 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
14564 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
14567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14568 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
14569 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14570 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
14571 return (uint64_t)ret_conv;
14574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14575 LDKHTLCUpdate o_conv;
14576 o_conv.inner = (void*)(o & (~1));
14577 o_conv.is_owned = (o & 1) || (o == 0);
14578 o_conv = HTLCUpdate_clone(&o_conv);
14579 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14580 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
14581 return (uint64_t)ret_conv;
14584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14585 LDKDecodeError e_conv;
14586 e_conv.inner = (void*)(e & (~1));
14587 e_conv.is_owned = (e & 1) || (e == 0);
14588 e_conv = DecodeError_clone(&e_conv);
14589 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14590 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
14591 return (uint64_t)ret_conv;
14594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14595 if ((_res & 1) != 0) return;
14596 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14597 CHECK_ACCESS(_res_ptr);
14598 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
14600 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
14603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14604 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
14605 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14606 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
14607 return (uint64_t)ret_conv;
14610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
14611 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14612 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
14613 return (uint64_t)ret_conv;
14616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14617 LDKMonitorUpdateError e_conv;
14618 e_conv.inner = (void*)(e & (~1));
14619 e_conv.is_owned = (e & 1) || (e == 0);
14620 e_conv = MonitorUpdateError_clone(&e_conv);
14621 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14622 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
14623 return (uint64_t)ret_conv;
14626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14627 if ((_res & 1) != 0) return;
14628 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14629 CHECK_ACCESS(_res_ptr);
14630 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr);
14632 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
14635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14636 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
14637 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14638 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
14639 return (uint64_t)ret_conv;
14642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14643 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
14644 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14645 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
14646 return ((uint64_t)ret_conv);
14649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
14650 LDKOutPoint a_conv;
14651 a_conv.inner = (void*)(a & (~1));
14652 a_conv.is_owned = (a & 1) || (a == 0);
14653 a_conv = OutPoint_clone(&a_conv);
14655 b_ref.datalen = (*env)->GetArrayLength(env, b);
14656 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
14657 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
14658 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14659 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
14660 return ((uint64_t)ret_conv);
14663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14664 if ((_res & 1) != 0) return;
14665 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14666 CHECK_ACCESS(_res_ptr);
14667 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
14669 C2Tuple_OutPointScriptZ_free(_res_conv);
14672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14673 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
14674 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
14675 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
14676 return ((uint64_t)ret_conv);
14679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
14681 b_ref.datalen = (*env)->GetArrayLength(env, b);
14682 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
14683 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
14684 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
14685 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
14686 return ((uint64_t)ret_conv);
14689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14690 if ((_res & 1) != 0) return;
14691 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14692 CHECK_ACCESS(_res_ptr);
14693 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
14695 C2Tuple_u32ScriptZ_free(_res_conv);
14698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14699 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
14700 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14701 if (_res_constr.datalen > 0)
14702 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
14704 _res_constr.data = NULL;
14705 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14706 for (size_t v = 0; v < _res_constr.datalen; v++) {
14707 int64_t _res_conv_21 = _res_vals[v];
14708 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
14709 CHECK_ACCESS(_res_conv_21_ptr);
14710 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
14711 FREE((void*)_res_conv_21);
14712 _res_constr.data[v] = _res_conv_21_conv;
14714 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14715 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14719 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
14720 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14721 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
14722 return ((uint64_t)ret_conv);
14725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
14726 LDKThirtyTwoBytes a_ref;
14727 CHECK((*env)->GetArrayLength(env, a) == 32);
14728 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14729 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
14730 b_constr.datalen = (*env)->GetArrayLength(env, b);
14731 if (b_constr.datalen > 0)
14732 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
14734 b_constr.data = NULL;
14735 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
14736 for (size_t v = 0; v < b_constr.datalen; v++) {
14737 int64_t b_conv_21 = b_vals[v];
14738 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
14739 CHECK_ACCESS(b_conv_21_ptr);
14740 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
14741 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
14742 b_constr.data[v] = b_conv_21_conv;
14744 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
14745 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14746 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
14747 return ((uint64_t)ret_conv);
14750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14751 if ((_res & 1) != 0) return;
14752 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14753 CHECK_ACCESS(_res_ptr);
14754 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
14756 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
14759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14760 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
14761 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14762 if (_res_constr.datalen > 0)
14763 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
14765 _res_constr.data = NULL;
14766 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14767 for (size_t o = 0; o < _res_constr.datalen; o++) {
14768 int64_t _res_conv_40 = _res_vals[o];
14769 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
14770 CHECK_ACCESS(_res_conv_40_ptr);
14771 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
14772 FREE((void*)_res_conv_40);
14773 _res_constr.data[o] = _res_conv_40_conv;
14775 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14776 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
14779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14780 LDKCVec_EventZ _res_constr;
14781 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14782 if (_res_constr.datalen > 0)
14783 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
14785 _res_constr.data = NULL;
14786 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14787 for (size_t h = 0; h < _res_constr.datalen; h++) {
14788 int64_t _res_conv_7 = _res_vals[h];
14789 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
14790 CHECK_ACCESS(_res_conv_7_ptr);
14791 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
14792 FREE((void*)_res_conv_7);
14793 _res_constr.data[h] = _res_conv_7_conv;
14795 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14796 CVec_EventZ_free(_res_constr);
14799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14800 LDKCVec_TransactionZ _res_constr;
14801 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14802 if (_res_constr.datalen > 0)
14803 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
14805 _res_constr.data = NULL;
14806 for (size_t i = 0; i < _res_constr.datalen; i++) {
14807 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14808 LDKTransaction _res_conv_8_ref;
14809 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
14810 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
14811 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
14812 _res_conv_8_ref.data_is_owned = true;
14813 _res_constr.data[i] = _res_conv_8_ref;
14815 CVec_TransactionZ_free(_res_constr);
14818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14819 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
14820 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
14821 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
14822 return ((uint64_t)ret_conv);
14825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
14826 void* b_ptr = (void*)(((uint64_t)b) & ~1);
14827 CHECK_ACCESS(b_ptr);
14828 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
14829 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
14830 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
14831 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
14832 return ((uint64_t)ret_conv);
14835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14836 if ((_res & 1) != 0) return;
14837 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14838 CHECK_ACCESS(_res_ptr);
14839 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
14841 C2Tuple_u32TxOutZ_free(_res_conv);
14844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14845 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
14846 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14847 if (_res_constr.datalen > 0)
14848 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
14850 _res_constr.data = NULL;
14851 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14852 for (size_t u = 0; u < _res_constr.datalen; u++) {
14853 int64_t _res_conv_20 = _res_vals[u];
14854 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
14855 CHECK_ACCESS(_res_conv_20_ptr);
14856 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
14857 FREE((void*)_res_conv_20);
14858 _res_constr.data[u] = _res_conv_20_conv;
14860 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14861 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
14864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14865 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
14866 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14867 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
14868 return ((uint64_t)ret_conv);
14871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
14872 LDKThirtyTwoBytes a_ref;
14873 CHECK((*env)->GetArrayLength(env, a) == 32);
14874 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14875 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
14876 b_constr.datalen = (*env)->GetArrayLength(env, b);
14877 if (b_constr.datalen > 0)
14878 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
14880 b_constr.data = NULL;
14881 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
14882 for (size_t u = 0; u < b_constr.datalen; u++) {
14883 int64_t b_conv_20 = b_vals[u];
14884 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
14885 CHECK_ACCESS(b_conv_20_ptr);
14886 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
14887 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
14888 b_constr.data[u] = b_conv_20_conv;
14890 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
14891 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14892 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
14893 return ((uint64_t)ret_conv);
14896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14897 if ((_res & 1) != 0) return;
14898 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14899 CHECK_ACCESS(_res_ptr);
14900 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
14902 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
14905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14906 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
14907 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14908 if (_res_constr.datalen > 0)
14909 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
14911 _res_constr.data = NULL;
14912 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14913 for (size_t n = 0; n < _res_constr.datalen; n++) {
14914 int64_t _res_conv_39 = _res_vals[n];
14915 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
14916 CHECK_ACCESS(_res_conv_39_ptr);
14917 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
14918 FREE((void*)_res_conv_39);
14919 _res_constr.data[n] = _res_conv_39_conv;
14921 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14922 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
14925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14926 LDKCVec_BalanceZ _res_constr;
14927 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14928 if (_res_constr.datalen > 0)
14929 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
14931 _res_constr.data = NULL;
14932 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14933 for (size_t j = 0; j < _res_constr.datalen; j++) {
14934 int64_t _res_conv_9 = _res_vals[j];
14935 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
14936 CHECK_ACCESS(_res_conv_9_ptr);
14937 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
14938 FREE((void*)_res_conv_9);
14939 _res_constr.data[j] = _res_conv_9_conv;
14941 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14942 CVec_BalanceZ_free(_res_constr);
14945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14946 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14947 CHECK_ACCESS(o_ptr);
14948 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
14949 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
14950 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14951 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
14952 return (uint64_t)ret_conv;
14955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14956 LDKDecodeError e_conv;
14957 e_conv.inner = (void*)(e & (~1));
14958 e_conv.is_owned = (e & 1) || (e == 0);
14959 e_conv = DecodeError_clone(&e_conv);
14960 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14961 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
14962 return (uint64_t)ret_conv;
14965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14966 if ((_res & 1) != 0) return;
14967 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14968 CHECK_ACCESS(_res_ptr);
14969 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
14971 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
14974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14975 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
14976 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14977 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
14978 return (uint64_t)ret_conv;
14981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
14982 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14983 *ret_conv = CResult_NoneLightningErrorZ_ok();
14984 return (uint64_t)ret_conv;
14987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14988 LDKLightningError e_conv;
14989 e_conv.inner = (void*)(e & (~1));
14990 e_conv.is_owned = (e & 1) || (e == 0);
14991 e_conv = LightningError_clone(&e_conv);
14992 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14993 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14994 return (uint64_t)ret_conv;
14997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14998 if ((_res & 1) != 0) return;
14999 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15000 CHECK_ACCESS(_res_ptr);
15001 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
15003 CResult_NoneLightningErrorZ_free(_res_conv);
15006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15007 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
15008 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15009 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
15010 return (uint64_t)ret_conv;
15013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15014 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
15015 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15016 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
15017 return ((uint64_t)ret_conv);
15020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
15021 LDKPublicKey a_ref;
15022 CHECK((*env)->GetArrayLength(env, a) == 33);
15023 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
15024 void* b_ptr = (void*)(((uint64_t)b) & ~1);
15025 CHECK_ACCESS(b_ptr);
15026 LDKType b_conv = *(LDKType*)(b_ptr);
15027 if (b_conv.free == LDKType_JCalls_free) {
15028 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15029 LDKType_JCalls_cloned(&b_conv);
15031 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15032 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
15033 return ((uint64_t)ret_conv);
15036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15037 if ((_res & 1) != 0) return;
15038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15039 CHECK_ACCESS(_res_ptr);
15040 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
15042 C2Tuple_PublicKeyTypeZ_free(_res_conv);
15045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15046 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
15047 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15048 if (_res_constr.datalen > 0)
15049 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15051 _res_constr.data = NULL;
15052 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15053 for (size_t z = 0; z < _res_constr.datalen; z++) {
15054 int64_t _res_conv_25 = _res_vals[z];
15055 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
15056 CHECK_ACCESS(_res_conv_25_ptr);
15057 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
15058 FREE((void*)_res_conv_25);
15059 _res_constr.data[z] = _res_conv_25_conv;
15061 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15062 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
15065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
15066 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15067 *ret_conv = CResult_boolLightningErrorZ_ok(o);
15068 return (uint64_t)ret_conv;
15071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15072 LDKLightningError e_conv;
15073 e_conv.inner = (void*)(e & (~1));
15074 e_conv.is_owned = (e & 1) || (e == 0);
15075 e_conv = LightningError_clone(&e_conv);
15076 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15077 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
15078 return (uint64_t)ret_conv;
15081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15082 if ((_res & 1) != 0) return;
15083 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15084 CHECK_ACCESS(_res_ptr);
15085 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
15087 CResult_boolLightningErrorZ_free(_res_conv);
15090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15091 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
15092 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15093 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
15094 return (uint64_t)ret_conv;
15097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15098 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
15099 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15100 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
15101 return ((uint64_t)ret_conv);
15104 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) {
15105 LDKChannelAnnouncement a_conv;
15106 a_conv.inner = (void*)(a & (~1));
15107 a_conv.is_owned = (a & 1) || (a == 0);
15108 a_conv = ChannelAnnouncement_clone(&a_conv);
15109 LDKChannelUpdate b_conv;
15110 b_conv.inner = (void*)(b & (~1));
15111 b_conv.is_owned = (b & 1) || (b == 0);
15112 b_conv = ChannelUpdate_clone(&b_conv);
15113 LDKChannelUpdate c_conv;
15114 c_conv.inner = (void*)(c & (~1));
15115 c_conv.is_owned = (c & 1) || (c == 0);
15116 c_conv = ChannelUpdate_clone(&c_conv);
15117 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
15118 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
15119 return ((uint64_t)ret_conv);
15122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15123 if ((_res & 1) != 0) return;
15124 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15125 CHECK_ACCESS(_res_ptr);
15126 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
15128 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
15131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15132 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
15133 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15134 if (_res_constr.datalen > 0)
15135 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
15137 _res_constr.data = NULL;
15138 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15139 for (size_t h = 0; h < _res_constr.datalen; h++) {
15140 int64_t _res_conv_59 = _res_vals[h];
15141 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
15142 CHECK_ACCESS(_res_conv_59_ptr);
15143 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
15144 FREE((void*)_res_conv_59);
15145 _res_constr.data[h] = _res_conv_59_conv;
15147 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15148 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
15151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15152 LDKCVec_NodeAnnouncementZ _res_constr;
15153 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15154 if (_res_constr.datalen > 0)
15155 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
15157 _res_constr.data = NULL;
15158 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15159 for (size_t s = 0; s < _res_constr.datalen; s++) {
15160 int64_t _res_conv_18 = _res_vals[s];
15161 LDKNodeAnnouncement _res_conv_18_conv;
15162 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
15163 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
15164 _res_constr.data[s] = _res_conv_18_conv;
15166 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15167 CVec_NodeAnnouncementZ_free(_res_constr);
15170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15171 LDKCVec_PublicKeyZ _res_constr;
15172 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15173 if (_res_constr.datalen > 0)
15174 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
15176 _res_constr.data = NULL;
15177 for (size_t i = 0; i < _res_constr.datalen; i++) {
15178 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15179 LDKPublicKey _res_conv_8_ref;
15180 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
15181 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
15182 _res_constr.data[i] = _res_conv_8_ref;
15184 CVec_PublicKeyZ_free(_res_constr);
15187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15189 o_ref.datalen = (*env)->GetArrayLength(env, o);
15190 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
15191 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
15192 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
15193 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
15194 return (uint64_t)ret_conv;
15197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15198 LDKPeerHandleError e_conv;
15199 e_conv.inner = (void*)(e & (~1));
15200 e_conv.is_owned = (e & 1) || (e == 0);
15201 e_conv = PeerHandleError_clone(&e_conv);
15202 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
15203 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
15204 return (uint64_t)ret_conv;
15207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15208 if ((_res & 1) != 0) return;
15209 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15210 CHECK_ACCESS(_res_ptr);
15211 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
15213 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
15216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15217 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
15218 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
15219 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
15220 return (uint64_t)ret_conv;
15223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
15224 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15225 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
15226 return (uint64_t)ret_conv;
15229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15230 LDKPeerHandleError e_conv;
15231 e_conv.inner = (void*)(e & (~1));
15232 e_conv.is_owned = (e & 1) || (e == 0);
15233 e_conv = PeerHandleError_clone(&e_conv);
15234 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15235 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
15236 return (uint64_t)ret_conv;
15239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15240 if ((_res & 1) != 0) return;
15241 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15242 CHECK_ACCESS(_res_ptr);
15243 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
15245 CResult_NonePeerHandleErrorZ_free(_res_conv);
15248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15249 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
15250 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
15251 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
15252 return (uint64_t)ret_conv;
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
15256 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
15257 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
15258 return (uint64_t)ret_conv;
15261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15262 LDKPeerHandleError e_conv;
15263 e_conv.inner = (void*)(e & (~1));
15264 e_conv.is_owned = (e & 1) || (e == 0);
15265 e_conv = PeerHandleError_clone(&e_conv);
15266 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
15267 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
15268 return (uint64_t)ret_conv;
15271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15272 if ((_res & 1) != 0) return;
15273 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15274 CHECK_ACCESS(_res_ptr);
15275 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
15277 CResult_boolPeerHandleErrorZ_free(_res_conv);
15280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15281 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
15282 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
15283 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
15284 return (uint64_t)ret_conv;
15287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15289 o_conv.inner = (void*)(o & (~1));
15290 o_conv.is_owned = (o & 1) || (o == 0);
15291 o_conv = NodeId_clone(&o_conv);
15292 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15293 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
15294 return (uint64_t)ret_conv;
15297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15298 LDKDecodeError e_conv;
15299 e_conv.inner = (void*)(e & (~1));
15300 e_conv.is_owned = (e & 1) || (e == 0);
15301 e_conv = DecodeError_clone(&e_conv);
15302 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15303 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
15304 return (uint64_t)ret_conv;
15307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15308 if ((_res & 1) != 0) return;
15309 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15310 CHECK_ACCESS(_res_ptr);
15311 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
15313 CResult_NodeIdDecodeErrorZ_free(_res_conv);
15316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15317 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
15318 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
15319 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
15320 return (uint64_t)ret_conv;
15323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15324 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15325 CHECK_ACCESS(o_ptr);
15326 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
15327 if (o_conv.free == LDKAccess_JCalls_free) {
15328 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15329 LDKAccess_JCalls_cloned(&o_conv);
15331 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
15332 *ret_copy = COption_AccessZ_some(o_conv);
15333 uint64_t ret_ref = (uint64_t)ret_copy;
15337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
15338 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
15339 *ret_copy = COption_AccessZ_none();
15340 uint64_t ret_ref = (uint64_t)ret_copy;
15344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15345 if ((_res & 1) != 0) return;
15346 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15347 CHECK_ACCESS(_res_ptr);
15348 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
15350 COption_AccessZ_free(_res_conv);
15353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15354 LDKDirectionalChannelInfo o_conv;
15355 o_conv.inner = (void*)(o & (~1));
15356 o_conv.is_owned = (o & 1) || (o == 0);
15357 o_conv = DirectionalChannelInfo_clone(&o_conv);
15358 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
15359 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
15360 return (uint64_t)ret_conv;
15363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15364 LDKDecodeError e_conv;
15365 e_conv.inner = (void*)(e & (~1));
15366 e_conv.is_owned = (e & 1) || (e == 0);
15367 e_conv = DecodeError_clone(&e_conv);
15368 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
15369 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
15370 return (uint64_t)ret_conv;
15373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15374 if ((_res & 1) != 0) return;
15375 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15376 CHECK_ACCESS(_res_ptr);
15377 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
15379 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
15382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15383 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
15384 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
15385 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
15386 return (uint64_t)ret_conv;
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15390 LDKChannelInfo o_conv;
15391 o_conv.inner = (void*)(o & (~1));
15392 o_conv.is_owned = (o & 1) || (o == 0);
15393 o_conv = ChannelInfo_clone(&o_conv);
15394 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15395 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15396 return (uint64_t)ret_conv;
15399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15400 LDKDecodeError e_conv;
15401 e_conv.inner = (void*)(e & (~1));
15402 e_conv.is_owned = (e & 1) || (e == 0);
15403 e_conv = DecodeError_clone(&e_conv);
15404 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15405 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15406 return (uint64_t)ret_conv;
15409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15410 if ((_res & 1) != 0) return;
15411 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15412 CHECK_ACCESS(_res_ptr);
15413 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15415 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15419 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
15420 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15421 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15422 return (uint64_t)ret_conv;
15425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15426 LDKRoutingFees o_conv;
15427 o_conv.inner = (void*)(o & (~1));
15428 o_conv.is_owned = (o & 1) || (o == 0);
15429 o_conv = RoutingFees_clone(&o_conv);
15430 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15431 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15432 return (uint64_t)ret_conv;
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15436 LDKDecodeError e_conv;
15437 e_conv.inner = (void*)(e & (~1));
15438 e_conv.is_owned = (e & 1) || (e == 0);
15439 e_conv = DecodeError_clone(&e_conv);
15440 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15441 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15442 return (uint64_t)ret_conv;
15445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15446 if ((_res & 1) != 0) return;
15447 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15448 CHECK_ACCESS(_res_ptr);
15449 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15451 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15455 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
15456 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15457 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15458 return (uint64_t)ret_conv;
15461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15462 LDKNodeAnnouncementInfo o_conv;
15463 o_conv.inner = (void*)(o & (~1));
15464 o_conv.is_owned = (o & 1) || (o == 0);
15465 o_conv = NodeAnnouncementInfo_clone(&o_conv);
15466 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15467 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15468 return (uint64_t)ret_conv;
15471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15472 LDKDecodeError e_conv;
15473 e_conv.inner = (void*)(e & (~1));
15474 e_conv.is_owned = (e & 1) || (e == 0);
15475 e_conv = DecodeError_clone(&e_conv);
15476 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15477 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15478 return (uint64_t)ret_conv;
15481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15482 if ((_res & 1) != 0) return;
15483 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15484 CHECK_ACCESS(_res_ptr);
15485 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15487 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15491 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
15492 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15493 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
15494 return (uint64_t)ret_conv;
15497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15498 LDKCVec_u64Z _res_constr;
15499 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15500 if (_res_constr.datalen > 0)
15501 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15503 _res_constr.data = NULL;
15504 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15505 for (size_t g = 0; g < _res_constr.datalen; g++) {
15506 int64_t _res_conv_6 = _res_vals[g];
15507 _res_constr.data[g] = _res_conv_6;
15509 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15510 CVec_u64Z_free(_res_constr);
15513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15514 LDKNodeInfo o_conv;
15515 o_conv.inner = (void*)(o & (~1));
15516 o_conv.is_owned = (o & 1) || (o == 0);
15517 o_conv = NodeInfo_clone(&o_conv);
15518 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15519 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
15520 return (uint64_t)ret_conv;
15523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15524 LDKDecodeError e_conv;
15525 e_conv.inner = (void*)(e & (~1));
15526 e_conv.is_owned = (e & 1) || (e == 0);
15527 e_conv = DecodeError_clone(&e_conv);
15528 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15529 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
15530 return (uint64_t)ret_conv;
15533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15534 if ((_res & 1) != 0) return;
15535 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15536 CHECK_ACCESS(_res_ptr);
15537 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
15539 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
15542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15543 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
15544 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15545 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
15546 return (uint64_t)ret_conv;
15549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15550 LDKNetworkGraph o_conv;
15551 o_conv.inner = (void*)(o & (~1));
15552 o_conv.is_owned = (o & 1) || (o == 0);
15553 o_conv = NetworkGraph_clone(&o_conv);
15554 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15555 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
15556 return (uint64_t)ret_conv;
15559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15560 LDKDecodeError e_conv;
15561 e_conv.inner = (void*)(e & (~1));
15562 e_conv.is_owned = (e & 1) || (e == 0);
15563 e_conv = DecodeError_clone(&e_conv);
15564 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15565 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
15566 return (uint64_t)ret_conv;
15569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15570 if ((_res & 1) != 0) return;
15571 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15572 CHECK_ACCESS(_res_ptr);
15573 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
15575 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
15578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15579 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
15580 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15581 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
15582 return (uint64_t)ret_conv;
15585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
15586 LDKCVec_NetAddressZ o_constr;
15587 o_constr.datalen = (*env)->GetArrayLength(env, o);
15588 if (o_constr.datalen > 0)
15589 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15591 o_constr.data = NULL;
15592 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
15593 for (size_t m = 0; m < o_constr.datalen; m++) {
15594 int64_t o_conv_12 = o_vals[m];
15595 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
15596 CHECK_ACCESS(o_conv_12_ptr);
15597 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
15598 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
15599 o_constr.data[m] = o_conv_12_conv;
15601 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
15602 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15603 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
15604 uint64_t ret_ref = (uint64_t)ret_copy;
15608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
15609 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15610 *ret_copy = COption_CVec_NetAddressZZ_none();
15611 uint64_t ret_ref = (uint64_t)ret_copy;
15615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_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 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
15621 COption_CVec_NetAddressZZ_free(_res_conv);
15624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15625 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
15626 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15627 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
15628 uint64_t ret_ref = (uint64_t)ret_copy;
15632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15633 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15634 CHECK_ACCESS(o_ptr);
15635 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
15636 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
15637 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
15638 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
15639 return (uint64_t)ret_conv;
15642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15643 LDKDecodeError e_conv;
15644 e_conv.inner = (void*)(e & (~1));
15645 e_conv.is_owned = (e & 1) || (e == 0);
15646 e_conv = DecodeError_clone(&e_conv);
15647 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
15648 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
15649 return (uint64_t)ret_conv;
15652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15653 if ((_res & 1) != 0) return;
15654 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15655 CHECK_ACCESS(_res_ptr);
15656 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
15658 CResult_NetAddressDecodeErrorZ_free(_res_conv);
15661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15662 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
15663 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
15664 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
15665 return (uint64_t)ret_conv;
15668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15669 LDKCVec_UpdateAddHTLCZ _res_constr;
15670 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15671 if (_res_constr.datalen > 0)
15672 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15674 _res_constr.data = NULL;
15675 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15676 for (size_t p = 0; p < _res_constr.datalen; p++) {
15677 int64_t _res_conv_15 = _res_vals[p];
15678 LDKUpdateAddHTLC _res_conv_15_conv;
15679 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
15680 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
15681 _res_constr.data[p] = _res_conv_15_conv;
15683 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15684 CVec_UpdateAddHTLCZ_free(_res_constr);
15687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15688 LDKCVec_UpdateFulfillHTLCZ _res_constr;
15689 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15690 if (_res_constr.datalen > 0)
15691 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15693 _res_constr.data = NULL;
15694 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15695 for (size_t t = 0; t < _res_constr.datalen; t++) {
15696 int64_t _res_conv_19 = _res_vals[t];
15697 LDKUpdateFulfillHTLC _res_conv_19_conv;
15698 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
15699 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
15700 _res_constr.data[t] = _res_conv_19_conv;
15702 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15703 CVec_UpdateFulfillHTLCZ_free(_res_constr);
15706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15707 LDKCVec_UpdateFailHTLCZ _res_constr;
15708 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15709 if (_res_constr.datalen > 0)
15710 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15712 _res_constr.data = NULL;
15713 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15714 for (size_t q = 0; q < _res_constr.datalen; q++) {
15715 int64_t _res_conv_16 = _res_vals[q];
15716 LDKUpdateFailHTLC _res_conv_16_conv;
15717 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15718 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15719 _res_constr.data[q] = _res_conv_16_conv;
15721 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15722 CVec_UpdateFailHTLCZ_free(_res_constr);
15725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15726 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
15727 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15728 if (_res_constr.datalen > 0)
15729 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15731 _res_constr.data = NULL;
15732 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15733 for (size_t z = 0; z < _res_constr.datalen; z++) {
15734 int64_t _res_conv_25 = _res_vals[z];
15735 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
15736 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
15737 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
15738 _res_constr.data[z] = _res_conv_25_conv;
15740 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15741 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
15744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15745 LDKAcceptChannel o_conv;
15746 o_conv.inner = (void*)(o & (~1));
15747 o_conv.is_owned = (o & 1) || (o == 0);
15748 o_conv = AcceptChannel_clone(&o_conv);
15749 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15750 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
15751 return (uint64_t)ret_conv;
15754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15755 LDKDecodeError e_conv;
15756 e_conv.inner = (void*)(e & (~1));
15757 e_conv.is_owned = (e & 1) || (e == 0);
15758 e_conv = DecodeError_clone(&e_conv);
15759 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15760 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
15761 return (uint64_t)ret_conv;
15764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15765 if ((_res & 1) != 0) return;
15766 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15767 CHECK_ACCESS(_res_ptr);
15768 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
15770 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
15773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15774 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
15775 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15776 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
15777 return (uint64_t)ret_conv;
15780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15781 LDKAnnouncementSignatures o_conv;
15782 o_conv.inner = (void*)(o & (~1));
15783 o_conv.is_owned = (o & 1) || (o == 0);
15784 o_conv = AnnouncementSignatures_clone(&o_conv);
15785 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15786 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
15787 return (uint64_t)ret_conv;
15790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15791 LDKDecodeError e_conv;
15792 e_conv.inner = (void*)(e & (~1));
15793 e_conv.is_owned = (e & 1) || (e == 0);
15794 e_conv = DecodeError_clone(&e_conv);
15795 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15796 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
15797 return (uint64_t)ret_conv;
15800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15801 if ((_res & 1) != 0) return;
15802 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15803 CHECK_ACCESS(_res_ptr);
15804 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
15806 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
15809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15810 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
15811 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15812 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
15813 return (uint64_t)ret_conv;
15816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15817 LDKChannelReestablish o_conv;
15818 o_conv.inner = (void*)(o & (~1));
15819 o_conv.is_owned = (o & 1) || (o == 0);
15820 o_conv = ChannelReestablish_clone(&o_conv);
15821 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15822 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
15823 return (uint64_t)ret_conv;
15826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15827 LDKDecodeError e_conv;
15828 e_conv.inner = (void*)(e & (~1));
15829 e_conv.is_owned = (e & 1) || (e == 0);
15830 e_conv = DecodeError_clone(&e_conv);
15831 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15832 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
15833 return (uint64_t)ret_conv;
15836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15837 if ((_res & 1) != 0) return;
15838 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15839 CHECK_ACCESS(_res_ptr);
15840 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
15842 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
15845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15846 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
15847 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15848 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
15849 return (uint64_t)ret_conv;
15852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15853 LDKClosingSigned o_conv;
15854 o_conv.inner = (void*)(o & (~1));
15855 o_conv.is_owned = (o & 1) || (o == 0);
15856 o_conv = ClosingSigned_clone(&o_conv);
15857 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15858 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
15859 return (uint64_t)ret_conv;
15862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15863 LDKDecodeError e_conv;
15864 e_conv.inner = (void*)(e & (~1));
15865 e_conv.is_owned = (e & 1) || (e == 0);
15866 e_conv = DecodeError_clone(&e_conv);
15867 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15868 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
15869 return (uint64_t)ret_conv;
15872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15873 if ((_res & 1) != 0) return;
15874 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15875 CHECK_ACCESS(_res_ptr);
15876 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
15878 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
15881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15882 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
15883 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15884 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
15885 return (uint64_t)ret_conv;
15888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15889 LDKClosingSignedFeeRange o_conv;
15890 o_conv.inner = (void*)(o & (~1));
15891 o_conv.is_owned = (o & 1) || (o == 0);
15892 o_conv = ClosingSignedFeeRange_clone(&o_conv);
15893 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
15894 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
15895 return (uint64_t)ret_conv;
15898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15899 LDKDecodeError e_conv;
15900 e_conv.inner = (void*)(e & (~1));
15901 e_conv.is_owned = (e & 1) || (e == 0);
15902 e_conv = DecodeError_clone(&e_conv);
15903 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
15904 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
15905 return (uint64_t)ret_conv;
15908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15909 if ((_res & 1) != 0) return;
15910 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15911 CHECK_ACCESS(_res_ptr);
15912 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
15914 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
15917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15918 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
15919 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
15920 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
15921 return (uint64_t)ret_conv;
15924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15925 LDKCommitmentSigned o_conv;
15926 o_conv.inner = (void*)(o & (~1));
15927 o_conv.is_owned = (o & 1) || (o == 0);
15928 o_conv = CommitmentSigned_clone(&o_conv);
15929 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15930 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
15931 return (uint64_t)ret_conv;
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15935 LDKDecodeError e_conv;
15936 e_conv.inner = (void*)(e & (~1));
15937 e_conv.is_owned = (e & 1) || (e == 0);
15938 e_conv = DecodeError_clone(&e_conv);
15939 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15940 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
15941 return (uint64_t)ret_conv;
15944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15945 if ((_res & 1) != 0) return;
15946 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15947 CHECK_ACCESS(_res_ptr);
15948 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
15950 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
15953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15954 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
15955 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15956 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
15957 return (uint64_t)ret_conv;
15960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15961 LDKFundingCreated o_conv;
15962 o_conv.inner = (void*)(o & (~1));
15963 o_conv.is_owned = (o & 1) || (o == 0);
15964 o_conv = FundingCreated_clone(&o_conv);
15965 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15966 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
15967 return (uint64_t)ret_conv;
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15971 LDKDecodeError e_conv;
15972 e_conv.inner = (void*)(e & (~1));
15973 e_conv.is_owned = (e & 1) || (e == 0);
15974 e_conv = DecodeError_clone(&e_conv);
15975 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15976 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
15977 return (uint64_t)ret_conv;
15980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15981 if ((_res & 1) != 0) return;
15982 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15983 CHECK_ACCESS(_res_ptr);
15984 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
15986 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
15989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15990 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
15991 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15992 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
15993 return (uint64_t)ret_conv;
15996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15997 LDKFundingSigned o_conv;
15998 o_conv.inner = (void*)(o & (~1));
15999 o_conv.is_owned = (o & 1) || (o == 0);
16000 o_conv = FundingSigned_clone(&o_conv);
16001 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16002 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
16003 return (uint64_t)ret_conv;
16006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16007 LDKDecodeError e_conv;
16008 e_conv.inner = (void*)(e & (~1));
16009 e_conv.is_owned = (e & 1) || (e == 0);
16010 e_conv = DecodeError_clone(&e_conv);
16011 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16012 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
16013 return (uint64_t)ret_conv;
16016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16017 if ((_res & 1) != 0) return;
16018 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16019 CHECK_ACCESS(_res_ptr);
16020 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
16022 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
16025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16026 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
16027 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
16028 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
16029 return (uint64_t)ret_conv;
16032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16033 LDKFundingLocked o_conv;
16034 o_conv.inner = (void*)(o & (~1));
16035 o_conv.is_owned = (o & 1) || (o == 0);
16036 o_conv = FundingLocked_clone(&o_conv);
16037 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16038 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
16039 return (uint64_t)ret_conv;
16042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16043 LDKDecodeError e_conv;
16044 e_conv.inner = (void*)(e & (~1));
16045 e_conv.is_owned = (e & 1) || (e == 0);
16046 e_conv = DecodeError_clone(&e_conv);
16047 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16048 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
16049 return (uint64_t)ret_conv;
16052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16053 if ((_res & 1) != 0) return;
16054 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16055 CHECK_ACCESS(_res_ptr);
16056 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
16058 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
16061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16062 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
16063 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
16064 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
16065 return (uint64_t)ret_conv;
16068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16070 o_conv.inner = (void*)(o & (~1));
16071 o_conv.is_owned = (o & 1) || (o == 0);
16072 o_conv = Init_clone(&o_conv);
16073 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16074 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
16075 return (uint64_t)ret_conv;
16078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16079 LDKDecodeError e_conv;
16080 e_conv.inner = (void*)(e & (~1));
16081 e_conv.is_owned = (e & 1) || (e == 0);
16082 e_conv = DecodeError_clone(&e_conv);
16083 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16084 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
16085 return (uint64_t)ret_conv;
16088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16089 if ((_res & 1) != 0) return;
16090 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16091 CHECK_ACCESS(_res_ptr);
16092 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
16094 CResult_InitDecodeErrorZ_free(_res_conv);
16097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16098 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
16099 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
16100 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
16101 return (uint64_t)ret_conv;
16104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16105 LDKOpenChannel o_conv;
16106 o_conv.inner = (void*)(o & (~1));
16107 o_conv.is_owned = (o & 1) || (o == 0);
16108 o_conv = OpenChannel_clone(&o_conv);
16109 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16110 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
16111 return (uint64_t)ret_conv;
16114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16115 LDKDecodeError e_conv;
16116 e_conv.inner = (void*)(e & (~1));
16117 e_conv.is_owned = (e & 1) || (e == 0);
16118 e_conv = DecodeError_clone(&e_conv);
16119 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16120 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
16121 return (uint64_t)ret_conv;
16124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16125 if ((_res & 1) != 0) return;
16126 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16127 CHECK_ACCESS(_res_ptr);
16128 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
16130 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
16133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16134 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
16135 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
16136 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
16137 return (uint64_t)ret_conv;
16140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16141 LDKRevokeAndACK o_conv;
16142 o_conv.inner = (void*)(o & (~1));
16143 o_conv.is_owned = (o & 1) || (o == 0);
16144 o_conv = RevokeAndACK_clone(&o_conv);
16145 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16146 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
16147 return (uint64_t)ret_conv;
16150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16151 LDKDecodeError e_conv;
16152 e_conv.inner = (void*)(e & (~1));
16153 e_conv.is_owned = (e & 1) || (e == 0);
16154 e_conv = DecodeError_clone(&e_conv);
16155 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16156 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
16157 return (uint64_t)ret_conv;
16160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16161 if ((_res & 1) != 0) return;
16162 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16163 CHECK_ACCESS(_res_ptr);
16164 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
16166 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
16169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16170 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
16171 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
16172 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
16173 return (uint64_t)ret_conv;
16176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16177 LDKShutdown o_conv;
16178 o_conv.inner = (void*)(o & (~1));
16179 o_conv.is_owned = (o & 1) || (o == 0);
16180 o_conv = Shutdown_clone(&o_conv);
16181 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16182 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
16183 return (uint64_t)ret_conv;
16186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16187 LDKDecodeError e_conv;
16188 e_conv.inner = (void*)(e & (~1));
16189 e_conv.is_owned = (e & 1) || (e == 0);
16190 e_conv = DecodeError_clone(&e_conv);
16191 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16192 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
16193 return (uint64_t)ret_conv;
16196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16197 if ((_res & 1) != 0) return;
16198 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16199 CHECK_ACCESS(_res_ptr);
16200 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
16202 CResult_ShutdownDecodeErrorZ_free(_res_conv);
16205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16206 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
16207 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
16208 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
16209 return (uint64_t)ret_conv;
16212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16213 LDKUpdateFailHTLC o_conv;
16214 o_conv.inner = (void*)(o & (~1));
16215 o_conv.is_owned = (o & 1) || (o == 0);
16216 o_conv = UpdateFailHTLC_clone(&o_conv);
16217 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16218 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
16219 return (uint64_t)ret_conv;
16222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16223 LDKDecodeError e_conv;
16224 e_conv.inner = (void*)(e & (~1));
16225 e_conv.is_owned = (e & 1) || (e == 0);
16226 e_conv = DecodeError_clone(&e_conv);
16227 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16228 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
16229 return (uint64_t)ret_conv;
16232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16233 if ((_res & 1) != 0) return;
16234 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16235 CHECK_ACCESS(_res_ptr);
16236 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
16238 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
16241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16242 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
16243 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
16244 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
16245 return (uint64_t)ret_conv;
16248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16249 LDKUpdateFailMalformedHTLC o_conv;
16250 o_conv.inner = (void*)(o & (~1));
16251 o_conv.is_owned = (o & 1) || (o == 0);
16252 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
16253 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16254 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
16255 return (uint64_t)ret_conv;
16258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16259 LDKDecodeError e_conv;
16260 e_conv.inner = (void*)(e & (~1));
16261 e_conv.is_owned = (e & 1) || (e == 0);
16262 e_conv = DecodeError_clone(&e_conv);
16263 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16264 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
16265 return (uint64_t)ret_conv;
16268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16269 if ((_res & 1) != 0) return;
16270 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16271 CHECK_ACCESS(_res_ptr);
16272 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
16274 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
16277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16278 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
16279 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
16280 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
16281 return (uint64_t)ret_conv;
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16285 LDKUpdateFee o_conv;
16286 o_conv.inner = (void*)(o & (~1));
16287 o_conv.is_owned = (o & 1) || (o == 0);
16288 o_conv = UpdateFee_clone(&o_conv);
16289 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16290 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
16291 return (uint64_t)ret_conv;
16294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16295 LDKDecodeError e_conv;
16296 e_conv.inner = (void*)(e & (~1));
16297 e_conv.is_owned = (e & 1) || (e == 0);
16298 e_conv = DecodeError_clone(&e_conv);
16299 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16300 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
16301 return (uint64_t)ret_conv;
16304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16305 if ((_res & 1) != 0) return;
16306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16307 CHECK_ACCESS(_res_ptr);
16308 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
16310 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
16313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16314 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
16315 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
16316 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
16317 return (uint64_t)ret_conv;
16320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16321 LDKUpdateFulfillHTLC o_conv;
16322 o_conv.inner = (void*)(o & (~1));
16323 o_conv.is_owned = (o & 1) || (o == 0);
16324 o_conv = UpdateFulfillHTLC_clone(&o_conv);
16325 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16326 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
16327 return (uint64_t)ret_conv;
16330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16331 LDKDecodeError e_conv;
16332 e_conv.inner = (void*)(e & (~1));
16333 e_conv.is_owned = (e & 1) || (e == 0);
16334 e_conv = DecodeError_clone(&e_conv);
16335 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16336 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
16337 return (uint64_t)ret_conv;
16340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16341 if ((_res & 1) != 0) return;
16342 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16343 CHECK_ACCESS(_res_ptr);
16344 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
16346 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
16349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16350 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
16351 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
16352 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
16353 return (uint64_t)ret_conv;
16356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16357 LDKUpdateAddHTLC o_conv;
16358 o_conv.inner = (void*)(o & (~1));
16359 o_conv.is_owned = (o & 1) || (o == 0);
16360 o_conv = UpdateAddHTLC_clone(&o_conv);
16361 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16362 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
16363 return (uint64_t)ret_conv;
16366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16367 LDKDecodeError e_conv;
16368 e_conv.inner = (void*)(e & (~1));
16369 e_conv.is_owned = (e & 1) || (e == 0);
16370 e_conv = DecodeError_clone(&e_conv);
16371 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16372 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
16373 return (uint64_t)ret_conv;
16376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16377 if ((_res & 1) != 0) return;
16378 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16379 CHECK_ACCESS(_res_ptr);
16380 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
16382 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
16385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16386 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
16387 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
16388 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
16389 return (uint64_t)ret_conv;
16392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16394 o_conv.inner = (void*)(o & (~1));
16395 o_conv.is_owned = (o & 1) || (o == 0);
16396 o_conv = Ping_clone(&o_conv);
16397 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16398 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
16399 return (uint64_t)ret_conv;
16402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16403 LDKDecodeError e_conv;
16404 e_conv.inner = (void*)(e & (~1));
16405 e_conv.is_owned = (e & 1) || (e == 0);
16406 e_conv = DecodeError_clone(&e_conv);
16407 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16408 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
16409 return (uint64_t)ret_conv;
16412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16413 if ((_res & 1) != 0) return;
16414 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16415 CHECK_ACCESS(_res_ptr);
16416 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
16418 CResult_PingDecodeErrorZ_free(_res_conv);
16421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16422 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
16423 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
16424 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
16425 return (uint64_t)ret_conv;
16428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16430 o_conv.inner = (void*)(o & (~1));
16431 o_conv.is_owned = (o & 1) || (o == 0);
16432 o_conv = Pong_clone(&o_conv);
16433 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16434 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
16435 return (uint64_t)ret_conv;
16438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16439 LDKDecodeError e_conv;
16440 e_conv.inner = (void*)(e & (~1));
16441 e_conv.is_owned = (e & 1) || (e == 0);
16442 e_conv = DecodeError_clone(&e_conv);
16443 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16444 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
16445 return (uint64_t)ret_conv;
16448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16449 if ((_res & 1) != 0) return;
16450 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16451 CHECK_ACCESS(_res_ptr);
16452 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
16454 CResult_PongDecodeErrorZ_free(_res_conv);
16457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16458 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
16459 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
16460 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
16461 return (uint64_t)ret_conv;
16464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16465 LDKUnsignedChannelAnnouncement o_conv;
16466 o_conv.inner = (void*)(o & (~1));
16467 o_conv.is_owned = (o & 1) || (o == 0);
16468 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
16469 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16470 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
16471 return (uint64_t)ret_conv;
16474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16475 LDKDecodeError e_conv;
16476 e_conv.inner = (void*)(e & (~1));
16477 e_conv.is_owned = (e & 1) || (e == 0);
16478 e_conv = DecodeError_clone(&e_conv);
16479 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16480 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
16481 return (uint64_t)ret_conv;
16484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16485 if ((_res & 1) != 0) return;
16486 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16487 CHECK_ACCESS(_res_ptr);
16488 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
16490 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
16493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16494 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
16495 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
16496 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
16497 return (uint64_t)ret_conv;
16500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16501 LDKChannelAnnouncement o_conv;
16502 o_conv.inner = (void*)(o & (~1));
16503 o_conv.is_owned = (o & 1) || (o == 0);
16504 o_conv = ChannelAnnouncement_clone(&o_conv);
16505 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16506 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
16507 return (uint64_t)ret_conv;
16510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16511 LDKDecodeError e_conv;
16512 e_conv.inner = (void*)(e & (~1));
16513 e_conv.is_owned = (e & 1) || (e == 0);
16514 e_conv = DecodeError_clone(&e_conv);
16515 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16516 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
16517 return (uint64_t)ret_conv;
16520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16521 if ((_res & 1) != 0) return;
16522 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16523 CHECK_ACCESS(_res_ptr);
16524 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
16526 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
16529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16530 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
16531 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
16532 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
16533 return (uint64_t)ret_conv;
16536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16537 LDKUnsignedChannelUpdate o_conv;
16538 o_conv.inner = (void*)(o & (~1));
16539 o_conv.is_owned = (o & 1) || (o == 0);
16540 o_conv = UnsignedChannelUpdate_clone(&o_conv);
16541 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16542 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
16543 return (uint64_t)ret_conv;
16546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16547 LDKDecodeError e_conv;
16548 e_conv.inner = (void*)(e & (~1));
16549 e_conv.is_owned = (e & 1) || (e == 0);
16550 e_conv = DecodeError_clone(&e_conv);
16551 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16552 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
16553 return (uint64_t)ret_conv;
16556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16557 if ((_res & 1) != 0) return;
16558 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16559 CHECK_ACCESS(_res_ptr);
16560 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
16562 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
16565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16566 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
16567 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
16568 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
16569 return (uint64_t)ret_conv;
16572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16573 LDKChannelUpdate o_conv;
16574 o_conv.inner = (void*)(o & (~1));
16575 o_conv.is_owned = (o & 1) || (o == 0);
16576 o_conv = ChannelUpdate_clone(&o_conv);
16577 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16578 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
16579 return (uint64_t)ret_conv;
16582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16583 LDKDecodeError e_conv;
16584 e_conv.inner = (void*)(e & (~1));
16585 e_conv.is_owned = (e & 1) || (e == 0);
16586 e_conv = DecodeError_clone(&e_conv);
16587 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16588 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
16589 return (uint64_t)ret_conv;
16592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16593 if ((_res & 1) != 0) return;
16594 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16595 CHECK_ACCESS(_res_ptr);
16596 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
16598 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
16601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16602 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
16603 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
16604 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
16605 return (uint64_t)ret_conv;
16608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16609 LDKErrorMessage o_conv;
16610 o_conv.inner = (void*)(o & (~1));
16611 o_conv.is_owned = (o & 1) || (o == 0);
16612 o_conv = ErrorMessage_clone(&o_conv);
16613 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16614 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
16615 return (uint64_t)ret_conv;
16618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16619 LDKDecodeError e_conv;
16620 e_conv.inner = (void*)(e & (~1));
16621 e_conv.is_owned = (e & 1) || (e == 0);
16622 e_conv = DecodeError_clone(&e_conv);
16623 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16624 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
16625 return (uint64_t)ret_conv;
16628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16629 if ((_res & 1) != 0) return;
16630 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16631 CHECK_ACCESS(_res_ptr);
16632 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
16634 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
16637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16638 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
16639 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
16640 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
16641 return (uint64_t)ret_conv;
16644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16645 LDKUnsignedNodeAnnouncement o_conv;
16646 o_conv.inner = (void*)(o & (~1));
16647 o_conv.is_owned = (o & 1) || (o == 0);
16648 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
16649 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16650 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
16651 return (uint64_t)ret_conv;
16654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16655 LDKDecodeError e_conv;
16656 e_conv.inner = (void*)(e & (~1));
16657 e_conv.is_owned = (e & 1) || (e == 0);
16658 e_conv = DecodeError_clone(&e_conv);
16659 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16660 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
16661 return (uint64_t)ret_conv;
16664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16665 if ((_res & 1) != 0) return;
16666 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16667 CHECK_ACCESS(_res_ptr);
16668 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
16670 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
16673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16674 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
16675 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
16676 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
16677 return (uint64_t)ret_conv;
16680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16681 LDKNodeAnnouncement o_conv;
16682 o_conv.inner = (void*)(o & (~1));
16683 o_conv.is_owned = (o & 1) || (o == 0);
16684 o_conv = NodeAnnouncement_clone(&o_conv);
16685 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16686 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
16687 return (uint64_t)ret_conv;
16690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16691 LDKDecodeError e_conv;
16692 e_conv.inner = (void*)(e & (~1));
16693 e_conv.is_owned = (e & 1) || (e == 0);
16694 e_conv = DecodeError_clone(&e_conv);
16695 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16696 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
16697 return (uint64_t)ret_conv;
16700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16701 if ((_res & 1) != 0) return;
16702 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16703 CHECK_ACCESS(_res_ptr);
16704 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
16706 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
16709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16710 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
16711 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
16712 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
16713 return (uint64_t)ret_conv;
16716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16717 LDKQueryShortChannelIds o_conv;
16718 o_conv.inner = (void*)(o & (~1));
16719 o_conv.is_owned = (o & 1) || (o == 0);
16720 o_conv = QueryShortChannelIds_clone(&o_conv);
16721 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16722 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
16723 return (uint64_t)ret_conv;
16726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16727 LDKDecodeError e_conv;
16728 e_conv.inner = (void*)(e & (~1));
16729 e_conv.is_owned = (e & 1) || (e == 0);
16730 e_conv = DecodeError_clone(&e_conv);
16731 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16732 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
16733 return (uint64_t)ret_conv;
16736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16737 if ((_res & 1) != 0) return;
16738 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16739 CHECK_ACCESS(_res_ptr);
16740 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
16742 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
16745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16746 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
16747 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
16748 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
16749 return (uint64_t)ret_conv;
16752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16753 LDKReplyShortChannelIdsEnd o_conv;
16754 o_conv.inner = (void*)(o & (~1));
16755 o_conv.is_owned = (o & 1) || (o == 0);
16756 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
16757 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16758 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
16759 return (uint64_t)ret_conv;
16762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16763 LDKDecodeError e_conv;
16764 e_conv.inner = (void*)(e & (~1));
16765 e_conv.is_owned = (e & 1) || (e == 0);
16766 e_conv = DecodeError_clone(&e_conv);
16767 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16768 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
16769 return (uint64_t)ret_conv;
16772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16773 if ((_res & 1) != 0) return;
16774 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16775 CHECK_ACCESS(_res_ptr);
16776 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
16778 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
16781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16782 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
16783 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
16784 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
16785 return (uint64_t)ret_conv;
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16789 LDKQueryChannelRange o_conv;
16790 o_conv.inner = (void*)(o & (~1));
16791 o_conv.is_owned = (o & 1) || (o == 0);
16792 o_conv = QueryChannelRange_clone(&o_conv);
16793 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16794 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
16795 return (uint64_t)ret_conv;
16798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16799 LDKDecodeError e_conv;
16800 e_conv.inner = (void*)(e & (~1));
16801 e_conv.is_owned = (e & 1) || (e == 0);
16802 e_conv = DecodeError_clone(&e_conv);
16803 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16804 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
16805 return (uint64_t)ret_conv;
16808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16809 if ((_res & 1) != 0) return;
16810 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16811 CHECK_ACCESS(_res_ptr);
16812 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
16814 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
16817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16818 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
16819 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
16820 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
16821 return (uint64_t)ret_conv;
16824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16825 LDKReplyChannelRange o_conv;
16826 o_conv.inner = (void*)(o & (~1));
16827 o_conv.is_owned = (o & 1) || (o == 0);
16828 o_conv = ReplyChannelRange_clone(&o_conv);
16829 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16830 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
16831 return (uint64_t)ret_conv;
16834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16835 LDKDecodeError e_conv;
16836 e_conv.inner = (void*)(e & (~1));
16837 e_conv.is_owned = (e & 1) || (e == 0);
16838 e_conv = DecodeError_clone(&e_conv);
16839 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16840 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
16841 return (uint64_t)ret_conv;
16844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16845 if ((_res & 1) != 0) return;
16846 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16847 CHECK_ACCESS(_res_ptr);
16848 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
16850 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16854 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
16855 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16856 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
16857 return (uint64_t)ret_conv;
16860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16861 LDKGossipTimestampFilter o_conv;
16862 o_conv.inner = (void*)(o & (~1));
16863 o_conv.is_owned = (o & 1) || (o == 0);
16864 o_conv = GossipTimestampFilter_clone(&o_conv);
16865 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16866 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
16867 return (uint64_t)ret_conv;
16870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16871 LDKDecodeError e_conv;
16872 e_conv.inner = (void*)(e & (~1));
16873 e_conv.is_owned = (e & 1) || (e == 0);
16874 e_conv = DecodeError_clone(&e_conv);
16875 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16876 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
16877 return (uint64_t)ret_conv;
16880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16881 if ((_res & 1) != 0) return;
16882 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16883 CHECK_ACCESS(_res_ptr);
16884 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
16886 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
16889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16890 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
16891 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16892 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
16893 return (uint64_t)ret_conv;
16896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16898 o_conv.inner = (void*)(o & (~1));
16899 o_conv.is_owned = (o & 1) || (o == 0);
16900 o_conv = Invoice_clone(&o_conv);
16901 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16902 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
16903 return (uint64_t)ret_conv;
16906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16907 void* e_ptr = (void*)(((uint64_t)e) & ~1);
16908 CHECK_ACCESS(e_ptr);
16909 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
16910 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
16911 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16912 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
16913 return (uint64_t)ret_conv;
16916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16917 if ((_res & 1) != 0) return;
16918 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16919 CHECK_ACCESS(_res_ptr);
16920 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
16922 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
16925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16926 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
16927 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
16928 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
16929 return (uint64_t)ret_conv;
16932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16933 void* o_ptr = (void*)(((uint64_t)o) & ~1);
16934 CHECK_ACCESS(o_ptr);
16935 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
16936 if (o_conv.free == LDKFilter_JCalls_free) {
16937 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16938 LDKFilter_JCalls_cloned(&o_conv);
16940 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
16941 *ret_copy = COption_FilterZ_some(o_conv);
16942 uint64_t ret_ref = (uint64_t)ret_copy;
16946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
16947 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
16948 *ret_copy = COption_FilterZ_none();
16949 uint64_t ret_ref = (uint64_t)ret_copy;
16953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16954 if ((_res & 1) != 0) return;
16955 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16956 CHECK_ACCESS(_res_ptr);
16957 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
16959 COption_FilterZ_free(_res_conv);
16962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16963 LDKLockedChannelMonitor o_conv;
16964 o_conv.inner = (void*)(o & (~1));
16965 o_conv.is_owned = (o & 1) || (o == 0);
16966 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
16967 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
16968 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
16969 return (uint64_t)ret_conv;
16972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
16973 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
16974 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
16975 return (uint64_t)ret_conv;
16978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16979 if ((_res & 1) != 0) return;
16980 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16981 CHECK_ACCESS(_res_ptr);
16982 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
16984 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
16987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16988 LDKCVec_OutPointZ _res_constr;
16989 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16990 if (_res_constr.datalen > 0)
16991 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
16993 _res_constr.data = NULL;
16994 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16995 for (size_t k = 0; k < _res_constr.datalen; k++) {
16996 int64_t _res_conv_10 = _res_vals[k];
16997 LDKOutPoint _res_conv_10_conv;
16998 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
16999 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
17000 _res_constr.data[k] = _res_conv_10_conv;
17002 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17003 CVec_OutPointZ_free(_res_constr);
17006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17007 if ((this_ptr & 1) != 0) return;
17008 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17009 CHECK_ACCESS(this_ptr_ptr);
17010 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
17011 FREE((void*)this_ptr);
17012 PaymentPurpose_free(this_ptr_conv);
17015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17016 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
17017 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
17018 *ret_copy = PaymentPurpose_clone(orig_conv);
17019 uint64_t ret_ref = (uint64_t)ret_copy;
17023 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) {
17024 LDKThirtyTwoBytes payment_preimage_ref;
17025 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17026 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17027 LDKThirtyTwoBytes payment_secret_ref;
17028 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
17029 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
17030 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
17031 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
17032 uint64_t ret_ref = (uint64_t)ret_copy;
17036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
17037 LDKThirtyTwoBytes a_ref;
17038 CHECK((*env)->GetArrayLength(env, a) == 32);
17039 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17040 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
17041 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
17042 uint64_t ret_ref = (uint64_t)ret_copy;
17046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17047 if ((this_ptr & 1) != 0) return;
17048 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17049 CHECK_ACCESS(this_ptr_ptr);
17050 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
17051 FREE((void*)this_ptr);
17052 ClosureReason_free(this_ptr_conv);
17055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17056 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
17057 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17058 *ret_copy = ClosureReason_clone(orig_conv);
17059 uint64_t ret_ref = (uint64_t)ret_copy;
17063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
17064 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
17065 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17066 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
17067 uint64_t ret_ref = (uint64_t)ret_copy;
17071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
17072 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17073 *ret_copy = ClosureReason_holder_force_closed();
17074 uint64_t ret_ref = (uint64_t)ret_copy;
17078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
17079 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17080 *ret_copy = ClosureReason_cooperative_closure();
17081 uint64_t ret_ref = (uint64_t)ret_copy;
17085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
17086 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17087 *ret_copy = ClosureReason_commitment_tx_confirmed();
17088 uint64_t ret_ref = (uint64_t)ret_copy;
17092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
17093 LDKStr err_conv = java_to_owned_str(env, err);
17094 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17095 *ret_copy = ClosureReason_processing_error(err_conv);
17096 uint64_t ret_ref = (uint64_t)ret_copy;
17100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
17101 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17102 *ret_copy = ClosureReason_disconnected_peer();
17103 uint64_t ret_ref = (uint64_t)ret_copy;
17107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
17108 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
17109 *ret_copy = ClosureReason_outdated_channel_manager();
17110 uint64_t ret_ref = (uint64_t)ret_copy;
17114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
17115 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
17116 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
17117 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17118 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17119 CVec_u8Z_free(ret_var);
17123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17124 if ((this_ptr & 1) != 0) return;
17125 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17126 CHECK_ACCESS(this_ptr_ptr);
17127 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
17128 FREE((void*)this_ptr);
17129 Event_free(this_ptr_conv);
17132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17133 LDKEvent* orig_conv = (LDKEvent*)orig;
17134 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17135 *ret_copy = Event_clone(orig_conv);
17136 uint64_t ret_ref = (uint64_t)ret_copy;
17140 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) {
17141 LDKThirtyTwoBytes temporary_channel_id_ref;
17142 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
17143 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
17144 LDKCVec_u8Z output_script_ref;
17145 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
17146 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
17147 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
17148 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17149 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
17150 uint64_t ret_ref = (uint64_t)ret_copy;
17154 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) {
17155 LDKThirtyTwoBytes payment_hash_ref;
17156 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17157 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17158 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
17159 CHECK_ACCESS(purpose_ptr);
17160 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
17161 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
17162 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17163 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
17164 uint64_t ret_ref = (uint64_t)ret_copy;
17168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
17169 LDKThirtyTwoBytes payment_id_ref;
17170 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
17171 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
17172 LDKThirtyTwoBytes payment_preimage_ref;
17173 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17174 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17175 LDKThirtyTwoBytes payment_hash_ref;
17176 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17177 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17178 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
17179 CHECK_ACCESS(fee_paid_msat_ptr);
17180 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
17181 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
17182 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17183 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
17184 uint64_t ret_ref = (uint64_t)ret_copy;
17188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
17189 LDKThirtyTwoBytes payment_id_ref;
17190 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
17191 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
17192 LDKThirtyTwoBytes payment_hash_ref;
17193 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17194 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17195 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
17196 CHECK_ACCESS(network_update_ptr);
17197 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
17198 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
17199 LDKCVec_RouteHopZ path_constr;
17200 path_constr.datalen = (*env)->GetArrayLength(env, path);
17201 if (path_constr.datalen > 0)
17202 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17204 path_constr.data = NULL;
17205 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
17206 for (size_t k = 0; k < path_constr.datalen; k++) {
17207 int64_t path_conv_10 = path_vals[k];
17208 LDKRouteHop path_conv_10_conv;
17209 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
17210 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
17211 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
17212 path_constr.data[k] = path_conv_10_conv;
17214 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
17215 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
17216 CHECK_ACCESS(short_channel_id_ptr);
17217 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
17218 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
17219 LDKRouteParameters retry_conv;
17220 retry_conv.inner = (void*)(retry & (~1));
17221 retry_conv.is_owned = (retry & 1) || (retry == 0);
17222 retry_conv = RouteParameters_clone(&retry_conv);
17223 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17224 *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
17225 uint64_t ret_ref = (uint64_t)ret_copy;
17229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
17230 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17231 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
17232 uint64_t ret_ref = (uint64_t)ret_copy;
17236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
17237 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
17238 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17239 if (outputs_constr.datalen > 0)
17240 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17242 outputs_constr.data = NULL;
17243 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17244 for (size_t b = 0; b < outputs_constr.datalen; b++) {
17245 int64_t outputs_conv_27 = outputs_vals[b];
17246 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
17247 CHECK_ACCESS(outputs_conv_27_ptr);
17248 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
17249 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
17250 outputs_constr.data[b] = outputs_conv_27_conv;
17252 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17253 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17254 *ret_copy = Event_spendable_outputs(outputs_constr);
17255 uint64_t ret_ref = (uint64_t)ret_copy;
17259 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) {
17260 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
17261 CHECK_ACCESS(fee_earned_msat_ptr);
17262 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
17263 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
17264 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17265 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
17266 uint64_t ret_ref = (uint64_t)ret_copy;
17270 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) {
17271 LDKThirtyTwoBytes channel_id_ref;
17272 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17273 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
17274 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
17275 CHECK_ACCESS(reason_ptr);
17276 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
17277 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
17278 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17279 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
17280 uint64_t ret_ref = (uint64_t)ret_copy;
17284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
17285 LDKThirtyTwoBytes channel_id_ref;
17286 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17287 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
17288 LDKTransaction transaction_ref;
17289 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
17290 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
17291 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
17292 transaction_ref.data_is_owned = true;
17293 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17294 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
17295 uint64_t ret_ref = (uint64_t)ret_copy;
17299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
17300 LDKEvent* obj_conv = (LDKEvent*)obj;
17301 LDKCVec_u8Z ret_var = Event_write(obj_conv);
17302 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17303 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17304 CVec_u8Z_free(ret_var);
17308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17309 if ((this_ptr & 1) != 0) return;
17310 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17311 CHECK_ACCESS(this_ptr_ptr);
17312 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
17313 FREE((void*)this_ptr);
17314 MessageSendEvent_free(this_ptr_conv);
17317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17318 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
17319 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17320 *ret_copy = MessageSendEvent_clone(orig_conv);
17321 uint64_t ret_ref = (uint64_t)ret_copy;
17325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17326 LDKPublicKey node_id_ref;
17327 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17328 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17329 LDKAcceptChannel msg_conv;
17330 msg_conv.inner = (void*)(msg & (~1));
17331 msg_conv.is_owned = (msg & 1) || (msg == 0);
17332 msg_conv = AcceptChannel_clone(&msg_conv);
17333 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17334 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
17335 uint64_t ret_ref = (uint64_t)ret_copy;
17339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17340 LDKPublicKey node_id_ref;
17341 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17342 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17343 LDKOpenChannel msg_conv;
17344 msg_conv.inner = (void*)(msg & (~1));
17345 msg_conv.is_owned = (msg & 1) || (msg == 0);
17346 msg_conv = OpenChannel_clone(&msg_conv);
17347 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17348 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
17349 uint64_t ret_ref = (uint64_t)ret_copy;
17353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17354 LDKPublicKey node_id_ref;
17355 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17356 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17357 LDKFundingCreated msg_conv;
17358 msg_conv.inner = (void*)(msg & (~1));
17359 msg_conv.is_owned = (msg & 1) || (msg == 0);
17360 msg_conv = FundingCreated_clone(&msg_conv);
17361 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17362 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
17363 uint64_t ret_ref = (uint64_t)ret_copy;
17367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17368 LDKPublicKey node_id_ref;
17369 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17370 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17371 LDKFundingSigned msg_conv;
17372 msg_conv.inner = (void*)(msg & (~1));
17373 msg_conv.is_owned = (msg & 1) || (msg == 0);
17374 msg_conv = FundingSigned_clone(&msg_conv);
17375 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17376 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
17377 uint64_t ret_ref = (uint64_t)ret_copy;
17381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17382 LDKPublicKey node_id_ref;
17383 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17384 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17385 LDKFundingLocked msg_conv;
17386 msg_conv.inner = (void*)(msg & (~1));
17387 msg_conv.is_owned = (msg & 1) || (msg == 0);
17388 msg_conv = FundingLocked_clone(&msg_conv);
17389 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17390 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
17391 uint64_t ret_ref = (uint64_t)ret_copy;
17395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17396 LDKPublicKey node_id_ref;
17397 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17398 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17399 LDKAnnouncementSignatures msg_conv;
17400 msg_conv.inner = (void*)(msg & (~1));
17401 msg_conv.is_owned = (msg & 1) || (msg == 0);
17402 msg_conv = AnnouncementSignatures_clone(&msg_conv);
17403 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17404 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
17405 uint64_t ret_ref = (uint64_t)ret_copy;
17409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
17410 LDKPublicKey node_id_ref;
17411 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17412 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17413 LDKCommitmentUpdate updates_conv;
17414 updates_conv.inner = (void*)(updates & (~1));
17415 updates_conv.is_owned = (updates & 1) || (updates == 0);
17416 updates_conv = CommitmentUpdate_clone(&updates_conv);
17417 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17418 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
17419 uint64_t ret_ref = (uint64_t)ret_copy;
17423 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) {
17424 LDKPublicKey node_id_ref;
17425 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17426 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17427 LDKRevokeAndACK msg_conv;
17428 msg_conv.inner = (void*)(msg & (~1));
17429 msg_conv.is_owned = (msg & 1) || (msg == 0);
17430 msg_conv = RevokeAndACK_clone(&msg_conv);
17431 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17432 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
17433 uint64_t ret_ref = (uint64_t)ret_copy;
17437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17438 LDKPublicKey node_id_ref;
17439 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17440 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17441 LDKClosingSigned msg_conv;
17442 msg_conv.inner = (void*)(msg & (~1));
17443 msg_conv.is_owned = (msg & 1) || (msg == 0);
17444 msg_conv = ClosingSigned_clone(&msg_conv);
17445 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17446 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
17447 uint64_t ret_ref = (uint64_t)ret_copy;
17451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17452 LDKPublicKey node_id_ref;
17453 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17454 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17455 LDKShutdown msg_conv;
17456 msg_conv.inner = (void*)(msg & (~1));
17457 msg_conv.is_owned = (msg & 1) || (msg == 0);
17458 msg_conv = Shutdown_clone(&msg_conv);
17459 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17460 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
17461 uint64_t ret_ref = (uint64_t)ret_copy;
17465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17466 LDKPublicKey node_id_ref;
17467 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17468 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17469 LDKChannelReestablish msg_conv;
17470 msg_conv.inner = (void*)(msg & (~1));
17471 msg_conv.is_owned = (msg & 1) || (msg == 0);
17472 msg_conv = ChannelReestablish_clone(&msg_conv);
17473 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17474 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
17475 uint64_t ret_ref = (uint64_t)ret_copy;
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
17480 LDKChannelAnnouncement msg_conv;
17481 msg_conv.inner = (void*)(msg & (~1));
17482 msg_conv.is_owned = (msg & 1) || (msg == 0);
17483 msg_conv = ChannelAnnouncement_clone(&msg_conv);
17484 LDKChannelUpdate update_msg_conv;
17485 update_msg_conv.inner = (void*)(update_msg & (~1));
17486 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
17487 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
17488 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17489 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
17490 uint64_t ret_ref = (uint64_t)ret_copy;
17494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
17495 LDKNodeAnnouncement msg_conv;
17496 msg_conv.inner = (void*)(msg & (~1));
17497 msg_conv.is_owned = (msg & 1) || (msg == 0);
17498 msg_conv = NodeAnnouncement_clone(&msg_conv);
17499 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17500 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
17501 uint64_t ret_ref = (uint64_t)ret_copy;
17505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
17506 LDKChannelUpdate msg_conv;
17507 msg_conv.inner = (void*)(msg & (~1));
17508 msg_conv.is_owned = (msg & 1) || (msg == 0);
17509 msg_conv = ChannelUpdate_clone(&msg_conv);
17510 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17511 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
17512 uint64_t ret_ref = (uint64_t)ret_copy;
17516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
17517 LDKPublicKey node_id_ref;
17518 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17519 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17520 LDKChannelUpdate msg_conv;
17521 msg_conv.inner = (void*)(msg & (~1));
17522 msg_conv.is_owned = (msg & 1) || (msg == 0);
17523 msg_conv = ChannelUpdate_clone(&msg_conv);
17524 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17525 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
17526 uint64_t ret_ref = (uint64_t)ret_copy;
17530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
17531 LDKPublicKey node_id_ref;
17532 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17533 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17534 void* action_ptr = (void*)(((uint64_t)action) & ~1);
17535 CHECK_ACCESS(action_ptr);
17536 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
17537 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
17538 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17539 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
17540 uint64_t ret_ref = (uint64_t)ret_copy;
17544 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) {
17545 LDKPublicKey node_id_ref;
17546 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17547 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17548 LDKQueryChannelRange msg_conv;
17549 msg_conv.inner = (void*)(msg & (~1));
17550 msg_conv.is_owned = (msg & 1) || (msg == 0);
17551 msg_conv = QueryChannelRange_clone(&msg_conv);
17552 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17553 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
17554 uint64_t ret_ref = (uint64_t)ret_copy;
17558 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) {
17559 LDKPublicKey node_id_ref;
17560 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17561 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17562 LDKQueryShortChannelIds msg_conv;
17563 msg_conv.inner = (void*)(msg & (~1));
17564 msg_conv.is_owned = (msg & 1) || (msg == 0);
17565 msg_conv = QueryShortChannelIds_clone(&msg_conv);
17566 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17567 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
17568 uint64_t ret_ref = (uint64_t)ret_copy;
17572 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) {
17573 LDKPublicKey node_id_ref;
17574 CHECK((*env)->GetArrayLength(env, node_id) == 33);
17575 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
17576 LDKReplyChannelRange msg_conv;
17577 msg_conv.inner = (void*)(msg & (~1));
17578 msg_conv.is_owned = (msg & 1) || (msg == 0);
17579 msg_conv = ReplyChannelRange_clone(&msg_conv);
17580 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17581 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
17582 uint64_t ret_ref = (uint64_t)ret_copy;
17586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17587 if ((this_ptr & 1) != 0) return;
17588 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17589 CHECK_ACCESS(this_ptr_ptr);
17590 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
17591 FREE((void*)this_ptr);
17592 MessageSendEventsProvider_free(this_ptr_conv);
17595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17596 if ((this_ptr & 1) != 0) return;
17597 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17598 CHECK_ACCESS(this_ptr_ptr);
17599 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
17600 FREE((void*)this_ptr);
17601 EventsProvider_free(this_ptr_conv);
17604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17605 if ((this_ptr & 1) != 0) return;
17606 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17607 CHECK_ACCESS(this_ptr_ptr);
17608 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
17609 FREE((void*)this_ptr);
17610 EventHandler_free(this_ptr_conv);
17613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17614 if ((this_ptr & 1) != 0) return;
17615 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17616 CHECK_ACCESS(this_ptr_ptr);
17617 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
17618 FREE((void*)this_ptr);
17619 APIError_free(this_ptr_conv);
17622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17623 LDKAPIError* orig_conv = (LDKAPIError*)orig;
17624 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17625 *ret_copy = APIError_clone(orig_conv);
17626 uint64_t ret_ref = (uint64_t)ret_copy;
17630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
17631 LDKStr err_conv = java_to_owned_str(env, err);
17632 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17633 *ret_copy = APIError_apimisuse_error(err_conv);
17634 uint64_t ret_ref = (uint64_t)ret_copy;
17638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
17639 LDKStr err_conv = java_to_owned_str(env, err);
17640 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17641 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
17642 uint64_t ret_ref = (uint64_t)ret_copy;
17646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
17647 LDKStr err_conv = java_to_owned_str(env, err);
17648 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17649 *ret_copy = APIError_route_error(err_conv);
17650 uint64_t ret_ref = (uint64_t)ret_copy;
17654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
17655 LDKStr err_conv = java_to_owned_str(env, err);
17656 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17657 *ret_copy = APIError_channel_unavailable(err_conv);
17658 uint64_t ret_ref = (uint64_t)ret_copy;
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
17663 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17664 *ret_copy = APIError_monitor_update_failed();
17665 uint64_t ret_ref = (uint64_t)ret_copy;
17669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
17670 LDKShutdownScript script_conv;
17671 script_conv.inner = (void*)(script & (~1));
17672 script_conv.is_owned = (script & 1) || (script == 0);
17673 script_conv = ShutdownScript_clone(&script_conv);
17674 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
17675 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
17676 uint64_t ret_ref = (uint64_t)ret_copy;
17680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
17681 LDKu8slice msg_ref;
17682 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
17683 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
17684 unsigned char sk_arr[32];
17685 CHECK((*env)->GetArrayLength(env, sk) == 32);
17686 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
17687 unsigned char (*sk_ref)[32] = &sk_arr;
17688 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17689 *ret_conv = sign(msg_ref, sk_ref);
17690 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
17691 return (uint64_t)ret_conv;
17694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
17695 LDKu8slice msg_ref;
17696 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
17697 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
17698 LDKStr sig_conv = java_to_owned_str(env, sig);
17699 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17700 *ret_conv = recover_pk(msg_ref, sig_conv);
17701 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
17702 return (uint64_t)ret_conv;
17705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
17706 LDKu8slice msg_ref;
17707 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
17708 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
17709 LDKStr sig_conv = java_to_owned_str(env, sig);
17710 LDKPublicKey pk_ref;
17711 CHECK((*env)->GetArrayLength(env, pk) == 33);
17712 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
17713 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
17714 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
17718 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17719 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
17720 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
17724 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
17725 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
17729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
17730 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
17734 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
17735 jclass ret_conv = LDKLevel_to_java(env, Level_info());
17739 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
17740 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
17744 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
17745 jclass ret_conv = LDKLevel_to_java(env, Level_error());
17749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17750 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
17751 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
17752 jboolean ret_val = Level_eq(a_conv, b_conv);
17756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
17757 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
17758 int64_t ret_val = Level_hash(o_conv);
17762 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
17763 jclass ret_conv = LDKLevel_to_java(env, Level_max());
17767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17768 if ((this_ptr & 1) != 0) return;
17769 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17770 CHECK_ACCESS(this_ptr_ptr);
17771 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17772 FREE((void*)this_ptr);
17773 Logger_free(this_ptr_conv);
17776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17777 LDKChannelHandshakeConfig this_obj_conv;
17778 this_obj_conv.inner = (void*)(this_obj & (~1));
17779 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17780 ChannelHandshakeConfig_free(this_obj_conv);
17783 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
17784 LDKChannelHandshakeConfig this_ptr_conv;
17785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17786 this_ptr_conv.is_owned = false;
17787 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17792 LDKChannelHandshakeConfig this_ptr_conv;
17793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17794 this_ptr_conv.is_owned = false;
17795 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17798 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17799 LDKChannelHandshakeConfig this_ptr_conv;
17800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17801 this_ptr_conv.is_owned = false;
17802 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17806 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) {
17807 LDKChannelHandshakeConfig this_ptr_conv;
17808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17809 this_ptr_conv.is_owned = false;
17810 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17814 LDKChannelHandshakeConfig this_ptr_conv;
17815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17816 this_ptr_conv.is_owned = false;
17817 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17821 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) {
17822 LDKChannelHandshakeConfig this_ptr_conv;
17823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17824 this_ptr_conv.is_owned = false;
17825 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17828 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) {
17829 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17830 uint64_t ret_ref = 0;
17831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17833 ret_ref = (uint64_t)ret_var.inner;
17834 if (ret_var.is_owned) {
17840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17841 LDKChannelHandshakeConfig orig_conv;
17842 orig_conv.inner = (void*)(orig & (~1));
17843 orig_conv.is_owned = false;
17844 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17845 uint64_t ret_ref = 0;
17846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17848 ret_ref = (uint64_t)ret_var.inner;
17849 if (ret_var.is_owned) {
17855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
17856 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17857 uint64_t ret_ref = 0;
17858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17860 ret_ref = (uint64_t)ret_var.inner;
17861 if (ret_var.is_owned) {
17867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17868 LDKChannelHandshakeLimits this_obj_conv;
17869 this_obj_conv.inner = (void*)(this_obj & (~1));
17870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17871 ChannelHandshakeLimits_free(this_obj_conv);
17874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17875 LDKChannelHandshakeLimits this_ptr_conv;
17876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17877 this_ptr_conv.is_owned = false;
17878 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17883 LDKChannelHandshakeLimits this_ptr_conv;
17884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17885 this_ptr_conv.is_owned = false;
17886 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17890 LDKChannelHandshakeLimits this_ptr_conv;
17891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17892 this_ptr_conv.is_owned = false;
17893 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17897 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) {
17898 LDKChannelHandshakeLimits this_ptr_conv;
17899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17900 this_ptr_conv.is_owned = false;
17901 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17904 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) {
17905 LDKChannelHandshakeLimits this_ptr_conv;
17906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17907 this_ptr_conv.is_owned = false;
17908 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17912 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) {
17913 LDKChannelHandshakeLimits this_ptr_conv;
17914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17915 this_ptr_conv.is_owned = false;
17916 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17920 LDKChannelHandshakeLimits this_ptr_conv;
17921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17922 this_ptr_conv.is_owned = false;
17923 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17927 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) {
17928 LDKChannelHandshakeLimits this_ptr_conv;
17929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17930 this_ptr_conv.is_owned = false;
17931 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17934 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
17935 LDKChannelHandshakeLimits this_ptr_conv;
17936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17937 this_ptr_conv.is_owned = false;
17938 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17942 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) {
17943 LDKChannelHandshakeLimits this_ptr_conv;
17944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17945 this_ptr_conv.is_owned = false;
17946 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17949 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
17950 LDKChannelHandshakeLimits this_ptr_conv;
17951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17952 this_ptr_conv.is_owned = false;
17953 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17958 LDKChannelHandshakeLimits this_ptr_conv;
17959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17960 this_ptr_conv.is_owned = false;
17961 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
17965 LDKChannelHandshakeLimits this_ptr_conv;
17966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17967 this_ptr_conv.is_owned = false;
17968 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
17973 LDKChannelHandshakeLimits this_ptr_conv;
17974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17975 this_ptr_conv.is_owned = false;
17976 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17979 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17980 LDKChannelHandshakeLimits this_ptr_conv;
17981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17982 this_ptr_conv.is_owned = false;
17983 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17987 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) {
17988 LDKChannelHandshakeLimits this_ptr_conv;
17989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17990 this_ptr_conv.is_owned = false;
17991 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17994 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) {
17995 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);
17996 uint64_t ret_ref = 0;
17997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17999 ret_ref = (uint64_t)ret_var.inner;
18000 if (ret_var.is_owned) {
18006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18007 LDKChannelHandshakeLimits orig_conv;
18008 orig_conv.inner = (void*)(orig & (~1));
18009 orig_conv.is_owned = false;
18010 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
18011 uint64_t ret_ref = 0;
18012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18014 ret_ref = (uint64_t)ret_var.inner;
18015 if (ret_var.is_owned) {
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
18022 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
18023 uint64_t ret_ref = 0;
18024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18026 ret_ref = (uint64_t)ret_var.inner;
18027 if (ret_var.is_owned) {
18033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18034 LDKChannelConfig this_obj_conv;
18035 this_obj_conv.inner = (void*)(this_obj & (~1));
18036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18037 ChannelConfig_free(this_obj_conv);
18040 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18041 LDKChannelConfig this_ptr_conv;
18042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18043 this_ptr_conv.is_owned = false;
18044 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
18048 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) {
18049 LDKChannelConfig this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
18055 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18056 LDKChannelConfig this_ptr_conv;
18057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18058 this_ptr_conv.is_owned = false;
18059 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
18063 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) {
18064 LDKChannelConfig this_ptr_conv;
18065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18066 this_ptr_conv.is_owned = false;
18067 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
18070 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18071 LDKChannelConfig this_ptr_conv;
18072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18073 this_ptr_conv.is_owned = false;
18074 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
18078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18079 LDKChannelConfig this_ptr_conv;
18080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18081 this_ptr_conv.is_owned = false;
18082 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
18085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
18086 LDKChannelConfig this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
18093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18094 LDKChannelConfig this_ptr_conv;
18095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18096 this_ptr_conv.is_owned = false;
18097 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
18100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18101 LDKChannelConfig this_ptr_conv;
18102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18103 this_ptr_conv.is_owned = false;
18104 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
18108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18109 LDKChannelConfig this_ptr_conv;
18110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18111 this_ptr_conv.is_owned = false;
18112 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
18115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18116 LDKChannelConfig this_ptr_conv;
18117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18118 this_ptr_conv.is_owned = false;
18119 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
18123 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) {
18124 LDKChannelConfig this_ptr_conv;
18125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18126 this_ptr_conv.is_owned = false;
18127 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
18130 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) {
18131 LDKChannelConfig this_ptr_conv;
18132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18133 this_ptr_conv.is_owned = false;
18134 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
18138 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) {
18139 LDKChannelConfig this_ptr_conv;
18140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18141 this_ptr_conv.is_owned = false;
18142 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
18145 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) {
18146 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);
18147 uint64_t ret_ref = 0;
18148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18150 ret_ref = (uint64_t)ret_var.inner;
18151 if (ret_var.is_owned) {
18157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18158 LDKChannelConfig orig_conv;
18159 orig_conv.inner = (void*)(orig & (~1));
18160 orig_conv.is_owned = false;
18161 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
18162 uint64_t ret_ref = 0;
18163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18165 ret_ref = (uint64_t)ret_var.inner;
18166 if (ret_var.is_owned) {
18172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
18173 LDKChannelConfig ret_var = ChannelConfig_default();
18174 uint64_t ret_ref = 0;
18175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18177 ret_ref = (uint64_t)ret_var.inner;
18178 if (ret_var.is_owned) {
18184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
18185 LDKChannelConfig obj_conv;
18186 obj_conv.inner = (void*)(obj & (~1));
18187 obj_conv.is_owned = false;
18188 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
18189 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18190 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18191 CVec_u8Z_free(ret_var);
18195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18196 LDKu8slice ser_ref;
18197 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18198 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18199 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18200 *ret_conv = ChannelConfig_read(ser_ref);
18201 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18202 return (uint64_t)ret_conv;
18205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18206 LDKUserConfig this_obj_conv;
18207 this_obj_conv.inner = (void*)(this_obj & (~1));
18208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18209 UserConfig_free(this_obj_conv);
18212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
18213 LDKUserConfig this_ptr_conv;
18214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18215 this_ptr_conv.is_owned = false;
18216 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
18217 uint64_t ret_ref = 0;
18218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18220 ret_ref = (uint64_t)ret_var.inner;
18221 if (ret_var.is_owned) {
18227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18228 LDKUserConfig this_ptr_conv;
18229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18230 this_ptr_conv.is_owned = false;
18231 LDKChannelHandshakeConfig val_conv;
18232 val_conv.inner = (void*)(val & (~1));
18233 val_conv.is_owned = (val & 1) || (val == 0);
18234 val_conv = ChannelHandshakeConfig_clone(&val_conv);
18235 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
18238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
18239 LDKUserConfig this_ptr_conv;
18240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18241 this_ptr_conv.is_owned = false;
18242 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
18243 uint64_t ret_ref = 0;
18244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18246 ret_ref = (uint64_t)ret_var.inner;
18247 if (ret_var.is_owned) {
18253 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) {
18254 LDKUserConfig this_ptr_conv;
18255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18256 this_ptr_conv.is_owned = false;
18257 LDKChannelHandshakeLimits val_conv;
18258 val_conv.inner = (void*)(val & (~1));
18259 val_conv.is_owned = (val & 1) || (val == 0);
18260 val_conv = ChannelHandshakeLimits_clone(&val_conv);
18261 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
18264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
18265 LDKUserConfig this_ptr_conv;
18266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18267 this_ptr_conv.is_owned = false;
18268 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
18269 uint64_t ret_ref = 0;
18270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18272 ret_ref = (uint64_t)ret_var.inner;
18273 if (ret_var.is_owned) {
18279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18280 LDKUserConfig this_ptr_conv;
18281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18282 this_ptr_conv.is_owned = false;
18283 LDKChannelConfig val_conv;
18284 val_conv.inner = (void*)(val & (~1));
18285 val_conv.is_owned = (val & 1) || (val == 0);
18286 val_conv = ChannelConfig_clone(&val_conv);
18287 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
18290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
18291 LDKUserConfig this_ptr_conv;
18292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18293 this_ptr_conv.is_owned = false;
18294 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
18298 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) {
18299 LDKUserConfig this_ptr_conv;
18300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18301 this_ptr_conv.is_owned = false;
18302 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
18305 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) {
18306 LDKChannelHandshakeConfig own_channel_config_arg_conv;
18307 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
18308 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
18309 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
18310 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
18311 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
18312 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
18313 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
18314 LDKChannelConfig channel_options_arg_conv;
18315 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
18316 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
18317 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
18318 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);
18319 uint64_t ret_ref = 0;
18320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18322 ret_ref = (uint64_t)ret_var.inner;
18323 if (ret_var.is_owned) {
18329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18330 LDKUserConfig orig_conv;
18331 orig_conv.inner = (void*)(orig & (~1));
18332 orig_conv.is_owned = false;
18333 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
18334 uint64_t ret_ref = 0;
18335 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18336 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18337 ret_ref = (uint64_t)ret_var.inner;
18338 if (ret_var.is_owned) {
18344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
18345 LDKUserConfig ret_var = UserConfig_default();
18346 uint64_t ret_ref = 0;
18347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18349 ret_ref = (uint64_t)ret_var.inner;
18350 if (ret_var.is_owned) {
18356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18357 LDKBestBlock this_obj_conv;
18358 this_obj_conv.inner = (void*)(this_obj & (~1));
18359 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18360 BestBlock_free(this_obj_conv);
18363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18364 LDKBestBlock orig_conv;
18365 orig_conv.inner = (void*)(orig & (~1));
18366 orig_conv.is_owned = false;
18367 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
18368 uint64_t ret_ref = 0;
18369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18371 ret_ref = (uint64_t)ret_var.inner;
18372 if (ret_var.is_owned) {
18378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
18379 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
18380 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
18381 uint64_t ret_ref = 0;
18382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18384 ret_ref = (uint64_t)ret_var.inner;
18385 if (ret_var.is_owned) {
18391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
18392 LDKThirtyTwoBytes block_hash_ref;
18393 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
18394 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
18395 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
18396 uint64_t ret_ref = 0;
18397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18399 ret_ref = (uint64_t)ret_var.inner;
18400 if (ret_var.is_owned) {
18406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
18407 LDKBestBlock this_arg_conv;
18408 this_arg_conv.inner = (void*)(this_arg & (~1));
18409 this_arg_conv.is_owned = false;
18410 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18411 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
18415 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
18416 LDKBestBlock this_arg_conv;
18417 this_arg_conv.inner = (void*)(this_arg & (~1));
18418 this_arg_conv.is_owned = false;
18419 int32_t ret_val = BestBlock_height(&this_arg_conv);
18423 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18424 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
18425 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
18429 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
18430 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
18434 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
18435 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
18439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18440 if ((this_ptr & 1) != 0) return;
18441 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18442 CHECK_ACCESS(this_ptr_ptr);
18443 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
18444 FREE((void*)this_ptr);
18445 Access_free(this_ptr_conv);
18448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18449 if ((this_ptr & 1) != 0) return;
18450 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18451 CHECK_ACCESS(this_ptr_ptr);
18452 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
18453 FREE((void*)this_ptr);
18454 Listen_free(this_ptr_conv);
18457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18458 if ((this_ptr & 1) != 0) return;
18459 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18460 CHECK_ACCESS(this_ptr_ptr);
18461 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
18462 FREE((void*)this_ptr);
18463 Confirm_free(this_ptr_conv);
18466 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18467 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
18468 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
18472 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
18473 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
18477 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
18478 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
18482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18483 if ((this_ptr & 1) != 0) return;
18484 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18485 CHECK_ACCESS(this_ptr_ptr);
18486 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18487 FREE((void*)this_ptr);
18488 Watch_free(this_ptr_conv);
18491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18492 if ((this_ptr & 1) != 0) return;
18493 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18494 CHECK_ACCESS(this_ptr_ptr);
18495 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18496 FREE((void*)this_ptr);
18497 Filter_free(this_ptr_conv);
18500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18501 LDKWatchedOutput this_obj_conv;
18502 this_obj_conv.inner = (void*)(this_obj & (~1));
18503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18504 WatchedOutput_free(this_obj_conv);
18507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18508 LDKWatchedOutput this_ptr_conv;
18509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18510 this_ptr_conv.is_owned = false;
18511 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18512 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
18516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18517 LDKWatchedOutput this_ptr_conv;
18518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18519 this_ptr_conv.is_owned = false;
18520 LDKThirtyTwoBytes val_ref;
18521 CHECK((*env)->GetArrayLength(env, val) == 32);
18522 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18523 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18527 LDKWatchedOutput this_ptr_conv;
18528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18529 this_ptr_conv.is_owned = false;
18530 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18531 uint64_t ret_ref = 0;
18532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18534 ret_ref = (uint64_t)ret_var.inner;
18535 if (ret_var.is_owned) {
18541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18542 LDKWatchedOutput this_ptr_conv;
18543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18544 this_ptr_conv.is_owned = false;
18545 LDKOutPoint val_conv;
18546 val_conv.inner = (void*)(val & (~1));
18547 val_conv.is_owned = (val & 1) || (val == 0);
18548 val_conv = OutPoint_clone(&val_conv);
18549 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18553 LDKWatchedOutput this_ptr_conv;
18554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18555 this_ptr_conv.is_owned = false;
18556 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18557 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18558 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18563 LDKWatchedOutput this_ptr_conv;
18564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18565 this_ptr_conv.is_owned = false;
18566 LDKCVec_u8Z val_ref;
18567 val_ref.datalen = (*env)->GetArrayLength(env, val);
18568 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18569 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18570 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18573 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) {
18574 LDKThirtyTwoBytes block_hash_arg_ref;
18575 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
18576 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
18577 LDKOutPoint outpoint_arg_conv;
18578 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18579 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18580 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18581 LDKCVec_u8Z script_pubkey_arg_ref;
18582 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
18583 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18584 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
18585 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18586 uint64_t ret_ref = 0;
18587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18589 ret_ref = (uint64_t)ret_var.inner;
18590 if (ret_var.is_owned) {
18596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18597 LDKWatchedOutput orig_conv;
18598 orig_conv.inner = (void*)(orig & (~1));
18599 orig_conv.is_owned = false;
18600 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18601 uint64_t ret_ref = 0;
18602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18604 ret_ref = (uint64_t)ret_var.inner;
18605 if (ret_var.is_owned) {
18611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
18612 LDKWatchedOutput o_conv;
18613 o_conv.inner = (void*)(o & (~1));
18614 o_conv.is_owned = false;
18615 int64_t ret_val = WatchedOutput_hash(&o_conv);
18619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18620 if ((this_ptr & 1) != 0) return;
18621 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18622 CHECK_ACCESS(this_ptr_ptr);
18623 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18624 FREE((void*)this_ptr);
18625 BroadcasterInterface_free(this_ptr_conv);
18628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18629 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18630 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
18634 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
18635 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
18639 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
18640 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
18644 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
18645 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
18649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
18650 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18651 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18652 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18657 if ((this_ptr & 1) != 0) return;
18658 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18659 CHECK_ACCESS(this_ptr_ptr);
18660 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18661 FREE((void*)this_ptr);
18662 FeeEstimator_free(this_ptr_conv);
18665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18666 LDKMonitorUpdateId this_obj_conv;
18667 this_obj_conv.inner = (void*)(this_obj & (~1));
18668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18669 MonitorUpdateId_free(this_obj_conv);
18672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18673 LDKMonitorUpdateId orig_conv;
18674 orig_conv.inner = (void*)(orig & (~1));
18675 orig_conv.is_owned = false;
18676 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18677 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
18681 if (ret_var.is_owned) {
18687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
18688 LDKMonitorUpdateId o_conv;
18689 o_conv.inner = (void*)(o & (~1));
18690 o_conv.is_owned = false;
18691 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
18696 LDKMonitorUpdateId a_conv;
18697 a_conv.inner = (void*)(a & (~1));
18698 a_conv.is_owned = false;
18699 LDKMonitorUpdateId b_conv;
18700 b_conv.inner = (void*)(b & (~1));
18701 b_conv.is_owned = false;
18702 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18707 if ((this_ptr & 1) != 0) return;
18708 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18709 CHECK_ACCESS(this_ptr_ptr);
18710 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18711 FREE((void*)this_ptr);
18712 Persist_free(this_ptr_conv);
18715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18716 LDKLockedChannelMonitor this_obj_conv;
18717 this_obj_conv.inner = (void*)(this_obj & (~1));
18718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18719 LockedChannelMonitor_free(this_obj_conv);
18722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18723 LDKChainMonitor this_obj_conv;
18724 this_obj_conv.inner = (void*)(this_obj & (~1));
18725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18726 ChainMonitor_free(this_obj_conv);
18729 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) {
18730 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18731 CHECK_ACCESS(chain_source_ptr);
18732 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18733 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18734 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18735 // Manually implement clone for Java trait instances
18736 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
18737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18738 LDKFilter_JCalls_cloned(&chain_source_conv.some);
18741 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18742 CHECK_ACCESS(broadcaster_ptr);
18743 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18744 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18745 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18746 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
18748 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18749 CHECK_ACCESS(logger_ptr);
18750 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18751 if (logger_conv.free == LDKLogger_JCalls_free) {
18752 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18753 LDKLogger_JCalls_cloned(&logger_conv);
18755 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18756 CHECK_ACCESS(feeest_ptr);
18757 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18758 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
18759 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18760 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
18762 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18763 CHECK_ACCESS(persister_ptr);
18764 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18765 if (persister_conv.free == LDKPersist_JCalls_free) {
18766 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18767 LDKPersist_JCalls_cloned(&persister_conv);
18769 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18770 uint64_t ret_ref = 0;
18771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18773 ret_ref = (uint64_t)ret_var.inner;
18774 if (ret_var.is_owned) {
18780 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) {
18781 LDKChainMonitor this_arg_conv;
18782 this_arg_conv.inner = (void*)(this_arg & (~1));
18783 this_arg_conv.is_owned = false;
18784 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18785 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
18786 if (ignored_channels_constr.datalen > 0)
18787 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18789 ignored_channels_constr.data = NULL;
18790 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
18791 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18792 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
18793 LDKChannelDetails ignored_channels_conv_16_conv;
18794 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18795 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18796 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18797 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18799 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
18800 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18801 int64_tArray ret_arr = NULL;
18802 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18803 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18804 for (size_t j = 0; j < ret_var.datalen; j++) {
18805 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18806 *ret_conv_9_copy = ret_var.data[j];
18807 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18808 ret_arr_ptr[j] = ret_conv_9_ref;
18810 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18811 FREE(ret_var.data);
18815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
18816 LDKChainMonitor this_arg_conv;
18817 this_arg_conv.inner = (void*)(this_arg & (~1));
18818 this_arg_conv.is_owned = false;
18819 LDKOutPoint funding_txo_conv;
18820 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18821 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18822 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18823 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18824 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18825 return (uint64_t)ret_conv;
18828 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
18829 LDKChainMonitor this_arg_conv;
18830 this_arg_conv.inner = (void*)(this_arg & (~1));
18831 this_arg_conv.is_owned = false;
18832 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18833 int64_tArray ret_arr = NULL;
18834 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18835 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18836 for (size_t k = 0; k < ret_var.datalen; k++) {
18837 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18838 uint64_t ret_conv_10_ref = 0;
18839 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18840 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18841 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18842 if (ret_conv_10_var.is_owned) {
18843 ret_conv_10_ref |= 1;
18845 ret_arr_ptr[k] = ret_conv_10_ref;
18847 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18848 FREE(ret_var.data);
18852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
18853 LDKChainMonitor this_arg_conv;
18854 this_arg_conv.inner = (void*)(this_arg & (~1));
18855 this_arg_conv.is_owned = false;
18856 LDKOutPoint funding_txo_conv;
18857 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18858 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18859 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18860 LDKMonitorUpdateId completed_update_id_conv;
18861 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18862 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18863 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18864 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18865 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18866 return (uint64_t)ret_conv;
18869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
18870 LDKChainMonitor this_arg_conv;
18871 this_arg_conv.inner = (void*)(this_arg & (~1));
18872 this_arg_conv.is_owned = false;
18873 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18874 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18875 return (uint64_t)ret_ret;
18878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
18879 LDKChainMonitor this_arg_conv;
18880 this_arg_conv.inner = (void*)(this_arg & (~1));
18881 this_arg_conv.is_owned = false;
18882 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18883 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18884 return (uint64_t)ret_ret;
18887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
18888 LDKChainMonitor this_arg_conv;
18889 this_arg_conv.inner = (void*)(this_arg & (~1));
18890 this_arg_conv.is_owned = false;
18891 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18892 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18893 return (uint64_t)ret_ret;
18896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18897 LDKChainMonitor this_arg_conv;
18898 this_arg_conv.inner = (void*)(this_arg & (~1));
18899 this_arg_conv.is_owned = false;
18900 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18901 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18902 return (uint64_t)ret_ret;
18905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18906 LDKChannelMonitorUpdate this_obj_conv;
18907 this_obj_conv.inner = (void*)(this_obj & (~1));
18908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18909 ChannelMonitorUpdate_free(this_obj_conv);
18912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18913 LDKChannelMonitorUpdate this_ptr_conv;
18914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18915 this_ptr_conv.is_owned = false;
18916 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18921 LDKChannelMonitorUpdate this_ptr_conv;
18922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18923 this_ptr_conv.is_owned = false;
18924 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18928 LDKChannelMonitorUpdate orig_conv;
18929 orig_conv.inner = (void*)(orig & (~1));
18930 orig_conv.is_owned = false;
18931 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18932 uint64_t ret_ref = 0;
18933 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18934 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18935 ret_ref = (uint64_t)ret_var.inner;
18936 if (ret_var.is_owned) {
18942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
18943 LDKChannelMonitorUpdate obj_conv;
18944 obj_conv.inner = (void*)(obj & (~1));
18945 obj_conv.is_owned = false;
18946 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18947 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18948 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18949 CVec_u8Z_free(ret_var);
18953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18954 LDKu8slice ser_ref;
18955 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18956 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18957 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18958 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18959 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18960 return (uint64_t)ret_conv;
18963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18964 LDKMonitorUpdateError this_obj_conv;
18965 this_obj_conv.inner = (void*)(this_obj & (~1));
18966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18967 MonitorUpdateError_free(this_obj_conv);
18970 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
18971 LDKMonitorUpdateError this_ptr_conv;
18972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18973 this_ptr_conv.is_owned = false;
18974 LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv);
18975 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
18980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
18981 LDKMonitorUpdateError this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 LDKStr val_conv = java_to_owned_str(env, val);
18985 MonitorUpdateError_set_a(&this_ptr_conv, val_conv);
18988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1new(JNIEnv *env, jclass clz, jstring a_arg) {
18989 LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
18990 LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv);
18991 uint64_t ret_ref = 0;
18992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18994 ret_ref = (uint64_t)ret_var.inner;
18995 if (ret_var.is_owned) {
19001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19002 LDKMonitorUpdateError orig_conv;
19003 orig_conv.inner = (void*)(orig & (~1));
19004 orig_conv.is_owned = false;
19005 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
19006 uint64_t ret_ref = 0;
19007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19009 ret_ref = (uint64_t)ret_var.inner;
19010 if (ret_var.is_owned) {
19016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19017 if ((this_ptr & 1) != 0) return;
19018 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19019 CHECK_ACCESS(this_ptr_ptr);
19020 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
19021 FREE((void*)this_ptr);
19022 MonitorEvent_free(this_ptr_conv);
19025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19026 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
19027 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19028 *ret_copy = MonitorEvent_clone(orig_conv);
19029 uint64_t ret_ref = (uint64_t)ret_copy;
19033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
19034 LDKHTLCUpdate a_conv;
19035 a_conv.inner = (void*)(a & (~1));
19036 a_conv.is_owned = (a & 1) || (a == 0);
19037 a_conv = HTLCUpdate_clone(&a_conv);
19038 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19039 *ret_copy = MonitorEvent_htlcevent(a_conv);
19040 uint64_t ret_ref = (uint64_t)ret_copy;
19044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
19045 LDKOutPoint a_conv;
19046 a_conv.inner = (void*)(a & (~1));
19047 a_conv.is_owned = (a & 1) || (a == 0);
19048 a_conv = OutPoint_clone(&a_conv);
19049 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19050 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
19051 uint64_t ret_ref = (uint64_t)ret_copy;
19055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
19056 LDKOutPoint funding_txo_conv;
19057 funding_txo_conv.inner = (void*)(funding_txo & (~1));
19058 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
19059 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
19060 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19061 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
19062 uint64_t ret_ref = (uint64_t)ret_copy;
19066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
19067 LDKOutPoint a_conv;
19068 a_conv.inner = (void*)(a & (~1));
19069 a_conv.is_owned = (a & 1) || (a == 0);
19070 a_conv = OutPoint_clone(&a_conv);
19071 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19072 *ret_copy = MonitorEvent_update_failed(a_conv);
19073 uint64_t ret_ref = (uint64_t)ret_copy;
19077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
19078 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
19079 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
19080 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19081 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19082 CVec_u8Z_free(ret_var);
19086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19087 LDKHTLCUpdate this_obj_conv;
19088 this_obj_conv.inner = (void*)(this_obj & (~1));
19089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19090 HTLCUpdate_free(this_obj_conv);
19093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19094 LDKHTLCUpdate orig_conv;
19095 orig_conv.inner = (void*)(orig & (~1));
19096 orig_conv.is_owned = false;
19097 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
19098 uint64_t ret_ref = 0;
19099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19101 ret_ref = (uint64_t)ret_var.inner;
19102 if (ret_var.is_owned) {
19108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
19109 LDKHTLCUpdate obj_conv;
19110 obj_conv.inner = (void*)(obj & (~1));
19111 obj_conv.is_owned = false;
19112 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
19113 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19114 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19115 CVec_u8Z_free(ret_var);
19119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19120 LDKu8slice ser_ref;
19121 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19122 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19123 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19124 *ret_conv = HTLCUpdate_read(ser_ref);
19125 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19126 return (uint64_t)ret_conv;
19129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19130 if ((this_ptr & 1) != 0) return;
19131 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19132 CHECK_ACCESS(this_ptr_ptr);
19133 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
19134 FREE((void*)this_ptr);
19135 Balance_free(this_ptr_conv);
19138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19139 LDKBalance* orig_conv = (LDKBalance*)orig;
19140 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19141 *ret_copy = Balance_clone(orig_conv);
19142 uint64_t ret_ref = (uint64_t)ret_copy;
19146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
19147 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19148 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
19149 uint64_t ret_ref = (uint64_t)ret_copy;
19153 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) {
19154 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19155 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
19156 uint64_t ret_ref = (uint64_t)ret_copy;
19160 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) {
19161 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19162 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
19163 uint64_t ret_ref = (uint64_t)ret_copy;
19167 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) {
19168 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19169 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
19170 uint64_t ret_ref = (uint64_t)ret_copy;
19174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
19175 LDKBalance* a_conv = (LDKBalance*)a;
19176 LDKBalance* b_conv = (LDKBalance*)b;
19177 jboolean ret_val = Balance_eq(a_conv, b_conv);
19181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19182 LDKChannelMonitor this_obj_conv;
19183 this_obj_conv.inner = (void*)(this_obj & (~1));
19184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19185 ChannelMonitor_free(this_obj_conv);
19188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19189 LDKChannelMonitor orig_conv;
19190 orig_conv.inner = (void*)(orig & (~1));
19191 orig_conv.is_owned = false;
19192 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
19193 uint64_t ret_ref = 0;
19194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19196 ret_ref = (uint64_t)ret_var.inner;
19197 if (ret_var.is_owned) {
19203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
19204 LDKChannelMonitor obj_conv;
19205 obj_conv.inner = (void*)(obj & (~1));
19206 obj_conv.is_owned = false;
19207 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
19208 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19209 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19210 CVec_u8Z_free(ret_var);
19214 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) {
19215 LDKChannelMonitor this_arg_conv;
19216 this_arg_conv.inner = (void*)(this_arg & (~1));
19217 this_arg_conv.is_owned = false;
19218 LDKChannelMonitorUpdate updates_conv;
19219 updates_conv.inner = (void*)(updates & (~1));
19220 updates_conv.is_owned = false;
19221 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19222 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
19223 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
19224 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19225 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
19226 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
19227 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19228 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19229 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19230 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
19231 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
19232 return (uint64_t)ret_conv;
19235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
19236 LDKChannelMonitor this_arg_conv;
19237 this_arg_conv.inner = (void*)(this_arg & (~1));
19238 this_arg_conv.is_owned = false;
19239 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
19243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
19244 LDKChannelMonitor this_arg_conv;
19245 this_arg_conv.inner = (void*)(this_arg & (~1));
19246 this_arg_conv.is_owned = false;
19247 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19248 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
19249 return ((uint64_t)ret_conv);
19252 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
19253 LDKChannelMonitor this_arg_conv;
19254 this_arg_conv.inner = (void*)(this_arg & (~1));
19255 this_arg_conv.is_owned = false;
19256 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
19257 int64_tArray ret_arr = NULL;
19258 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19259 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19260 for (size_t o = 0; o < ret_var.datalen; o++) {
19261 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19262 *ret_conv_40_conv = ret_var.data[o];
19263 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
19265 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19266 FREE(ret_var.data);
19270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
19271 LDKChannelMonitor this_arg_conv;
19272 this_arg_conv.inner = (void*)(this_arg & (~1));
19273 this_arg_conv.is_owned = false;
19274 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
19275 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
19276 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
19277 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
19280 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
19281 LDKChannelMonitor this_arg_conv;
19282 this_arg_conv.inner = (void*)(this_arg & (~1));
19283 this_arg_conv.is_owned = false;
19284 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
19285 int64_tArray ret_arr = NULL;
19286 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19287 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19288 for (size_t o = 0; o < ret_var.datalen; o++) {
19289 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
19290 *ret_conv_14_copy = ret_var.data[o];
19291 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
19292 ret_arr_ptr[o] = ret_conv_14_ref;
19294 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19295 FREE(ret_var.data);
19299 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
19300 LDKChannelMonitor this_arg_conv;
19301 this_arg_conv.inner = (void*)(this_arg & (~1));
19302 this_arg_conv.is_owned = false;
19303 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
19304 int64_tArray ret_arr = NULL;
19305 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19306 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19307 for (size_t h = 0; h < ret_var.datalen; h++) {
19308 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19309 *ret_conv_7_copy = ret_var.data[h];
19310 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
19311 ret_arr_ptr[h] = ret_conv_7_ref;
19313 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19314 FREE(ret_var.data);
19318 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) {
19319 LDKChannelMonitor this_arg_conv;
19320 this_arg_conv.inner = (void*)(this_arg & (~1));
19321 this_arg_conv.is_owned = false;
19322 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19323 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
19324 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
19325 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
19326 jobjectArray ret_arr = NULL;
19327 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
19329 for (size_t i = 0; i < ret_var.datalen; i++) {
19330 LDKTransaction ret_conv_8_var = ret_var.data[i];
19331 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
19332 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
19333 Transaction_free(ret_conv_8_var);
19334 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
19337 FREE(ret_var.data);
19341 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) {
19342 LDKChannelMonitor this_arg_conv;
19343 this_arg_conv.inner = (void*)(this_arg & (~1));
19344 this_arg_conv.is_owned = false;
19345 unsigned char header_arr[80];
19346 CHECK((*env)->GetArrayLength(env, header) == 80);
19347 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
19348 unsigned char (*header_ref)[80] = &header_arr;
19349 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19350 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
19351 if (txdata_constr.datalen > 0)
19352 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19354 txdata_constr.data = NULL;
19355 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
19356 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19357 int64_t txdata_conv_28 = txdata_vals[c];
19358 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19359 CHECK_ACCESS(txdata_conv_28_ptr);
19360 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19361 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19362 txdata_constr.data[c] = txdata_conv_28_conv;
19364 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
19365 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19366 CHECK_ACCESS(broadcaster_ptr);
19367 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19368 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19369 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19370 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
19372 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19373 CHECK_ACCESS(fee_estimator_ptr);
19374 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19375 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19376 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19377 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19379 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19380 CHECK_ACCESS(logger_ptr);
19381 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19382 if (logger_conv.free == LDKLogger_JCalls_free) {
19383 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19384 LDKLogger_JCalls_cloned(&logger_conv);
19386 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);
19387 int64_tArray ret_arr = NULL;
19388 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19389 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19390 for (size_t n = 0; n < ret_var.datalen; n++) {
19391 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19392 *ret_conv_39_conv = ret_var.data[n];
19393 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19395 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19396 FREE(ret_var.data);
19400 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) {
19401 LDKChannelMonitor this_arg_conv;
19402 this_arg_conv.inner = (void*)(this_arg & (~1));
19403 this_arg_conv.is_owned = false;
19404 unsigned char header_arr[80];
19405 CHECK((*env)->GetArrayLength(env, header) == 80);
19406 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
19407 unsigned char (*header_ref)[80] = &header_arr;
19408 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19409 CHECK_ACCESS(broadcaster_ptr);
19410 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19411 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19413 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
19415 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19416 CHECK_ACCESS(fee_estimator_ptr);
19417 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19418 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19419 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19420 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19422 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19423 CHECK_ACCESS(logger_ptr);
19424 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19425 if (logger_conv.free == LDKLogger_JCalls_free) {
19426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19427 LDKLogger_JCalls_cloned(&logger_conv);
19429 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19432 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) {
19433 LDKChannelMonitor this_arg_conv;
19434 this_arg_conv.inner = (void*)(this_arg & (~1));
19435 this_arg_conv.is_owned = false;
19436 unsigned char header_arr[80];
19437 CHECK((*env)->GetArrayLength(env, header) == 80);
19438 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
19439 unsigned char (*header_ref)[80] = &header_arr;
19440 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19441 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
19442 if (txdata_constr.datalen > 0)
19443 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19445 txdata_constr.data = NULL;
19446 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
19447 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19448 int64_t txdata_conv_28 = txdata_vals[c];
19449 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19450 CHECK_ACCESS(txdata_conv_28_ptr);
19451 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19452 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19453 txdata_constr.data[c] = txdata_conv_28_conv;
19455 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
19456 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19457 CHECK_ACCESS(broadcaster_ptr);
19458 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19459 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19461 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
19463 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19464 CHECK_ACCESS(fee_estimator_ptr);
19465 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19466 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19468 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19470 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19471 CHECK_ACCESS(logger_ptr);
19472 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19473 if (logger_conv.free == LDKLogger_JCalls_free) {
19474 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19475 LDKLogger_JCalls_cloned(&logger_conv);
19477 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);
19478 int64_tArray ret_arr = NULL;
19479 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19480 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19481 for (size_t n = 0; n < ret_var.datalen; n++) {
19482 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19483 *ret_conv_39_conv = ret_var.data[n];
19484 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19486 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19487 FREE(ret_var.data);
19491 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) {
19492 LDKChannelMonitor this_arg_conv;
19493 this_arg_conv.inner = (void*)(this_arg & (~1));
19494 this_arg_conv.is_owned = false;
19495 unsigned char txid_arr[32];
19496 CHECK((*env)->GetArrayLength(env, txid) == 32);
19497 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
19498 unsigned char (*txid_ref)[32] = &txid_arr;
19499 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19500 CHECK_ACCESS(broadcaster_ptr);
19501 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19502 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19503 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19504 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
19506 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19507 CHECK_ACCESS(fee_estimator_ptr);
19508 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19509 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19510 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19511 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19513 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19514 CHECK_ACCESS(logger_ptr);
19515 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19516 if (logger_conv.free == LDKLogger_JCalls_free) {
19517 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19518 LDKLogger_JCalls_cloned(&logger_conv);
19520 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19523 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) {
19524 LDKChannelMonitor this_arg_conv;
19525 this_arg_conv.inner = (void*)(this_arg & (~1));
19526 this_arg_conv.is_owned = false;
19527 unsigned char header_arr[80];
19528 CHECK((*env)->GetArrayLength(env, header) == 80);
19529 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
19530 unsigned char (*header_ref)[80] = &header_arr;
19531 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19532 CHECK_ACCESS(broadcaster_ptr);
19533 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19534 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19536 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
19538 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19539 CHECK_ACCESS(fee_estimator_ptr);
19540 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19541 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19542 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19543 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19545 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19546 CHECK_ACCESS(logger_ptr);
19547 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19548 if (logger_conv.free == LDKLogger_JCalls_free) {
19549 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19550 LDKLogger_JCalls_cloned(&logger_conv);
19552 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19553 int64_tArray ret_arr = NULL;
19554 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19555 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19556 for (size_t n = 0; n < ret_var.datalen; n++) {
19557 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19558 *ret_conv_39_conv = ret_var.data[n];
19559 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19561 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19562 FREE(ret_var.data);
19566 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
19567 LDKChannelMonitor this_arg_conv;
19568 this_arg_conv.inner = (void*)(this_arg & (~1));
19569 this_arg_conv.is_owned = false;
19570 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19571 jobjectArray ret_arr = NULL;
19572 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
19574 for (size_t i = 0; i < ret_var.datalen; i++) {
19575 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
19576 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
19577 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
19580 FREE(ret_var.data);
19584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
19585 LDKChannelMonitor this_arg_conv;
19586 this_arg_conv.inner = (void*)(this_arg & (~1));
19587 this_arg_conv.is_owned = false;
19588 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19589 uint64_t ret_ref = 0;
19590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19592 ret_ref = (uint64_t)ret_var.inner;
19593 if (ret_var.is_owned) {
19599 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
19600 LDKChannelMonitor this_arg_conv;
19601 this_arg_conv.inner = (void*)(this_arg & (~1));
19602 this_arg_conv.is_owned = false;
19603 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19604 int64_tArray ret_arr = NULL;
19605 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19606 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19607 for (size_t j = 0; j < ret_var.datalen; j++) {
19608 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19609 *ret_conv_9_copy = ret_var.data[j];
19610 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19611 ret_arr_ptr[j] = ret_conv_9_ref;
19613 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19614 FREE(ret_var.data);
19618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
19619 LDKu8slice ser_ref;
19620 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19621 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19622 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19623 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19624 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19625 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19626 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19627 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19628 return (uint64_t)ret_conv;
19631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19632 LDKOutPoint this_obj_conv;
19633 this_obj_conv.inner = (void*)(this_obj & (~1));
19634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19635 OutPoint_free(this_obj_conv);
19638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
19639 LDKOutPoint this_ptr_conv;
19640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19641 this_ptr_conv.is_owned = false;
19642 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19643 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
19647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19648 LDKOutPoint this_ptr_conv;
19649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19650 this_ptr_conv.is_owned = false;
19651 LDKThirtyTwoBytes val_ref;
19652 CHECK((*env)->GetArrayLength(env, val) == 32);
19653 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19654 OutPoint_set_txid(&this_ptr_conv, val_ref);
19657 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
19658 LDKOutPoint this_ptr_conv;
19659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19660 this_ptr_conv.is_owned = false;
19661 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19666 LDKOutPoint this_ptr_conv;
19667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19668 this_ptr_conv.is_owned = false;
19669 OutPoint_set_index(&this_ptr_conv, val);
19672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
19673 LDKThirtyTwoBytes txid_arg_ref;
19674 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
19675 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
19676 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19677 uint64_t ret_ref = 0;
19678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19680 ret_ref = (uint64_t)ret_var.inner;
19681 if (ret_var.is_owned) {
19687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19688 LDKOutPoint orig_conv;
19689 orig_conv.inner = (void*)(orig & (~1));
19690 orig_conv.is_owned = false;
19691 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19692 uint64_t ret_ref = 0;
19693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19695 ret_ref = (uint64_t)ret_var.inner;
19696 if (ret_var.is_owned) {
19702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
19703 LDKOutPoint a_conv;
19704 a_conv.inner = (void*)(a & (~1));
19705 a_conv.is_owned = false;
19706 LDKOutPoint b_conv;
19707 b_conv.inner = (void*)(b & (~1));
19708 b_conv.is_owned = false;
19709 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
19714 LDKOutPoint o_conv;
19715 o_conv.inner = (void*)(o & (~1));
19716 o_conv.is_owned = false;
19717 int64_t ret_val = OutPoint_hash(&o_conv);
19721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
19722 LDKOutPoint this_arg_conv;
19723 this_arg_conv.inner = (void*)(this_arg & (~1));
19724 this_arg_conv.is_owned = false;
19725 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19726 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
19730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
19731 LDKOutPoint obj_conv;
19732 obj_conv.inner = (void*)(obj & (~1));
19733 obj_conv.is_owned = false;
19734 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19735 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19736 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19737 CVec_u8Z_free(ret_var);
19741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19742 LDKu8slice ser_ref;
19743 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19744 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19745 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19746 *ret_conv = OutPoint_read(ser_ref);
19747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19748 return (uint64_t)ret_conv;
19751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19752 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19753 this_obj_conv.inner = (void*)(this_obj & (~1));
19754 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19755 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19759 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19761 this_ptr_conv.is_owned = false;
19762 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19763 uint64_t ret_ref = 0;
19764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19766 ret_ref = (uint64_t)ret_var.inner;
19767 if (ret_var.is_owned) {
19773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19774 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19776 this_ptr_conv.is_owned = false;
19777 LDKOutPoint val_conv;
19778 val_conv.inner = (void*)(val & (~1));
19779 val_conv.is_owned = (val & 1) || (val == 0);
19780 val_conv = OutPoint_clone(&val_conv);
19781 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19785 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19787 this_ptr_conv.is_owned = false;
19788 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
19793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19794 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19796 this_ptr_conv.is_owned = false;
19797 LDKPublicKey val_ref;
19798 CHECK((*env)->GetArrayLength(env, val) == 33);
19799 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19800 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19803 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19804 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19806 this_ptr_conv.is_owned = false;
19807 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19812 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19814 this_ptr_conv.is_owned = false;
19815 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19819 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19821 this_ptr_conv.is_owned = false;
19822 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19823 CHECK_ACCESS(val_ptr);
19824 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19825 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19826 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19830 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19832 this_ptr_conv.is_owned = false;
19833 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19834 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
19838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19839 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19841 this_ptr_conv.is_owned = false;
19842 LDKPublicKey val_ref;
19843 CHECK((*env)->GetArrayLength(env, val) == 33);
19844 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19845 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19849 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19851 this_ptr_conv.is_owned = false;
19852 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
19857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19858 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19860 this_ptr_conv.is_owned = false;
19861 LDKThirtyTwoBytes val_ref;
19862 CHECK((*env)->GetArrayLength(env, val) == 32);
19863 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19864 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19868 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19870 this_ptr_conv.is_owned = false;
19871 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19876 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19878 this_ptr_conv.is_owned = false;
19879 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19882 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) {
19883 LDKOutPoint outpoint_arg_conv;
19884 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19885 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19886 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19887 LDKPublicKey per_commitment_point_arg_ref;
19888 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
19889 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
19890 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19891 CHECK_ACCESS(output_arg_ptr);
19892 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19893 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19894 LDKPublicKey revocation_pubkey_arg_ref;
19895 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
19896 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
19897 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19898 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
19899 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
19900 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);
19901 uint64_t ret_ref = 0;
19902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19904 ret_ref = (uint64_t)ret_var.inner;
19905 if (ret_var.is_owned) {
19911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19912 LDKDelayedPaymentOutputDescriptor orig_conv;
19913 orig_conv.inner = (void*)(orig & (~1));
19914 orig_conv.is_owned = false;
19915 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19916 uint64_t ret_ref = 0;
19917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19919 ret_ref = (uint64_t)ret_var.inner;
19920 if (ret_var.is_owned) {
19926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
19927 LDKDelayedPaymentOutputDescriptor obj_conv;
19928 obj_conv.inner = (void*)(obj & (~1));
19929 obj_conv.is_owned = false;
19930 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19931 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19932 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19933 CVec_u8Z_free(ret_var);
19937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19938 LDKu8slice ser_ref;
19939 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19940 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19941 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19942 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19943 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19944 return (uint64_t)ret_conv;
19947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19948 LDKStaticPaymentOutputDescriptor this_obj_conv;
19949 this_obj_conv.inner = (void*)(this_obj & (~1));
19950 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19951 StaticPaymentOutputDescriptor_free(this_obj_conv);
19954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19955 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19957 this_ptr_conv.is_owned = false;
19958 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19959 uint64_t ret_ref = 0;
19960 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19961 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19962 ret_ref = (uint64_t)ret_var.inner;
19963 if (ret_var.is_owned) {
19969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19970 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19972 this_ptr_conv.is_owned = false;
19973 LDKOutPoint val_conv;
19974 val_conv.inner = (void*)(val & (~1));
19975 val_conv.is_owned = (val & 1) || (val == 0);
19976 val_conv = OutPoint_clone(&val_conv);
19977 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19981 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19983 this_ptr_conv.is_owned = false;
19984 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19985 CHECK_ACCESS(val_ptr);
19986 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19987 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19988 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19992 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19994 this_ptr_conv.is_owned = false;
19995 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19996 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
20000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20001 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20003 this_ptr_conv.is_owned = false;
20004 LDKThirtyTwoBytes val_ref;
20005 CHECK((*env)->GetArrayLength(env, val) == 32);
20006 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20007 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
20010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20011 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20013 this_ptr_conv.is_owned = false;
20014 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
20018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20019 LDKStaticPaymentOutputDescriptor this_ptr_conv;
20020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20021 this_ptr_conv.is_owned = false;
20022 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
20025 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) {
20026 LDKOutPoint outpoint_arg_conv;
20027 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
20028 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
20029 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
20030 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
20031 CHECK_ACCESS(output_arg_ptr);
20032 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
20033 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
20034 LDKThirtyTwoBytes channel_keys_id_arg_ref;
20035 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
20036 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
20037 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
20038 uint64_t ret_ref = 0;
20039 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20040 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20041 ret_ref = (uint64_t)ret_var.inner;
20042 if (ret_var.is_owned) {
20048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20049 LDKStaticPaymentOutputDescriptor orig_conv;
20050 orig_conv.inner = (void*)(orig & (~1));
20051 orig_conv.is_owned = false;
20052 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
20053 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
20057 if (ret_var.is_owned) {
20063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
20064 LDKStaticPaymentOutputDescriptor obj_conv;
20065 obj_conv.inner = (void*)(obj & (~1));
20066 obj_conv.is_owned = false;
20067 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
20068 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20069 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20070 CVec_u8Z_free(ret_var);
20074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20075 LDKu8slice ser_ref;
20076 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20077 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20078 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
20079 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
20080 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20081 return (uint64_t)ret_conv;
20084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20085 if ((this_ptr & 1) != 0) return;
20086 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20087 CHECK_ACCESS(this_ptr_ptr);
20088 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
20089 FREE((void*)this_ptr);
20090 SpendableOutputDescriptor_free(this_ptr_conv);
20093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20094 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
20095 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20096 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
20097 uint64_t ret_ref = (uint64_t)ret_copy;
20101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
20102 LDKOutPoint outpoint_conv;
20103 outpoint_conv.inner = (void*)(outpoint & (~1));
20104 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
20105 outpoint_conv = OutPoint_clone(&outpoint_conv);
20106 void* output_ptr = (void*)(((uint64_t)output) & ~1);
20107 CHECK_ACCESS(output_ptr);
20108 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
20109 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
20110 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20111 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
20112 uint64_t ret_ref = (uint64_t)ret_copy;
20116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
20117 LDKDelayedPaymentOutputDescriptor a_conv;
20118 a_conv.inner = (void*)(a & (~1));
20119 a_conv.is_owned = (a & 1) || (a == 0);
20120 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
20121 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20122 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
20123 uint64_t ret_ref = (uint64_t)ret_copy;
20127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
20128 LDKStaticPaymentOutputDescriptor a_conv;
20129 a_conv.inner = (void*)(a & (~1));
20130 a_conv.is_owned = (a & 1) || (a == 0);
20131 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
20132 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
20133 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
20134 uint64_t ret_ref = (uint64_t)ret_copy;
20138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
20139 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
20140 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
20141 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20142 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20143 CVec_u8Z_free(ret_var);
20147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20148 LDKu8slice ser_ref;
20149 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20150 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20151 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
20152 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
20153 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20154 return (uint64_t)ret_conv;
20157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20158 if ((this_ptr & 1) != 0) return;
20159 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20160 CHECK_ACCESS(this_ptr_ptr);
20161 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
20162 FREE((void*)this_ptr);
20163 BaseSign_free(this_ptr_conv);
20166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20167 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
20168 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
20169 LDKSign* orig_conv = (LDKSign*)orig_ptr;
20170 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20171 *ret_ret = Sign_clone(orig_conv);
20172 return (uint64_t)ret_ret;
20175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20176 if ((this_ptr & 1) != 0) return;
20177 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20178 CHECK_ACCESS(this_ptr_ptr);
20179 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
20180 FREE((void*)this_ptr);
20181 Sign_free(this_ptr_conv);
20184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20185 if ((this_ptr & 1) != 0) return;
20186 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
20187 CHECK_ACCESS(this_ptr_ptr);
20188 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
20189 FREE((void*)this_ptr);
20190 KeysInterface_free(this_ptr_conv);
20193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20194 LDKInMemorySigner this_obj_conv;
20195 this_obj_conv.inner = (void*)(this_obj & (~1));
20196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20197 InMemorySigner_free(this_obj_conv);
20200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20201 LDKInMemorySigner this_ptr_conv;
20202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20203 this_ptr_conv.is_owned = false;
20204 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20205 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
20209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20210 LDKInMemorySigner this_ptr_conv;
20211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20212 this_ptr_conv.is_owned = false;
20213 LDKSecretKey val_ref;
20214 CHECK((*env)->GetArrayLength(env, val) == 32);
20215 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
20216 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
20219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20220 LDKInMemorySigner this_ptr_conv;
20221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20222 this_ptr_conv.is_owned = false;
20223 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20224 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
20228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20229 LDKInMemorySigner this_ptr_conv;
20230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20231 this_ptr_conv.is_owned = false;
20232 LDKSecretKey val_ref;
20233 CHECK((*env)->GetArrayLength(env, val) == 32);
20234 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
20235 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
20238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20239 LDKInMemorySigner this_ptr_conv;
20240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20241 this_ptr_conv.is_owned = false;
20242 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20243 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
20247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20248 LDKInMemorySigner this_ptr_conv;
20249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20250 this_ptr_conv.is_owned = false;
20251 LDKSecretKey val_ref;
20252 CHECK((*env)->GetArrayLength(env, val) == 32);
20253 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
20254 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
20257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20258 LDKInMemorySigner this_ptr_conv;
20259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20260 this_ptr_conv.is_owned = false;
20261 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
20266 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) {
20267 LDKInMemorySigner this_ptr_conv;
20268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20269 this_ptr_conv.is_owned = false;
20270 LDKSecretKey val_ref;
20271 CHECK((*env)->GetArrayLength(env, val) == 32);
20272 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
20273 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20277 LDKInMemorySigner this_ptr_conv;
20278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20279 this_ptr_conv.is_owned = false;
20280 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20281 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
20285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20286 LDKInMemorySigner this_ptr_conv;
20287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20288 this_ptr_conv.is_owned = false;
20289 LDKSecretKey val_ref;
20290 CHECK((*env)->GetArrayLength(env, val) == 32);
20291 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
20292 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
20296 LDKInMemorySigner this_ptr_conv;
20297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20298 this_ptr_conv.is_owned = false;
20299 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
20304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20305 LDKInMemorySigner this_ptr_conv;
20306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20307 this_ptr_conv.is_owned = false;
20308 LDKThirtyTwoBytes val_ref;
20309 CHECK((*env)->GetArrayLength(env, val) == 32);
20310 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20311 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20315 LDKInMemorySigner orig_conv;
20316 orig_conv.inner = (void*)(orig & (~1));
20317 orig_conv.is_owned = false;
20318 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20319 uint64_t ret_ref = 0;
20320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20322 ret_ref = (uint64_t)ret_var.inner;
20323 if (ret_var.is_owned) {
20329 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) {
20330 LDKSecretKey funding_key_ref;
20331 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
20332 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
20333 LDKSecretKey revocation_base_key_ref;
20334 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
20335 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
20336 LDKSecretKey payment_key_ref;
20337 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
20338 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
20339 LDKSecretKey delayed_payment_base_key_ref;
20340 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
20341 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
20342 LDKSecretKey htlc_base_key_ref;
20343 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
20344 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
20345 LDKThirtyTwoBytes commitment_seed_ref;
20346 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
20347 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
20348 LDKThirtyTwoBytes channel_keys_id_ref;
20349 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
20350 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
20351 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);
20352 uint64_t ret_ref = 0;
20353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20355 ret_ref = (uint64_t)ret_var.inner;
20356 if (ret_var.is_owned) {
20362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
20363 LDKInMemorySigner this_arg_conv;
20364 this_arg_conv.inner = (void*)(this_arg & (~1));
20365 this_arg_conv.is_owned = false;
20366 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20367 uint64_t ret_ref = 0;
20368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20370 ret_ref = (uint64_t)ret_var.inner;
20371 if (ret_var.is_owned) {
20377 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
20378 LDKInMemorySigner this_arg_conv;
20379 this_arg_conv.inner = (void*)(this_arg & (~1));
20380 this_arg_conv.is_owned = false;
20381 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20385 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
20386 LDKInMemorySigner this_arg_conv;
20387 this_arg_conv.inner = (void*)(this_arg & (~1));
20388 this_arg_conv.is_owned = false;
20389 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
20394 LDKInMemorySigner this_arg_conv;
20395 this_arg_conv.inner = (void*)(this_arg & (~1));
20396 this_arg_conv.is_owned = false;
20397 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
20402 LDKInMemorySigner this_arg_conv;
20403 this_arg_conv.inner = (void*)(this_arg & (~1));
20404 this_arg_conv.is_owned = false;
20405 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20406 uint64_t ret_ref = 0;
20407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20409 ret_ref = (uint64_t)ret_var.inner;
20410 if (ret_var.is_owned) {
20416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
20417 LDKInMemorySigner this_arg_conv;
20418 this_arg_conv.inner = (void*)(this_arg & (~1));
20419 this_arg_conv.is_owned = false;
20420 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20421 uint64_t ret_ref = 0;
20422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20424 ret_ref = (uint64_t)ret_var.inner;
20425 if (ret_var.is_owned) {
20431 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) {
20432 LDKInMemorySigner this_arg_conv;
20433 this_arg_conv.inner = (void*)(this_arg & (~1));
20434 this_arg_conv.is_owned = false;
20435 LDKTransaction spend_tx_ref;
20436 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
20437 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20438 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
20439 spend_tx_ref.data_is_owned = true;
20440 LDKStaticPaymentOutputDescriptor descriptor_conv;
20441 descriptor_conv.inner = (void*)(descriptor & (~1));
20442 descriptor_conv.is_owned = false;
20443 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20444 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20445 return (uint64_t)ret_conv;
20448 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) {
20449 LDKInMemorySigner this_arg_conv;
20450 this_arg_conv.inner = (void*)(this_arg & (~1));
20451 this_arg_conv.is_owned = false;
20452 LDKTransaction spend_tx_ref;
20453 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
20454 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20455 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
20456 spend_tx_ref.data_is_owned = true;
20457 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20458 descriptor_conv.inner = (void*)(descriptor & (~1));
20459 descriptor_conv.is_owned = false;
20460 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20461 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20462 return (uint64_t)ret_conv;
20465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
20466 LDKInMemorySigner this_arg_conv;
20467 this_arg_conv.inner = (void*)(this_arg & (~1));
20468 this_arg_conv.is_owned = false;
20469 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20470 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20471 return (uint64_t)ret_ret;
20474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
20475 LDKInMemorySigner this_arg_conv;
20476 this_arg_conv.inner = (void*)(this_arg & (~1));
20477 this_arg_conv.is_owned = false;
20478 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20479 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20480 return (uint64_t)ret_ret;
20483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
20484 LDKInMemorySigner obj_conv;
20485 obj_conv.inner = (void*)(obj & (~1));
20486 obj_conv.is_owned = false;
20487 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20488 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20489 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20490 CVec_u8Z_free(ret_var);
20494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20495 LDKu8slice ser_ref;
20496 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20497 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20498 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20499 *ret_conv = InMemorySigner_read(ser_ref);
20500 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20501 return (uint64_t)ret_conv;
20504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20505 LDKKeysManager this_obj_conv;
20506 this_obj_conv.inner = (void*)(this_obj & (~1));
20507 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20508 KeysManager_free(this_obj_conv);
20511 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) {
20512 unsigned char seed_arr[32];
20513 CHECK((*env)->GetArrayLength(env, seed) == 32);
20514 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
20515 unsigned char (*seed_ref)[32] = &seed_arr;
20516 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20517 uint64_t ret_ref = 0;
20518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20520 ret_ref = (uint64_t)ret_var.inner;
20521 if (ret_var.is_owned) {
20527 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) {
20528 LDKKeysManager this_arg_conv;
20529 this_arg_conv.inner = (void*)(this_arg & (~1));
20530 this_arg_conv.is_owned = false;
20531 unsigned char params_arr[32];
20532 CHECK((*env)->GetArrayLength(env, params) == 32);
20533 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
20534 unsigned char (*params_ref)[32] = ¶ms_arr;
20535 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20536 uint64_t ret_ref = 0;
20537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20539 ret_ref = (uint64_t)ret_var.inner;
20540 if (ret_var.is_owned) {
20546 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) {
20547 LDKKeysManager this_arg_conv;
20548 this_arg_conv.inner = (void*)(this_arg & (~1));
20549 this_arg_conv.is_owned = false;
20550 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20551 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
20552 if (descriptors_constr.datalen > 0)
20553 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20555 descriptors_constr.data = NULL;
20556 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
20557 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20558 int64_t descriptors_conv_27 = descriptors_vals[b];
20559 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20560 CHECK_ACCESS(descriptors_conv_27_ptr);
20561 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20562 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20563 descriptors_constr.data[b] = descriptors_conv_27_conv;
20565 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
20566 LDKCVec_TxOutZ outputs_constr;
20567 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
20568 if (outputs_constr.datalen > 0)
20569 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20571 outputs_constr.data = NULL;
20572 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
20573 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20574 int64_t outputs_conv_7 = outputs_vals[h];
20575 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20576 CHECK_ACCESS(outputs_conv_7_ptr);
20577 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20578 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20579 outputs_constr.data[h] = outputs_conv_7_conv;
20581 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
20582 LDKCVec_u8Z change_destination_script_ref;
20583 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
20584 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20585 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
20586 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20587 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20588 return (uint64_t)ret_conv;
20591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
20592 LDKKeysManager this_arg_conv;
20593 this_arg_conv.inner = (void*)(this_arg & (~1));
20594 this_arg_conv.is_owned = false;
20595 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20596 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20597 return (uint64_t)ret_ret;
20600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20601 LDKChannelManager this_obj_conv;
20602 this_obj_conv.inner = (void*)(this_obj & (~1));
20603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20604 ChannelManager_free(this_obj_conv);
20607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20608 LDKChainParameters this_obj_conv;
20609 this_obj_conv.inner = (void*)(this_obj & (~1));
20610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20611 ChainParameters_free(this_obj_conv);
20614 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
20615 LDKChainParameters this_ptr_conv;
20616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20617 this_ptr_conv.is_owned = false;
20618 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
20622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
20623 LDKChainParameters this_ptr_conv;
20624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20625 this_ptr_conv.is_owned = false;
20626 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
20627 ChainParameters_set_network(&this_ptr_conv, val_conv);
20630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
20631 LDKChainParameters this_ptr_conv;
20632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20633 this_ptr_conv.is_owned = false;
20634 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20635 uint64_t ret_ref = 0;
20636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20638 ret_ref = (uint64_t)ret_var.inner;
20639 if (ret_var.is_owned) {
20645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20646 LDKChainParameters this_ptr_conv;
20647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20648 this_ptr_conv.is_owned = false;
20649 LDKBestBlock val_conv;
20650 val_conv.inner = (void*)(val & (~1));
20651 val_conv.is_owned = (val & 1) || (val == 0);
20652 val_conv = BestBlock_clone(&val_conv);
20653 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
20657 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
20658 LDKBestBlock best_block_arg_conv;
20659 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20660 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20661 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20662 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20663 uint64_t ret_ref = 0;
20664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20666 ret_ref = (uint64_t)ret_var.inner;
20667 if (ret_var.is_owned) {
20673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20674 LDKChainParameters orig_conv;
20675 orig_conv.inner = (void*)(orig & (~1));
20676 orig_conv.is_owned = false;
20677 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20678 uint64_t ret_ref = 0;
20679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20681 ret_ref = (uint64_t)ret_var.inner;
20682 if (ret_var.is_owned) {
20688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20689 LDKCounterpartyForwardingInfo this_obj_conv;
20690 this_obj_conv.inner = (void*)(this_obj & (~1));
20691 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20692 CounterpartyForwardingInfo_free(this_obj_conv);
20695 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20696 LDKCounterpartyForwardingInfo this_ptr_conv;
20697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20698 this_ptr_conv.is_owned = false;
20699 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20704 LDKCounterpartyForwardingInfo this_ptr_conv;
20705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20706 this_ptr_conv.is_owned = false;
20707 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20710 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
20711 LDKCounterpartyForwardingInfo this_ptr_conv;
20712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20713 this_ptr_conv.is_owned = false;
20714 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20719 LDKCounterpartyForwardingInfo this_ptr_conv;
20720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20721 this_ptr_conv.is_owned = false;
20722 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20725 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
20726 LDKCounterpartyForwardingInfo this_ptr_conv;
20727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20728 this_ptr_conv.is_owned = false;
20729 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20734 LDKCounterpartyForwardingInfo this_ptr_conv;
20735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20736 this_ptr_conv.is_owned = false;
20737 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20740 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) {
20741 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20742 uint64_t ret_ref = 0;
20743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20745 ret_ref = (uint64_t)ret_var.inner;
20746 if (ret_var.is_owned) {
20752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20753 LDKCounterpartyForwardingInfo orig_conv;
20754 orig_conv.inner = (void*)(orig & (~1));
20755 orig_conv.is_owned = false;
20756 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20757 uint64_t ret_ref = 0;
20758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20760 ret_ref = (uint64_t)ret_var.inner;
20761 if (ret_var.is_owned) {
20767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20768 LDKChannelCounterparty this_obj_conv;
20769 this_obj_conv.inner = (void*)(this_obj & (~1));
20770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20771 ChannelCounterparty_free(this_obj_conv);
20774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20775 LDKChannelCounterparty this_ptr_conv;
20776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20777 this_ptr_conv.is_owned = false;
20778 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
20783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20784 LDKChannelCounterparty this_ptr_conv;
20785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20786 this_ptr_conv.is_owned = false;
20787 LDKPublicKey val_ref;
20788 CHECK((*env)->GetArrayLength(env, val) == 33);
20789 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20790 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20794 LDKChannelCounterparty this_ptr_conv;
20795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20796 this_ptr_conv.is_owned = false;
20797 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20798 uint64_t ret_ref = 0;
20799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20801 ret_ref = (uint64_t)ret_var.inner;
20802 if (ret_var.is_owned) {
20808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20809 LDKChannelCounterparty this_ptr_conv;
20810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20811 this_ptr_conv.is_owned = false;
20812 LDKInitFeatures val_conv;
20813 val_conv.inner = (void*)(val & (~1));
20814 val_conv.is_owned = (val & 1) || (val == 0);
20815 val_conv = InitFeatures_clone(&val_conv);
20816 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
20820 LDKChannelCounterparty this_ptr_conv;
20821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20822 this_ptr_conv.is_owned = false;
20823 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20828 LDKChannelCounterparty this_ptr_conv;
20829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20830 this_ptr_conv.is_owned = false;
20831 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
20834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
20835 LDKChannelCounterparty this_ptr_conv;
20836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20837 this_ptr_conv.is_owned = false;
20838 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
20839 uint64_t ret_ref = 0;
20840 if ((uint64_t)ret_var.inner > 4096) {
20841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20843 ret_ref = (uint64_t)ret_var.inner;
20844 if (ret_var.is_owned) {
20851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20852 LDKChannelCounterparty this_ptr_conv;
20853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20854 this_ptr_conv.is_owned = false;
20855 LDKCounterpartyForwardingInfo val_conv;
20856 val_conv.inner = (void*)(val & (~1));
20857 val_conv.is_owned = (val & 1) || (val == 0);
20858 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
20859 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
20862 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) {
20863 LDKPublicKey node_id_arg_ref;
20864 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
20865 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
20866 LDKInitFeatures features_arg_conv;
20867 features_arg_conv.inner = (void*)(features_arg & (~1));
20868 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20869 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20870 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
20871 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
20872 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
20873 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
20874 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
20875 uint64_t ret_ref = 0;
20876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20878 ret_ref = (uint64_t)ret_var.inner;
20879 if (ret_var.is_owned) {
20885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20886 LDKChannelCounterparty orig_conv;
20887 orig_conv.inner = (void*)(orig & (~1));
20888 orig_conv.is_owned = false;
20889 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
20890 uint64_t ret_ref = 0;
20891 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20892 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20893 ret_ref = (uint64_t)ret_var.inner;
20894 if (ret_var.is_owned) {
20900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20901 LDKChannelDetails this_obj_conv;
20902 this_obj_conv.inner = (void*)(this_obj & (~1));
20903 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20904 ChannelDetails_free(this_obj_conv);
20907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20908 LDKChannelDetails this_ptr_conv;
20909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20910 this_ptr_conv.is_owned = false;
20911 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
20916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20917 LDKChannelDetails this_ptr_conv;
20918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20919 this_ptr_conv.is_owned = false;
20920 LDKThirtyTwoBytes val_ref;
20921 CHECK((*env)->GetArrayLength(env, val) == 32);
20922 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20923 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
20926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
20927 LDKChannelDetails this_ptr_conv;
20928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20929 this_ptr_conv.is_owned = false;
20930 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
20931 uint64_t ret_ref = 0;
20932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20934 ret_ref = (uint64_t)ret_var.inner;
20935 if (ret_var.is_owned) {
20941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20942 LDKChannelDetails this_ptr_conv;
20943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20944 this_ptr_conv.is_owned = false;
20945 LDKChannelCounterparty val_conv;
20946 val_conv.inner = (void*)(val & (~1));
20947 val_conv.is_owned = (val & 1) || (val == 0);
20948 val_conv = ChannelCounterparty_clone(&val_conv);
20949 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
20952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
20953 LDKChannelDetails this_ptr_conv;
20954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20955 this_ptr_conv.is_owned = false;
20956 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
20957 uint64_t ret_ref = 0;
20958 if ((uint64_t)ret_var.inner > 4096) {
20959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20961 ret_ref = (uint64_t)ret_var.inner;
20962 if (ret_var.is_owned) {
20969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20970 LDKChannelDetails this_ptr_conv;
20971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20972 this_ptr_conv.is_owned = false;
20973 LDKOutPoint val_conv;
20974 val_conv.inner = (void*)(val & (~1));
20975 val_conv.is_owned = (val & 1) || (val == 0);
20976 val_conv = OutPoint_clone(&val_conv);
20977 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
20980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20981 LDKChannelDetails this_ptr_conv;
20982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20983 this_ptr_conv.is_owned = false;
20984 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20985 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
20986 uint64_t ret_ref = (uint64_t)ret_copy;
20990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20991 LDKChannelDetails this_ptr_conv;
20992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20993 this_ptr_conv.is_owned = false;
20994 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20995 CHECK_ACCESS(val_ptr);
20996 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20997 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20998 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
21001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
21002 LDKChannelDetails this_ptr_conv;
21003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21004 this_ptr_conv.is_owned = false;
21005 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
21009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21010 LDKChannelDetails this_ptr_conv;
21011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21012 this_ptr_conv.is_owned = false;
21013 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
21016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
21017 LDKChannelDetails this_ptr_conv;
21018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21019 this_ptr_conv.is_owned = false;
21020 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
21021 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
21022 uint64_t ret_ref = (uint64_t)ret_copy;
21026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21027 LDKChannelDetails this_ptr_conv;
21028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21029 this_ptr_conv.is_owned = false;
21030 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21031 CHECK_ACCESS(val_ptr);
21032 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
21033 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
21034 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
21037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21038 LDKChannelDetails this_ptr_conv;
21039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21040 this_ptr_conv.is_owned = false;
21041 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
21045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21046 LDKChannelDetails this_ptr_conv;
21047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21048 this_ptr_conv.is_owned = false;
21049 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
21052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21053 LDKChannelDetails this_ptr_conv;
21054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21055 this_ptr_conv.is_owned = false;
21056 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
21060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21061 LDKChannelDetails this_ptr_conv;
21062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21063 this_ptr_conv.is_owned = false;
21064 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
21067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21068 LDKChannelDetails this_ptr_conv;
21069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21070 this_ptr_conv.is_owned = false;
21071 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21076 LDKChannelDetails this_ptr_conv;
21077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21078 this_ptr_conv.is_owned = false;
21079 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
21083 LDKChannelDetails this_ptr_conv;
21084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21085 this_ptr_conv.is_owned = false;
21086 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21087 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21088 uint64_t ret_ref = (uint64_t)ret_copy;
21092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21093 LDKChannelDetails this_ptr_conv;
21094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21095 this_ptr_conv.is_owned = false;
21096 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21097 CHECK_ACCESS(val_ptr);
21098 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21099 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21100 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21104 LDKChannelDetails this_ptr_conv;
21105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21106 this_ptr_conv.is_owned = false;
21107 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21108 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21109 uint64_t ret_ref = (uint64_t)ret_copy;
21113 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) {
21114 LDKChannelDetails this_ptr_conv;
21115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21116 this_ptr_conv.is_owned = false;
21117 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21118 CHECK_ACCESS(val_ptr);
21119 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21120 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21121 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
21125 LDKChannelDetails this_ptr_conv;
21126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21127 this_ptr_conv.is_owned = false;
21128 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21133 LDKChannelDetails this_ptr_conv;
21134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21135 this_ptr_conv.is_owned = false;
21136 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
21140 LDKChannelDetails this_ptr_conv;
21141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21142 this_ptr_conv.is_owned = false;
21143 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21148 LDKChannelDetails this_ptr_conv;
21149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21150 this_ptr_conv.is_owned = false;
21151 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
21155 LDKChannelDetails this_ptr_conv;
21156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21157 this_ptr_conv.is_owned = false;
21158 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21163 LDKChannelDetails this_ptr_conv;
21164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21165 this_ptr_conv.is_owned = false;
21166 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
21170 LDKChannelDetails this_ptr_conv;
21171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21172 this_ptr_conv.is_owned = false;
21173 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21178 LDKChannelDetails this_ptr_conv;
21179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21180 this_ptr_conv.is_owned = false;
21181 ChannelDetails_set_is_public(&this_ptr_conv, val);
21184 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) {
21185 LDKThirtyTwoBytes channel_id_arg_ref;
21186 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21187 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21188 LDKChannelCounterparty counterparty_arg_conv;
21189 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21190 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21191 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21192 LDKOutPoint funding_txo_arg_conv;
21193 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21194 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21195 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21196 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21197 CHECK_ACCESS(short_channel_id_arg_ptr);
21198 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21199 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21200 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21201 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21202 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21203 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21204 CHECK_ACCESS(confirmations_required_arg_ptr);
21205 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21206 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21207 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21208 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21209 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21210 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21211 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);
21212 uint64_t ret_ref = 0;
21213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21215 ret_ref = (uint64_t)ret_var.inner;
21216 if (ret_var.is_owned) {
21222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21223 LDKChannelDetails orig_conv;
21224 orig_conv.inner = (void*)(orig & (~1));
21225 orig_conv.is_owned = false;
21226 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21227 uint64_t ret_ref = 0;
21228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21230 ret_ref = (uint64_t)ret_var.inner;
21231 if (ret_var.is_owned) {
21237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21238 if ((this_ptr & 1) != 0) return;
21239 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21240 CHECK_ACCESS(this_ptr_ptr);
21241 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21242 FREE((void*)this_ptr);
21243 PaymentSendFailure_free(this_ptr_conv);
21246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21247 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21248 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21249 *ret_copy = PaymentSendFailure_clone(orig_conv);
21250 uint64_t ret_ref = (uint64_t)ret_copy;
21254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
21255 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21256 CHECK_ACCESS(a_ptr);
21257 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21258 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21259 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21260 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21261 uint64_t ret_ref = (uint64_t)ret_copy;
21265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
21266 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21267 a_constr.datalen = (*env)->GetArrayLength(env, a);
21268 if (a_constr.datalen > 0)
21269 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21271 a_constr.data = NULL;
21272 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
21273 for (size_t w = 0; w < a_constr.datalen; w++) {
21274 int64_t a_conv_22 = a_vals[w];
21275 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21276 CHECK_ACCESS(a_conv_22_ptr);
21277 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21278 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21279 a_constr.data[w] = a_conv_22_conv;
21281 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
21282 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21283 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21284 uint64_t ret_ref = (uint64_t)ret_copy;
21288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
21289 LDKCVec_APIErrorZ a_constr;
21290 a_constr.datalen = (*env)->GetArrayLength(env, a);
21291 if (a_constr.datalen > 0)
21292 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21294 a_constr.data = NULL;
21295 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
21296 for (size_t k = 0; k < a_constr.datalen; k++) {
21297 int64_t a_conv_10 = a_vals[k];
21298 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21299 CHECK_ACCESS(a_conv_10_ptr);
21300 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21301 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21302 a_constr.data[k] = a_conv_10_conv;
21304 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
21305 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21306 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21307 uint64_t ret_ref = (uint64_t)ret_copy;
21311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
21312 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21313 results_constr.datalen = (*env)->GetArrayLength(env, results);
21314 if (results_constr.datalen > 0)
21315 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21317 results_constr.data = NULL;
21318 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
21319 for (size_t w = 0; w < results_constr.datalen; w++) {
21320 int64_t results_conv_22 = results_vals[w];
21321 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21322 CHECK_ACCESS(results_conv_22_ptr);
21323 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21324 results_constr.data[w] = results_conv_22_conv;
21326 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
21327 LDKRouteParameters failed_paths_retry_conv;
21328 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21329 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21330 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21331 LDKThirtyTwoBytes payment_id_ref;
21332 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21333 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21334 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21335 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21336 uint64_t ret_ref = (uint64_t)ret_copy;
21340 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) {
21341 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21342 CHECK_ACCESS(fee_est_ptr);
21343 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21344 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
21345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21346 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
21348 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21349 CHECK_ACCESS(chain_monitor_ptr);
21350 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21351 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
21352 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21353 LDKWatch_JCalls_cloned(&chain_monitor_conv);
21355 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21356 CHECK_ACCESS(tx_broadcaster_ptr);
21357 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21358 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
21359 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21360 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
21362 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21363 CHECK_ACCESS(logger_ptr);
21364 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21365 if (logger_conv.free == LDKLogger_JCalls_free) {
21366 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21367 LDKLogger_JCalls_cloned(&logger_conv);
21369 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21370 CHECK_ACCESS(keys_manager_ptr);
21371 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21372 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
21373 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21374 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
21376 LDKUserConfig config_conv;
21377 config_conv.inner = (void*)(config & (~1));
21378 config_conv.is_owned = (config & 1) || (config == 0);
21379 config_conv = UserConfig_clone(&config_conv);
21380 LDKChainParameters params_conv;
21381 params_conv.inner = (void*)(params & (~1));
21382 params_conv.is_owned = (params & 1) || (params == 0);
21383 params_conv = ChainParameters_clone(¶ms_conv);
21384 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21385 uint64_t ret_ref = 0;
21386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21388 ret_ref = (uint64_t)ret_var.inner;
21389 if (ret_var.is_owned) {
21395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
21396 LDKChannelManager this_arg_conv;
21397 this_arg_conv.inner = (void*)(this_arg & (~1));
21398 this_arg_conv.is_owned = false;
21399 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21400 uint64_t ret_ref = 0;
21401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21403 ret_ref = (uint64_t)ret_var.inner;
21404 if (ret_var.is_owned) {
21410 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) {
21411 LDKChannelManager this_arg_conv;
21412 this_arg_conv.inner = (void*)(this_arg & (~1));
21413 this_arg_conv.is_owned = false;
21414 LDKPublicKey their_network_key_ref;
21415 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
21416 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
21417 LDKUserConfig override_config_conv;
21418 override_config_conv.inner = (void*)(override_config & (~1));
21419 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21420 override_config_conv = UserConfig_clone(&override_config_conv);
21421 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21422 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21423 return (uint64_t)ret_conv;
21426 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
21427 LDKChannelManager this_arg_conv;
21428 this_arg_conv.inner = (void*)(this_arg & (~1));
21429 this_arg_conv.is_owned = false;
21430 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21431 int64_tArray ret_arr = NULL;
21432 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
21433 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
21434 for (size_t q = 0; q < ret_var.datalen; q++) {
21435 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21436 uint64_t ret_conv_16_ref = 0;
21437 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21438 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21439 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21440 if (ret_conv_16_var.is_owned) {
21441 ret_conv_16_ref |= 1;
21443 ret_arr_ptr[q] = ret_conv_16_ref;
21445 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
21446 FREE(ret_var.data);
21450 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
21451 LDKChannelManager this_arg_conv;
21452 this_arg_conv.inner = (void*)(this_arg & (~1));
21453 this_arg_conv.is_owned = false;
21454 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21455 int64_tArray ret_arr = NULL;
21456 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
21457 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
21458 for (size_t q = 0; q < ret_var.datalen; q++) {
21459 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21460 uint64_t ret_conv_16_ref = 0;
21461 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21462 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21463 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21464 if (ret_conv_16_var.is_owned) {
21465 ret_conv_16_ref |= 1;
21467 ret_arr_ptr[q] = ret_conv_16_ref;
21469 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
21470 FREE(ret_var.data);
21474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
21475 LDKChannelManager this_arg_conv;
21476 this_arg_conv.inner = (void*)(this_arg & (~1));
21477 this_arg_conv.is_owned = false;
21478 unsigned char channel_id_arr[32];
21479 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
21480 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
21481 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21482 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21483 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21484 return (uint64_t)ret_conv;
21487 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) {
21488 LDKChannelManager this_arg_conv;
21489 this_arg_conv.inner = (void*)(this_arg & (~1));
21490 this_arg_conv.is_owned = false;
21491 unsigned char channel_id_arr[32];
21492 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
21493 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
21494 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21495 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21496 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21497 return (uint64_t)ret_conv;
21500 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) {
21501 LDKChannelManager this_arg_conv;
21502 this_arg_conv.inner = (void*)(this_arg & (~1));
21503 this_arg_conv.is_owned = false;
21504 unsigned char channel_id_arr[32];
21505 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
21506 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
21507 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21508 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21509 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21510 return (uint64_t)ret_conv;
21513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
21514 LDKChannelManager this_arg_conv;
21515 this_arg_conv.inner = (void*)(this_arg & (~1));
21516 this_arg_conv.is_owned = false;
21517 ChannelManager_force_close_all_channels(&this_arg_conv);
21520 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) {
21521 LDKChannelManager this_arg_conv;
21522 this_arg_conv.inner = (void*)(this_arg & (~1));
21523 this_arg_conv.is_owned = false;
21524 LDKRoute route_conv;
21525 route_conv.inner = (void*)(route & (~1));
21526 route_conv.is_owned = false;
21527 LDKThirtyTwoBytes payment_hash_ref;
21528 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21529 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21530 LDKThirtyTwoBytes payment_secret_ref;
21531 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
21532 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
21533 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21534 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21535 return (uint64_t)ret_conv;
21538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
21539 LDKChannelManager this_arg_conv;
21540 this_arg_conv.inner = (void*)(this_arg & (~1));
21541 this_arg_conv.is_owned = false;
21542 LDKRoute route_conv;
21543 route_conv.inner = (void*)(route & (~1));
21544 route_conv.is_owned = false;
21545 LDKThirtyTwoBytes payment_id_ref;
21546 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21547 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21548 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21549 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21550 return (uint64_t)ret_conv;
21553 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) {
21554 LDKChannelManager this_arg_conv;
21555 this_arg_conv.inner = (void*)(this_arg & (~1));
21556 this_arg_conv.is_owned = false;
21557 LDKRoute route_conv;
21558 route_conv.inner = (void*)(route & (~1));
21559 route_conv.is_owned = false;
21560 LDKThirtyTwoBytes payment_preimage_ref;
21561 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
21562 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
21563 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21564 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21565 return (uint64_t)ret_conv;
21568 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) {
21569 LDKChannelManager this_arg_conv;
21570 this_arg_conv.inner = (void*)(this_arg & (~1));
21571 this_arg_conv.is_owned = false;
21572 unsigned char temporary_channel_id_arr[32];
21573 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
21574 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
21575 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21576 LDKTransaction funding_transaction_ref;
21577 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
21578 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21579 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
21580 funding_transaction_ref.data_is_owned = true;
21581 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21582 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21583 return (uint64_t)ret_conv;
21586 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) {
21587 LDKChannelManager this_arg_conv;
21588 this_arg_conv.inner = (void*)(this_arg & (~1));
21589 this_arg_conv.is_owned = false;
21590 LDKThreeBytes rgb_ref;
21591 CHECK((*env)->GetArrayLength(env, rgb) == 3);
21592 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
21593 LDKThirtyTwoBytes alias_ref;
21594 CHECK((*env)->GetArrayLength(env, alias) == 32);
21595 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
21596 LDKCVec_NetAddressZ addresses_constr;
21597 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
21598 if (addresses_constr.datalen > 0)
21599 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21601 addresses_constr.data = NULL;
21602 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
21603 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21604 int64_t addresses_conv_12 = addresses_vals[m];
21605 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21606 CHECK_ACCESS(addresses_conv_12_ptr);
21607 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21608 addresses_constr.data[m] = addresses_conv_12_conv;
21610 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
21611 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
21615 LDKChannelManager this_arg_conv;
21616 this_arg_conv.inner = (void*)(this_arg & (~1));
21617 this_arg_conv.is_owned = false;
21618 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21622 LDKChannelManager this_arg_conv;
21623 this_arg_conv.inner = (void*)(this_arg & (~1));
21624 this_arg_conv.is_owned = false;
21625 ChannelManager_timer_tick_occurred(&this_arg_conv);
21628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
21629 LDKChannelManager this_arg_conv;
21630 this_arg_conv.inner = (void*)(this_arg & (~1));
21631 this_arg_conv.is_owned = false;
21632 unsigned char payment_hash_arr[32];
21633 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21634 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
21635 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21636 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
21641 LDKChannelManager this_arg_conv;
21642 this_arg_conv.inner = (void*)(this_arg & (~1));
21643 this_arg_conv.is_owned = false;
21644 LDKThirtyTwoBytes payment_preimage_ref;
21645 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
21646 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
21647 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
21652 LDKChannelManager this_arg_conv;
21653 this_arg_conv.inner = (void*)(this_arg & (~1));
21654 this_arg_conv.is_owned = false;
21655 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21656 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
21660 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) {
21661 LDKChannelManager this_arg_conv;
21662 this_arg_conv.inner = (void*)(this_arg & (~1));
21663 this_arg_conv.is_owned = false;
21664 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21665 CHECK_ACCESS(min_value_msat_ptr);
21666 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21667 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21668 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
21669 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
21670 return ((uint64_t)ret_conv);
21673 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) {
21674 LDKChannelManager this_arg_conv;
21675 this_arg_conv.inner = (void*)(this_arg & (~1));
21676 this_arg_conv.is_owned = false;
21677 LDKThirtyTwoBytes payment_hash_ref;
21678 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21679 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21680 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21681 CHECK_ACCESS(min_value_msat_ptr);
21682 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21683 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21684 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21685 *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);
21686 return (uint64_t)ret_conv;
21689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
21690 LDKChannelManager this_arg_conv;
21691 this_arg_conv.inner = (void*)(this_arg & (~1));
21692 this_arg_conv.is_owned = false;
21693 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21694 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
21695 return (uint64_t)ret_ret;
21698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
21699 LDKChannelManager this_arg_conv;
21700 this_arg_conv.inner = (void*)(this_arg & (~1));
21701 this_arg_conv.is_owned = false;
21702 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21703 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
21704 return (uint64_t)ret_ret;
21707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
21708 LDKChannelManager this_arg_conv;
21709 this_arg_conv.inner = (void*)(this_arg & (~1));
21710 this_arg_conv.is_owned = false;
21711 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21712 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
21713 return (uint64_t)ret_ret;
21716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
21717 LDKChannelManager this_arg_conv;
21718 this_arg_conv.inner = (void*)(this_arg & (~1));
21719 this_arg_conv.is_owned = false;
21720 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21721 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
21722 return (uint64_t)ret_ret;
21725 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) {
21726 LDKChannelManager this_arg_conv;
21727 this_arg_conv.inner = (void*)(this_arg & (~1));
21728 this_arg_conv.is_owned = false;
21729 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
21733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
21734 LDKChannelManager this_arg_conv;
21735 this_arg_conv.inner = (void*)(this_arg & (~1));
21736 this_arg_conv.is_owned = false;
21737 ChannelManager_await_persistable_update(&this_arg_conv);
21740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
21741 LDKChannelManager this_arg_conv;
21742 this_arg_conv.inner = (void*)(this_arg & (~1));
21743 this_arg_conv.is_owned = false;
21744 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
21745 uint64_t ret_ref = 0;
21746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21748 ret_ref = (uint64_t)ret_var.inner;
21749 if (ret_var.is_owned) {
21755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
21756 LDKChannelManager this_arg_conv;
21757 this_arg_conv.inner = (void*)(this_arg & (~1));
21758 this_arg_conv.is_owned = false;
21759 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21760 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
21761 return (uint64_t)ret_ret;
21764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
21765 LDKChannelManager obj_conv;
21766 obj_conv.inner = (void*)(obj & (~1));
21767 obj_conv.is_owned = false;
21768 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
21769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21771 CVec_u8Z_free(ret_var);
21775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21776 LDKChannelManagerReadArgs this_obj_conv;
21777 this_obj_conv.inner = (void*)(this_obj & (~1));
21778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21779 ChannelManagerReadArgs_free(this_obj_conv);
21782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
21783 LDKChannelManagerReadArgs this_ptr_conv;
21784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21785 this_ptr_conv.is_owned = false;
21786 // WARNING: This object doesn't live past this scope, needs clone!
21787 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
21791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21792 LDKChannelManagerReadArgs this_ptr_conv;
21793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21794 this_ptr_conv.is_owned = false;
21795 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21796 CHECK_ACCESS(val_ptr);
21797 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
21798 if (val_conv.free == LDKKeysInterface_JCalls_free) {
21799 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21800 LDKKeysInterface_JCalls_cloned(&val_conv);
21802 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
21805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
21806 LDKChannelManagerReadArgs this_ptr_conv;
21807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21808 this_ptr_conv.is_owned = false;
21809 // WARNING: This object doesn't live past this scope, needs clone!
21810 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
21814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21815 LDKChannelManagerReadArgs this_ptr_conv;
21816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21817 this_ptr_conv.is_owned = false;
21818 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21819 CHECK_ACCESS(val_ptr);
21820 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
21821 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
21822 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21823 LDKFeeEstimator_JCalls_cloned(&val_conv);
21825 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
21828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
21829 LDKChannelManagerReadArgs this_ptr_conv;
21830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21831 this_ptr_conv.is_owned = false;
21832 // WARNING: This object doesn't live past this scope, needs clone!
21833 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
21837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21838 LDKChannelManagerReadArgs this_ptr_conv;
21839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21840 this_ptr_conv.is_owned = false;
21841 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21842 CHECK_ACCESS(val_ptr);
21843 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
21844 if (val_conv.free == LDKWatch_JCalls_free) {
21845 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21846 LDKWatch_JCalls_cloned(&val_conv);
21848 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
21851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
21852 LDKChannelManagerReadArgs this_ptr_conv;
21853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21854 this_ptr_conv.is_owned = false;
21855 // WARNING: This object doesn't live past this scope, needs clone!
21856 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
21860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21861 LDKChannelManagerReadArgs this_ptr_conv;
21862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21863 this_ptr_conv.is_owned = false;
21864 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21865 CHECK_ACCESS(val_ptr);
21866 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
21867 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
21868 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21869 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
21871 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
21874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
21875 LDKChannelManagerReadArgs this_ptr_conv;
21876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21877 this_ptr_conv.is_owned = false;
21878 // WARNING: This object doesn't live past this scope, needs clone!
21879 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
21883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21884 LDKChannelManagerReadArgs this_ptr_conv;
21885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21886 this_ptr_conv.is_owned = false;
21887 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21888 CHECK_ACCESS(val_ptr);
21889 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
21890 if (val_conv.free == LDKLogger_JCalls_free) {
21891 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21892 LDKLogger_JCalls_cloned(&val_conv);
21894 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
21897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
21898 LDKChannelManagerReadArgs this_ptr_conv;
21899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21900 this_ptr_conv.is_owned = false;
21901 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
21902 uint64_t ret_ref = 0;
21903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21905 ret_ref = (uint64_t)ret_var.inner;
21906 if (ret_var.is_owned) {
21912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21913 LDKChannelManagerReadArgs this_ptr_conv;
21914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21915 this_ptr_conv.is_owned = false;
21916 LDKUserConfig val_conv;
21917 val_conv.inner = (void*)(val & (~1));
21918 val_conv.is_owned = (val & 1) || (val == 0);
21919 val_conv = UserConfig_clone(&val_conv);
21920 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
21923 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) {
21924 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21925 CHECK_ACCESS(keys_manager_ptr);
21926 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21927 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
21928 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21929 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
21931 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
21932 CHECK_ACCESS(fee_estimator_ptr);
21933 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
21934 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
21935 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21936 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
21938 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21939 CHECK_ACCESS(chain_monitor_ptr);
21940 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21941 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
21942 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21943 LDKWatch_JCalls_cloned(&chain_monitor_conv);
21945 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21946 CHECK_ACCESS(tx_broadcaster_ptr);
21947 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21948 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
21949 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21950 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
21952 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21953 CHECK_ACCESS(logger_ptr);
21954 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21955 if (logger_conv.free == LDKLogger_JCalls_free) {
21956 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21957 LDKLogger_JCalls_cloned(&logger_conv);
21959 LDKUserConfig default_config_conv;
21960 default_config_conv.inner = (void*)(default_config & (~1));
21961 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
21962 default_config_conv = UserConfig_clone(&default_config_conv);
21963 LDKCVec_ChannelMonitorZ channel_monitors_constr;
21964 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
21965 if (channel_monitors_constr.datalen > 0)
21966 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21968 channel_monitors_constr.data = NULL;
21969 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
21970 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
21971 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
21972 LDKChannelMonitor channel_monitors_conv_16_conv;
21973 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
21974 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
21975 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
21977 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
21978 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);
21979 uint64_t ret_ref = 0;
21980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21982 ret_ref = (uint64_t)ret_var.inner;
21983 if (ret_var.is_owned) {
21989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
21990 LDKu8slice ser_ref;
21991 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21992 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21993 LDKChannelManagerReadArgs arg_conv;
21994 arg_conv.inner = (void*)(arg & (~1));
21995 arg_conv.is_owned = (arg & 1) || (arg == 0);
21996 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
21997 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21998 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
21999 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22000 return (uint64_t)ret_conv;
22003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22004 LDKDecodeError this_obj_conv;
22005 this_obj_conv.inner = (void*)(this_obj & (~1));
22006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22007 DecodeError_free(this_obj_conv);
22010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22011 LDKDecodeError orig_conv;
22012 orig_conv.inner = (void*)(orig & (~1));
22013 orig_conv.is_owned = false;
22014 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22015 uint64_t ret_ref = 0;
22016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22018 ret_ref = (uint64_t)ret_var.inner;
22019 if (ret_var.is_owned) {
22025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22026 LDKInit this_obj_conv;
22027 this_obj_conv.inner = (void*)(this_obj & (~1));
22028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22029 Init_free(this_obj_conv);
22032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22033 LDKInit this_ptr_conv;
22034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22035 this_ptr_conv.is_owned = false;
22036 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22037 uint64_t ret_ref = 0;
22038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22040 ret_ref = (uint64_t)ret_var.inner;
22041 if (ret_var.is_owned) {
22047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22048 LDKInit this_ptr_conv;
22049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22050 this_ptr_conv.is_owned = false;
22051 LDKInitFeatures val_conv;
22052 val_conv.inner = (void*)(val & (~1));
22053 val_conv.is_owned = (val & 1) || (val == 0);
22054 val_conv = InitFeatures_clone(&val_conv);
22055 Init_set_features(&this_ptr_conv, val_conv);
22058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
22059 LDKInitFeatures features_arg_conv;
22060 features_arg_conv.inner = (void*)(features_arg & (~1));
22061 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22062 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22063 LDKInit ret_var = Init_new(features_arg_conv);
22064 uint64_t ret_ref = 0;
22065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22067 ret_ref = (uint64_t)ret_var.inner;
22068 if (ret_var.is_owned) {
22074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22076 orig_conv.inner = (void*)(orig & (~1));
22077 orig_conv.is_owned = false;
22078 LDKInit ret_var = Init_clone(&orig_conv);
22079 uint64_t ret_ref = 0;
22080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22082 ret_ref = (uint64_t)ret_var.inner;
22083 if (ret_var.is_owned) {
22089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22090 LDKErrorMessage this_obj_conv;
22091 this_obj_conv.inner = (void*)(this_obj & (~1));
22092 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22093 ErrorMessage_free(this_obj_conv);
22096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22097 LDKErrorMessage this_ptr_conv;
22098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22099 this_ptr_conv.is_owned = false;
22100 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22101 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
22105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22106 LDKErrorMessage this_ptr_conv;
22107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22108 this_ptr_conv.is_owned = false;
22109 LDKThirtyTwoBytes val_ref;
22110 CHECK((*env)->GetArrayLength(env, val) == 32);
22111 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22112 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22115 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
22116 LDKErrorMessage this_ptr_conv;
22117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22118 this_ptr_conv.is_owned = false;
22119 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22120 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22126 LDKErrorMessage this_ptr_conv;
22127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22128 this_ptr_conv.is_owned = false;
22129 LDKStr val_conv = java_to_owned_str(env, val);
22130 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
22134 LDKThirtyTwoBytes channel_id_arg_ref;
22135 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
22136 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
22137 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
22138 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22139 uint64_t ret_ref = 0;
22140 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22141 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22142 ret_ref = (uint64_t)ret_var.inner;
22143 if (ret_var.is_owned) {
22149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22150 LDKErrorMessage orig_conv;
22151 orig_conv.inner = (void*)(orig & (~1));
22152 orig_conv.is_owned = false;
22153 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22154 uint64_t ret_ref = 0;
22155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22157 ret_ref = (uint64_t)ret_var.inner;
22158 if (ret_var.is_owned) {
22164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22165 LDKPing this_obj_conv;
22166 this_obj_conv.inner = (void*)(this_obj & (~1));
22167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22168 Ping_free(this_obj_conv);
22171 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
22172 LDKPing this_ptr_conv;
22173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22174 this_ptr_conv.is_owned = false;
22175 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22180 LDKPing this_ptr_conv;
22181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22182 this_ptr_conv.is_owned = false;
22183 Ping_set_ponglen(&this_ptr_conv, val);
22186 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
22187 LDKPing this_ptr_conv;
22188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22189 this_ptr_conv.is_owned = false;
22190 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22195 LDKPing this_ptr_conv;
22196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22197 this_ptr_conv.is_owned = false;
22198 Ping_set_byteslen(&this_ptr_conv, val);
22201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
22202 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22203 uint64_t ret_ref = 0;
22204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22206 ret_ref = (uint64_t)ret_var.inner;
22207 if (ret_var.is_owned) {
22213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22215 orig_conv.inner = (void*)(orig & (~1));
22216 orig_conv.is_owned = false;
22217 LDKPing ret_var = Ping_clone(&orig_conv);
22218 uint64_t ret_ref = 0;
22219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22221 ret_ref = (uint64_t)ret_var.inner;
22222 if (ret_var.is_owned) {
22228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22229 LDKPong this_obj_conv;
22230 this_obj_conv.inner = (void*)(this_obj & (~1));
22231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22232 Pong_free(this_obj_conv);
22235 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
22236 LDKPong this_ptr_conv;
22237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22238 this_ptr_conv.is_owned = false;
22239 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22244 LDKPong this_ptr_conv;
22245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22246 this_ptr_conv.is_owned = false;
22247 Pong_set_byteslen(&this_ptr_conv, val);
22250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
22251 LDKPong ret_var = Pong_new(byteslen_arg);
22252 uint64_t ret_ref = 0;
22253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22255 ret_ref = (uint64_t)ret_var.inner;
22256 if (ret_var.is_owned) {
22262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22264 orig_conv.inner = (void*)(orig & (~1));
22265 orig_conv.is_owned = false;
22266 LDKPong ret_var = Pong_clone(&orig_conv);
22267 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
22271 if (ret_var.is_owned) {
22277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22278 LDKOpenChannel 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 OpenChannel_free(this_obj_conv);
22284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22285 LDKOpenChannel 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, *OpenChannel_get_chain_hash(&this_ptr_conv));
22293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22294 LDKOpenChannel 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 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22304 LDKOpenChannel this_ptr_conv;
22305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22306 this_ptr_conv.is_owned = false;
22307 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22308 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
22312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22313 LDKOpenChannel this_ptr_conv;
22314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22315 this_ptr_conv.is_owned = false;
22316 LDKThirtyTwoBytes val_ref;
22317 CHECK((*env)->GetArrayLength(env, val) == 32);
22318 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22319 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22323 LDKOpenChannel this_ptr_conv;
22324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22325 this_ptr_conv.is_owned = false;
22326 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22331 LDKOpenChannel this_ptr_conv;
22332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22333 this_ptr_conv.is_owned = false;
22334 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22338 LDKOpenChannel this_ptr_conv;
22339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22340 this_ptr_conv.is_owned = false;
22341 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22346 LDKOpenChannel this_ptr_conv;
22347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22348 this_ptr_conv.is_owned = false;
22349 OpenChannel_set_push_msat(&this_ptr_conv, val);
22352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22353 LDKOpenChannel this_ptr_conv;
22354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22355 this_ptr_conv.is_owned = false;
22356 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22361 LDKOpenChannel this_ptr_conv;
22362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22363 this_ptr_conv.is_owned = false;
22364 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22367 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) {
22368 LDKOpenChannel this_ptr_conv;
22369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22370 this_ptr_conv.is_owned = false;
22371 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22375 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) {
22376 LDKOpenChannel this_ptr_conv;
22377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22378 this_ptr_conv.is_owned = false;
22379 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22383 LDKOpenChannel this_ptr_conv;
22384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22385 this_ptr_conv.is_owned = false;
22386 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22391 LDKOpenChannel this_ptr_conv;
22392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22393 this_ptr_conv.is_owned = false;
22394 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22398 LDKOpenChannel this_ptr_conv;
22399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22400 this_ptr_conv.is_owned = false;
22401 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22406 LDKOpenChannel this_ptr_conv;
22407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22408 this_ptr_conv.is_owned = false;
22409 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22412 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
22413 LDKOpenChannel this_ptr_conv;
22414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22415 this_ptr_conv.is_owned = false;
22416 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22421 LDKOpenChannel this_ptr_conv;
22422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22423 this_ptr_conv.is_owned = false;
22424 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22427 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22428 LDKOpenChannel this_ptr_conv;
22429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22430 this_ptr_conv.is_owned = false;
22431 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22436 LDKOpenChannel this_ptr_conv;
22437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22438 this_ptr_conv.is_owned = false;
22439 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22442 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22443 LDKOpenChannel this_ptr_conv;
22444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22445 this_ptr_conv.is_owned = false;
22446 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22451 LDKOpenChannel this_ptr_conv;
22452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22453 this_ptr_conv.is_owned = false;
22454 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22458 LDKOpenChannel this_ptr_conv;
22459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22460 this_ptr_conv.is_owned = false;
22461 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22462 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
22466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22467 LDKOpenChannel this_ptr_conv;
22468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22469 this_ptr_conv.is_owned = false;
22470 LDKPublicKey val_ref;
22471 CHECK((*env)->GetArrayLength(env, val) == 33);
22472 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22473 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22477 LDKOpenChannel this_ptr_conv;
22478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22479 this_ptr_conv.is_owned = false;
22480 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22481 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
22485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22486 LDKOpenChannel this_ptr_conv;
22487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22488 this_ptr_conv.is_owned = false;
22489 LDKPublicKey val_ref;
22490 CHECK((*env)->GetArrayLength(env, val) == 33);
22491 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22492 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22496 LDKOpenChannel this_ptr_conv;
22497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22498 this_ptr_conv.is_owned = false;
22499 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22500 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
22504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22505 LDKOpenChannel this_ptr_conv;
22506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22507 this_ptr_conv.is_owned = false;
22508 LDKPublicKey val_ref;
22509 CHECK((*env)->GetArrayLength(env, val) == 33);
22510 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22511 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
22514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22515 LDKOpenChannel this_ptr_conv;
22516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22517 this_ptr_conv.is_owned = false;
22518 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
22523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22524 LDKOpenChannel this_ptr_conv;
22525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22526 this_ptr_conv.is_owned = false;
22527 LDKPublicKey val_ref;
22528 CHECK((*env)->GetArrayLength(env, val) == 33);
22529 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22530 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22534 LDKOpenChannel this_ptr_conv;
22535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22536 this_ptr_conv.is_owned = false;
22537 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
22542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22543 LDKOpenChannel this_ptr_conv;
22544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22545 this_ptr_conv.is_owned = false;
22546 LDKPublicKey val_ref;
22547 CHECK((*env)->GetArrayLength(env, val) == 33);
22548 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22549 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22553 LDKOpenChannel this_ptr_conv;
22554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22555 this_ptr_conv.is_owned = false;
22556 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22557 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
22561 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) {
22562 LDKOpenChannel this_ptr_conv;
22563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22564 this_ptr_conv.is_owned = false;
22565 LDKPublicKey val_ref;
22566 CHECK((*env)->GetArrayLength(env, val) == 33);
22567 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22568 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22571 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
22572 LDKOpenChannel this_ptr_conv;
22573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22574 this_ptr_conv.is_owned = false;
22575 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
22579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
22580 LDKOpenChannel this_ptr_conv;
22581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22582 this_ptr_conv.is_owned = false;
22583 OpenChannel_set_channel_flags(&this_ptr_conv, val);
22586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22587 LDKOpenChannel orig_conv;
22588 orig_conv.inner = (void*)(orig & (~1));
22589 orig_conv.is_owned = false;
22590 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
22591 uint64_t ret_ref = 0;
22592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22594 ret_ref = (uint64_t)ret_var.inner;
22595 if (ret_var.is_owned) {
22601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22602 LDKAcceptChannel this_obj_conv;
22603 this_obj_conv.inner = (void*)(this_obj & (~1));
22604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22605 AcceptChannel_free(this_obj_conv);
22608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22609 LDKAcceptChannel this_ptr_conv;
22610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22611 this_ptr_conv.is_owned = false;
22612 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22613 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
22617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22618 LDKAcceptChannel this_ptr_conv;
22619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22620 this_ptr_conv.is_owned = false;
22621 LDKThirtyTwoBytes val_ref;
22622 CHECK((*env)->GetArrayLength(env, val) == 32);
22623 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22624 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22628 LDKAcceptChannel this_ptr_conv;
22629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22630 this_ptr_conv.is_owned = false;
22631 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
22635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22636 LDKAcceptChannel this_ptr_conv;
22637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22638 this_ptr_conv.is_owned = false;
22639 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22642 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) {
22643 LDKAcceptChannel this_ptr_conv;
22644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22645 this_ptr_conv.is_owned = false;
22646 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22650 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) {
22651 LDKAcceptChannel this_ptr_conv;
22652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22653 this_ptr_conv.is_owned = false;
22654 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22658 LDKAcceptChannel this_ptr_conv;
22659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22660 this_ptr_conv.is_owned = false;
22661 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22666 LDKAcceptChannel this_ptr_conv;
22667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22668 this_ptr_conv.is_owned = false;
22669 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22673 LDKAcceptChannel this_ptr_conv;
22674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22675 this_ptr_conv.is_owned = false;
22676 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
22680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22681 LDKAcceptChannel this_ptr_conv;
22682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22683 this_ptr_conv.is_owned = false;
22684 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
22688 LDKAcceptChannel this_ptr_conv;
22689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22690 this_ptr_conv.is_owned = false;
22691 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
22695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22696 LDKAcceptChannel this_ptr_conv;
22697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22698 this_ptr_conv.is_owned = false;
22699 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
22702 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22703 LDKAcceptChannel this_ptr_conv;
22704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22705 this_ptr_conv.is_owned = false;
22706 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
22710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22711 LDKAcceptChannel this_ptr_conv;
22712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22713 this_ptr_conv.is_owned = false;
22714 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
22717 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22718 LDKAcceptChannel this_ptr_conv;
22719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22720 this_ptr_conv.is_owned = false;
22721 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
22725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22726 LDKAcceptChannel this_ptr_conv;
22727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22728 this_ptr_conv.is_owned = false;
22729 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22733 LDKAcceptChannel this_ptr_conv;
22734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22735 this_ptr_conv.is_owned = false;
22736 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22737 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
22741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22742 LDKAcceptChannel this_ptr_conv;
22743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22744 this_ptr_conv.is_owned = false;
22745 LDKPublicKey val_ref;
22746 CHECK((*env)->GetArrayLength(env, val) == 33);
22747 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22748 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22752 LDKAcceptChannel this_ptr_conv;
22753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22754 this_ptr_conv.is_owned = false;
22755 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
22760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22761 LDKAcceptChannel this_ptr_conv;
22762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22763 this_ptr_conv.is_owned = false;
22764 LDKPublicKey val_ref;
22765 CHECK((*env)->GetArrayLength(env, val) == 33);
22766 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22767 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22771 LDKAcceptChannel this_ptr_conv;
22772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22773 this_ptr_conv.is_owned = false;
22774 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22775 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
22779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22780 LDKAcceptChannel this_ptr_conv;
22781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22782 this_ptr_conv.is_owned = false;
22783 LDKPublicKey val_ref;
22784 CHECK((*env)->GetArrayLength(env, val) == 33);
22785 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22786 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
22789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22790 LDKAcceptChannel this_ptr_conv;
22791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22792 this_ptr_conv.is_owned = false;
22793 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22794 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
22798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22799 LDKAcceptChannel this_ptr_conv;
22800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22801 this_ptr_conv.is_owned = false;
22802 LDKPublicKey val_ref;
22803 CHECK((*env)->GetArrayLength(env, val) == 33);
22804 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22805 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22809 LDKAcceptChannel this_ptr_conv;
22810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22811 this_ptr_conv.is_owned = false;
22812 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
22817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22818 LDKAcceptChannel this_ptr_conv;
22819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22820 this_ptr_conv.is_owned = false;
22821 LDKPublicKey val_ref;
22822 CHECK((*env)->GetArrayLength(env, val) == 33);
22823 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22824 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22828 LDKAcceptChannel this_ptr_conv;
22829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22830 this_ptr_conv.is_owned = false;
22831 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22832 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
22836 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) {
22837 LDKAcceptChannel this_ptr_conv;
22838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22839 this_ptr_conv.is_owned = false;
22840 LDKPublicKey val_ref;
22841 CHECK((*env)->GetArrayLength(env, val) == 33);
22842 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22843 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22847 LDKAcceptChannel orig_conv;
22848 orig_conv.inner = (void*)(orig & (~1));
22849 orig_conv.is_owned = false;
22850 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
22851 uint64_t ret_ref = 0;
22852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22854 ret_ref = (uint64_t)ret_var.inner;
22855 if (ret_var.is_owned) {
22861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22862 LDKFundingCreated this_obj_conv;
22863 this_obj_conv.inner = (void*)(this_obj & (~1));
22864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22865 FundingCreated_free(this_obj_conv);
22868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22869 LDKFundingCreated this_ptr_conv;
22870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22871 this_ptr_conv.is_owned = false;
22872 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
22877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22878 LDKFundingCreated this_ptr_conv;
22879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22880 this_ptr_conv.is_owned = false;
22881 LDKThirtyTwoBytes val_ref;
22882 CHECK((*env)->GetArrayLength(env, val) == 32);
22883 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22884 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
22887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22888 LDKFundingCreated this_ptr_conv;
22889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22890 this_ptr_conv.is_owned = false;
22891 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
22896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22897 LDKFundingCreated this_ptr_conv;
22898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22899 this_ptr_conv.is_owned = false;
22900 LDKThirtyTwoBytes val_ref;
22901 CHECK((*env)->GetArrayLength(env, val) == 32);
22902 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22903 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
22906 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
22907 LDKFundingCreated this_ptr_conv;
22908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22909 this_ptr_conv.is_owned = false;
22910 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
22914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22915 LDKFundingCreated this_ptr_conv;
22916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22917 this_ptr_conv.is_owned = false;
22918 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
22921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22922 LDKFundingCreated this_ptr_conv;
22923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22924 this_ptr_conv.is_owned = false;
22925 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22926 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
22930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22931 LDKFundingCreated this_ptr_conv;
22932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22933 this_ptr_conv.is_owned = false;
22934 LDKSignature val_ref;
22935 CHECK((*env)->GetArrayLength(env, val) == 64);
22936 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22937 FundingCreated_set_signature(&this_ptr_conv, val_ref);
22940 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) {
22941 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
22942 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
22943 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
22944 LDKThirtyTwoBytes funding_txid_arg_ref;
22945 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
22946 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
22947 LDKSignature signature_arg_ref;
22948 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22949 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22950 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
22951 uint64_t ret_ref = 0;
22952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22954 ret_ref = (uint64_t)ret_var.inner;
22955 if (ret_var.is_owned) {
22961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22962 LDKFundingCreated orig_conv;
22963 orig_conv.inner = (void*)(orig & (~1));
22964 orig_conv.is_owned = false;
22965 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
22966 uint64_t ret_ref = 0;
22967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22969 ret_ref = (uint64_t)ret_var.inner;
22970 if (ret_var.is_owned) {
22976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22977 LDKFundingSigned this_obj_conv;
22978 this_obj_conv.inner = (void*)(this_obj & (~1));
22979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22980 FundingSigned_free(this_obj_conv);
22983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22984 LDKFundingSigned this_ptr_conv;
22985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22986 this_ptr_conv.is_owned = false;
22987 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22988 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
22992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22993 LDKFundingSigned this_ptr_conv;
22994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22995 this_ptr_conv.is_owned = false;
22996 LDKThirtyTwoBytes val_ref;
22997 CHECK((*env)->GetArrayLength(env, val) == 32);
22998 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22999 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23003 LDKFundingSigned this_ptr_conv;
23004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23005 this_ptr_conv.is_owned = false;
23006 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23007 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
23011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23012 LDKFundingSigned this_ptr_conv;
23013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23014 this_ptr_conv.is_owned = false;
23015 LDKSignature val_ref;
23016 CHECK((*env)->GetArrayLength(env, val) == 64);
23017 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23018 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
23022 LDKThirtyTwoBytes channel_id_arg_ref;
23023 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23024 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23025 LDKSignature signature_arg_ref;
23026 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23027 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23028 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23029 uint64_t ret_ref = 0;
23030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23032 ret_ref = (uint64_t)ret_var.inner;
23033 if (ret_var.is_owned) {
23039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23040 LDKFundingSigned orig_conv;
23041 orig_conv.inner = (void*)(orig & (~1));
23042 orig_conv.is_owned = false;
23043 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23044 uint64_t ret_ref = 0;
23045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23047 ret_ref = (uint64_t)ret_var.inner;
23048 if (ret_var.is_owned) {
23054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23055 LDKFundingLocked this_obj_conv;
23056 this_obj_conv.inner = (void*)(this_obj & (~1));
23057 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23058 FundingLocked_free(this_obj_conv);
23061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23062 LDKFundingLocked this_ptr_conv;
23063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23064 this_ptr_conv.is_owned = false;
23065 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
23070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23071 LDKFundingLocked this_ptr_conv;
23072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23073 this_ptr_conv.is_owned = false;
23074 LDKThirtyTwoBytes val_ref;
23075 CHECK((*env)->GetArrayLength(env, val) == 32);
23076 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23077 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
23081 LDKFundingLocked this_ptr_conv;
23082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23083 this_ptr_conv.is_owned = false;
23084 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23085 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
23089 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) {
23090 LDKFundingLocked this_ptr_conv;
23091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23092 this_ptr_conv.is_owned = false;
23093 LDKPublicKey val_ref;
23094 CHECK((*env)->GetArrayLength(env, val) == 33);
23095 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23096 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23099 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) {
23100 LDKThirtyTwoBytes channel_id_arg_ref;
23101 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23102 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23103 LDKPublicKey next_per_commitment_point_arg_ref;
23104 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
23105 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
23106 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23107 uint64_t ret_ref = 0;
23108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23110 ret_ref = (uint64_t)ret_var.inner;
23111 if (ret_var.is_owned) {
23117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23118 LDKFundingLocked orig_conv;
23119 orig_conv.inner = (void*)(orig & (~1));
23120 orig_conv.is_owned = false;
23121 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23122 uint64_t ret_ref = 0;
23123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23125 ret_ref = (uint64_t)ret_var.inner;
23126 if (ret_var.is_owned) {
23132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23133 LDKShutdown this_obj_conv;
23134 this_obj_conv.inner = (void*)(this_obj & (~1));
23135 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23136 Shutdown_free(this_obj_conv);
23139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23140 LDKShutdown this_ptr_conv;
23141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23142 this_ptr_conv.is_owned = false;
23143 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23144 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
23148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23149 LDKShutdown this_ptr_conv;
23150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23151 this_ptr_conv.is_owned = false;
23152 LDKThirtyTwoBytes val_ref;
23153 CHECK((*env)->GetArrayLength(env, val) == 32);
23154 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23155 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
23159 LDKShutdown this_ptr_conv;
23160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23161 this_ptr_conv.is_owned = false;
23162 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23163 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23164 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23169 LDKShutdown this_ptr_conv;
23170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23171 this_ptr_conv.is_owned = false;
23172 LDKCVec_u8Z val_ref;
23173 val_ref.datalen = (*env)->GetArrayLength(env, val);
23174 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23175 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
23176 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23180 LDKThirtyTwoBytes channel_id_arg_ref;
23181 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23182 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23183 LDKCVec_u8Z scriptpubkey_arg_ref;
23184 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
23185 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23186 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
23187 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23188 uint64_t ret_ref = 0;
23189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23191 ret_ref = (uint64_t)ret_var.inner;
23192 if (ret_var.is_owned) {
23198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23199 LDKShutdown orig_conv;
23200 orig_conv.inner = (void*)(orig & (~1));
23201 orig_conv.is_owned = false;
23202 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23203 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
23207 if (ret_var.is_owned) {
23213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23214 LDKClosingSignedFeeRange this_obj_conv;
23215 this_obj_conv.inner = (void*)(this_obj & (~1));
23216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23217 ClosingSignedFeeRange_free(this_obj_conv);
23220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23221 LDKClosingSignedFeeRange this_ptr_conv;
23222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23223 this_ptr_conv.is_owned = false;
23224 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23229 LDKClosingSignedFeeRange this_ptr_conv;
23230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23231 this_ptr_conv.is_owned = false;
23232 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23236 LDKClosingSignedFeeRange this_ptr_conv;
23237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23238 this_ptr_conv.is_owned = false;
23239 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23244 LDKClosingSignedFeeRange this_ptr_conv;
23245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23246 this_ptr_conv.is_owned = false;
23247 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23250 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) {
23251 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23252 uint64_t ret_ref = 0;
23253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23255 ret_ref = (uint64_t)ret_var.inner;
23256 if (ret_var.is_owned) {
23262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23263 LDKClosingSignedFeeRange orig_conv;
23264 orig_conv.inner = (void*)(orig & (~1));
23265 orig_conv.is_owned = false;
23266 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
23267 uint64_t ret_ref = 0;
23268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23270 ret_ref = (uint64_t)ret_var.inner;
23271 if (ret_var.is_owned) {
23277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23278 LDKClosingSigned this_obj_conv;
23279 this_obj_conv.inner = (void*)(this_obj & (~1));
23280 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23281 ClosingSigned_free(this_obj_conv);
23284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23285 LDKClosingSigned this_ptr_conv;
23286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23287 this_ptr_conv.is_owned = false;
23288 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23289 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
23293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23294 LDKClosingSigned this_ptr_conv;
23295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23296 this_ptr_conv.is_owned = false;
23297 LDKThirtyTwoBytes val_ref;
23298 CHECK((*env)->GetArrayLength(env, val) == 32);
23299 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23300 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
23303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23304 LDKClosingSigned this_ptr_conv;
23305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23306 this_ptr_conv.is_owned = false;
23307 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
23311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23312 LDKClosingSigned this_ptr_conv;
23313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23314 this_ptr_conv.is_owned = false;
23315 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
23318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23319 LDKClosingSigned this_ptr_conv;
23320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23321 this_ptr_conv.is_owned = false;
23322 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23323 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
23327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23328 LDKClosingSigned this_ptr_conv;
23329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23330 this_ptr_conv.is_owned = false;
23331 LDKSignature val_ref;
23332 CHECK((*env)->GetArrayLength(env, val) == 64);
23333 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23334 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
23337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
23338 LDKClosingSigned this_ptr_conv;
23339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23340 this_ptr_conv.is_owned = false;
23341 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
23342 uint64_t ret_ref = 0;
23343 if ((uint64_t)ret_var.inner > 4096) {
23344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23346 ret_ref = (uint64_t)ret_var.inner;
23347 if (ret_var.is_owned) {
23354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23355 LDKClosingSigned this_ptr_conv;
23356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23357 this_ptr_conv.is_owned = false;
23358 LDKClosingSignedFeeRange val_conv;
23359 val_conv.inner = (void*)(val & (~1));
23360 val_conv.is_owned = (val & 1) || (val == 0);
23361 val_conv = ClosingSignedFeeRange_clone(&val_conv);
23362 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
23365 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) {
23366 LDKThirtyTwoBytes channel_id_arg_ref;
23367 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23368 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23369 LDKSignature signature_arg_ref;
23370 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23371 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23372 LDKClosingSignedFeeRange fee_range_arg_conv;
23373 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
23374 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
23375 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
23376 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
23377 uint64_t ret_ref = 0;
23378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23380 ret_ref = (uint64_t)ret_var.inner;
23381 if (ret_var.is_owned) {
23387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23388 LDKClosingSigned orig_conv;
23389 orig_conv.inner = (void*)(orig & (~1));
23390 orig_conv.is_owned = false;
23391 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
23392 uint64_t ret_ref = 0;
23393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23395 ret_ref = (uint64_t)ret_var.inner;
23396 if (ret_var.is_owned) {
23402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23403 LDKUpdateAddHTLC this_obj_conv;
23404 this_obj_conv.inner = (void*)(this_obj & (~1));
23405 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23406 UpdateAddHTLC_free(this_obj_conv);
23409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23410 LDKUpdateAddHTLC this_ptr_conv;
23411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23412 this_ptr_conv.is_owned = false;
23413 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23414 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
23418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23419 LDKUpdateAddHTLC this_ptr_conv;
23420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23421 this_ptr_conv.is_owned = false;
23422 LDKThirtyTwoBytes val_ref;
23423 CHECK((*env)->GetArrayLength(env, val) == 32);
23424 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23425 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
23428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23429 LDKUpdateAddHTLC this_ptr_conv;
23430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23431 this_ptr_conv.is_owned = false;
23432 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
23436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23437 LDKUpdateAddHTLC this_ptr_conv;
23438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23439 this_ptr_conv.is_owned = false;
23440 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
23443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23444 LDKUpdateAddHTLC this_ptr_conv;
23445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23446 this_ptr_conv.is_owned = false;
23447 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
23451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23452 LDKUpdateAddHTLC this_ptr_conv;
23453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23454 this_ptr_conv.is_owned = false;
23455 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
23458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23459 LDKUpdateAddHTLC this_ptr_conv;
23460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23461 this_ptr_conv.is_owned = false;
23462 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23463 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
23467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23468 LDKUpdateAddHTLC this_ptr_conv;
23469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23470 this_ptr_conv.is_owned = false;
23471 LDKThirtyTwoBytes val_ref;
23472 CHECK((*env)->GetArrayLength(env, val) == 32);
23473 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23474 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
23477 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
23478 LDKUpdateAddHTLC this_ptr_conv;
23479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23480 this_ptr_conv.is_owned = false;
23481 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
23485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23486 LDKUpdateAddHTLC this_ptr_conv;
23487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23488 this_ptr_conv.is_owned = false;
23489 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
23492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23493 LDKUpdateAddHTLC orig_conv;
23494 orig_conv.inner = (void*)(orig & (~1));
23495 orig_conv.is_owned = false;
23496 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
23497 uint64_t ret_ref = 0;
23498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23500 ret_ref = (uint64_t)ret_var.inner;
23501 if (ret_var.is_owned) {
23507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23508 LDKUpdateFulfillHTLC this_obj_conv;
23509 this_obj_conv.inner = (void*)(this_obj & (~1));
23510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23511 UpdateFulfillHTLC_free(this_obj_conv);
23514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23515 LDKUpdateFulfillHTLC this_ptr_conv;
23516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23517 this_ptr_conv.is_owned = false;
23518 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
23523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23524 LDKUpdateFulfillHTLC this_ptr_conv;
23525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23526 this_ptr_conv.is_owned = false;
23527 LDKThirtyTwoBytes val_ref;
23528 CHECK((*env)->GetArrayLength(env, val) == 32);
23529 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23530 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
23533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23534 LDKUpdateFulfillHTLC this_ptr_conv;
23535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23536 this_ptr_conv.is_owned = false;
23537 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
23541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23542 LDKUpdateFulfillHTLC this_ptr_conv;
23543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23544 this_ptr_conv.is_owned = false;
23545 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
23548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
23549 LDKUpdateFulfillHTLC this_ptr_conv;
23550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23551 this_ptr_conv.is_owned = false;
23552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
23557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23558 LDKUpdateFulfillHTLC this_ptr_conv;
23559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23560 this_ptr_conv.is_owned = false;
23561 LDKThirtyTwoBytes val_ref;
23562 CHECK((*env)->GetArrayLength(env, val) == 32);
23563 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23564 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
23567 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) {
23568 LDKThirtyTwoBytes channel_id_arg_ref;
23569 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23570 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23571 LDKThirtyTwoBytes payment_preimage_arg_ref;
23572 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
23573 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
23574 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
23575 uint64_t ret_ref = 0;
23576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23578 ret_ref = (uint64_t)ret_var.inner;
23579 if (ret_var.is_owned) {
23585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23586 LDKUpdateFulfillHTLC orig_conv;
23587 orig_conv.inner = (void*)(orig & (~1));
23588 orig_conv.is_owned = false;
23589 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
23590 uint64_t ret_ref = 0;
23591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23593 ret_ref = (uint64_t)ret_var.inner;
23594 if (ret_var.is_owned) {
23600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23601 LDKUpdateFailHTLC this_obj_conv;
23602 this_obj_conv.inner = (void*)(this_obj & (~1));
23603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23604 UpdateFailHTLC_free(this_obj_conv);
23607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23608 LDKUpdateFailHTLC this_ptr_conv;
23609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23610 this_ptr_conv.is_owned = false;
23611 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23612 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
23616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23617 LDKUpdateFailHTLC this_ptr_conv;
23618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23619 this_ptr_conv.is_owned = false;
23620 LDKThirtyTwoBytes val_ref;
23621 CHECK((*env)->GetArrayLength(env, val) == 32);
23622 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23623 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
23626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23627 LDKUpdateFailHTLC this_ptr_conv;
23628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23629 this_ptr_conv.is_owned = false;
23630 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
23634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23635 LDKUpdateFailHTLC this_ptr_conv;
23636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23637 this_ptr_conv.is_owned = false;
23638 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
23641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23642 LDKUpdateFailHTLC orig_conv;
23643 orig_conv.inner = (void*)(orig & (~1));
23644 orig_conv.is_owned = false;
23645 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
23646 uint64_t ret_ref = 0;
23647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23649 ret_ref = (uint64_t)ret_var.inner;
23650 if (ret_var.is_owned) {
23656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23657 LDKUpdateFailMalformedHTLC this_obj_conv;
23658 this_obj_conv.inner = (void*)(this_obj & (~1));
23659 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23660 UpdateFailMalformedHTLC_free(this_obj_conv);
23663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23664 LDKUpdateFailMalformedHTLC this_ptr_conv;
23665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23666 this_ptr_conv.is_owned = false;
23667 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23668 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
23672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23673 LDKUpdateFailMalformedHTLC this_ptr_conv;
23674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23675 this_ptr_conv.is_owned = false;
23676 LDKThirtyTwoBytes val_ref;
23677 CHECK((*env)->GetArrayLength(env, val) == 32);
23678 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23679 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
23682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23683 LDKUpdateFailMalformedHTLC this_ptr_conv;
23684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23685 this_ptr_conv.is_owned = false;
23686 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
23690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23691 LDKUpdateFailMalformedHTLC this_ptr_conv;
23692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23693 this_ptr_conv.is_owned = false;
23694 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
23697 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
23698 LDKUpdateFailMalformedHTLC this_ptr_conv;
23699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23700 this_ptr_conv.is_owned = false;
23701 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
23705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23706 LDKUpdateFailMalformedHTLC this_ptr_conv;
23707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23708 this_ptr_conv.is_owned = false;
23709 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
23712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23713 LDKUpdateFailMalformedHTLC orig_conv;
23714 orig_conv.inner = (void*)(orig & (~1));
23715 orig_conv.is_owned = false;
23716 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
23717 uint64_t ret_ref = 0;
23718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23720 ret_ref = (uint64_t)ret_var.inner;
23721 if (ret_var.is_owned) {
23727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23728 LDKCommitmentSigned this_obj_conv;
23729 this_obj_conv.inner = (void*)(this_obj & (~1));
23730 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23731 CommitmentSigned_free(this_obj_conv);
23734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23735 LDKCommitmentSigned this_ptr_conv;
23736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23737 this_ptr_conv.is_owned = false;
23738 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23739 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
23743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23744 LDKCommitmentSigned this_ptr_conv;
23745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23746 this_ptr_conv.is_owned = false;
23747 LDKThirtyTwoBytes val_ref;
23748 CHECK((*env)->GetArrayLength(env, val) == 32);
23749 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23750 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
23753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
23754 LDKCommitmentSigned this_ptr_conv;
23755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23756 this_ptr_conv.is_owned = false;
23757 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23758 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
23762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23763 LDKCommitmentSigned this_ptr_conv;
23764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23765 this_ptr_conv.is_owned = false;
23766 LDKSignature val_ref;
23767 CHECK((*env)->GetArrayLength(env, val) == 64);
23768 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23769 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
23772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23773 LDKCommitmentSigned this_ptr_conv;
23774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23775 this_ptr_conv.is_owned = false;
23776 LDKCVec_SignatureZ val_constr;
23777 val_constr.datalen = (*env)->GetArrayLength(env, val);
23778 if (val_constr.datalen > 0)
23779 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23781 val_constr.data = NULL;
23782 for (size_t i = 0; i < val_constr.datalen; i++) {
23783 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
23784 LDKSignature val_conv_8_ref;
23785 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
23786 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
23787 val_constr.data[i] = val_conv_8_ref;
23789 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
23792 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) {
23793 LDKThirtyTwoBytes channel_id_arg_ref;
23794 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23795 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23796 LDKSignature signature_arg_ref;
23797 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
23798 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
23799 LDKCVec_SignatureZ htlc_signatures_arg_constr;
23800 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
23801 if (htlc_signatures_arg_constr.datalen > 0)
23802 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23804 htlc_signatures_arg_constr.data = NULL;
23805 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
23806 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
23807 LDKSignature htlc_signatures_arg_conv_8_ref;
23808 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
23809 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
23810 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
23812 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
23813 uint64_t ret_ref = 0;
23814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23816 ret_ref = (uint64_t)ret_var.inner;
23817 if (ret_var.is_owned) {
23823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23824 LDKCommitmentSigned orig_conv;
23825 orig_conv.inner = (void*)(orig & (~1));
23826 orig_conv.is_owned = false;
23827 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
23828 uint64_t ret_ref = 0;
23829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23831 ret_ref = (uint64_t)ret_var.inner;
23832 if (ret_var.is_owned) {
23838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23839 LDKRevokeAndACK this_obj_conv;
23840 this_obj_conv.inner = (void*)(this_obj & (~1));
23841 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23842 RevokeAndACK_free(this_obj_conv);
23845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23846 LDKRevokeAndACK this_ptr_conv;
23847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23848 this_ptr_conv.is_owned = false;
23849 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23850 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
23854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23855 LDKRevokeAndACK this_ptr_conv;
23856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23857 this_ptr_conv.is_owned = false;
23858 LDKThirtyTwoBytes val_ref;
23859 CHECK((*env)->GetArrayLength(env, val) == 32);
23860 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23861 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
23864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
23865 LDKRevokeAndACK this_ptr_conv;
23866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23867 this_ptr_conv.is_owned = false;
23868 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23869 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
23873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23874 LDKRevokeAndACK this_ptr_conv;
23875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23876 this_ptr_conv.is_owned = false;
23877 LDKThirtyTwoBytes val_ref;
23878 CHECK((*env)->GetArrayLength(env, val) == 32);
23879 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23880 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
23883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
23884 LDKRevokeAndACK this_ptr_conv;
23885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23886 this_ptr_conv.is_owned = false;
23887 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
23892 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) {
23893 LDKRevokeAndACK this_ptr_conv;
23894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23895 this_ptr_conv.is_owned = false;
23896 LDKPublicKey val_ref;
23897 CHECK((*env)->GetArrayLength(env, val) == 33);
23898 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23899 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23902 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) {
23903 LDKThirtyTwoBytes channel_id_arg_ref;
23904 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23905 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23906 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
23907 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
23908 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
23909 LDKPublicKey next_per_commitment_point_arg_ref;
23910 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
23911 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
23912 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
23913 uint64_t ret_ref = 0;
23914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23916 ret_ref = (uint64_t)ret_var.inner;
23917 if (ret_var.is_owned) {
23923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23924 LDKRevokeAndACK orig_conv;
23925 orig_conv.inner = (void*)(orig & (~1));
23926 orig_conv.is_owned = false;
23927 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
23928 uint64_t ret_ref = 0;
23929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23931 ret_ref = (uint64_t)ret_var.inner;
23932 if (ret_var.is_owned) {
23938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23939 LDKUpdateFee this_obj_conv;
23940 this_obj_conv.inner = (void*)(this_obj & (~1));
23941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23942 UpdateFee_free(this_obj_conv);
23945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23946 LDKUpdateFee this_ptr_conv;
23947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23948 this_ptr_conv.is_owned = false;
23949 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
23954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23955 LDKUpdateFee this_ptr_conv;
23956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23957 this_ptr_conv.is_owned = false;
23958 LDKThirtyTwoBytes val_ref;
23959 CHECK((*env)->GetArrayLength(env, val) == 32);
23960 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23961 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
23964 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
23965 LDKUpdateFee this_ptr_conv;
23966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23967 this_ptr_conv.is_owned = false;
23968 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
23972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23973 LDKUpdateFee this_ptr_conv;
23974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23975 this_ptr_conv.is_owned = false;
23976 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
23979 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) {
23980 LDKThirtyTwoBytes channel_id_arg_ref;
23981 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
23982 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
23983 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
23984 uint64_t ret_ref = 0;
23985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23987 ret_ref = (uint64_t)ret_var.inner;
23988 if (ret_var.is_owned) {
23994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23995 LDKUpdateFee orig_conv;
23996 orig_conv.inner = (void*)(orig & (~1));
23997 orig_conv.is_owned = false;
23998 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
23999 uint64_t ret_ref = 0;
24000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24002 ret_ref = (uint64_t)ret_var.inner;
24003 if (ret_var.is_owned) {
24009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24010 LDKDataLossProtect this_obj_conv;
24011 this_obj_conv.inner = (void*)(this_obj & (~1));
24012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24013 DataLossProtect_free(this_obj_conv);
24016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
24017 LDKDataLossProtect this_ptr_conv;
24018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24019 this_ptr_conv.is_owned = false;
24020 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
24025 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) {
24026 LDKDataLossProtect this_ptr_conv;
24027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24028 this_ptr_conv.is_owned = false;
24029 LDKThirtyTwoBytes val_ref;
24030 CHECK((*env)->GetArrayLength(env, val) == 32);
24031 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24032 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
24035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24036 LDKDataLossProtect this_ptr_conv;
24037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24038 this_ptr_conv.is_owned = false;
24039 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24040 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
24044 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) {
24045 LDKDataLossProtect this_ptr_conv;
24046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24047 this_ptr_conv.is_owned = false;
24048 LDKPublicKey val_ref;
24049 CHECK((*env)->GetArrayLength(env, val) == 33);
24050 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24051 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
24054 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) {
24055 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
24056 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
24057 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
24058 LDKPublicKey my_current_per_commitment_point_arg_ref;
24059 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
24060 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
24061 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
24062 uint64_t ret_ref = 0;
24063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24065 ret_ref = (uint64_t)ret_var.inner;
24066 if (ret_var.is_owned) {
24072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24073 LDKDataLossProtect orig_conv;
24074 orig_conv.inner = (void*)(orig & (~1));
24075 orig_conv.is_owned = false;
24076 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
24077 uint64_t ret_ref = 0;
24078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24080 ret_ref = (uint64_t)ret_var.inner;
24081 if (ret_var.is_owned) {
24087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24088 LDKChannelReestablish this_obj_conv;
24089 this_obj_conv.inner = (void*)(this_obj & (~1));
24090 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24091 ChannelReestablish_free(this_obj_conv);
24094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24095 LDKChannelReestablish this_ptr_conv;
24096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24097 this_ptr_conv.is_owned = false;
24098 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24099 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
24103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24104 LDKChannelReestablish this_ptr_conv;
24105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24106 this_ptr_conv.is_owned = false;
24107 LDKThirtyTwoBytes val_ref;
24108 CHECK((*env)->GetArrayLength(env, val) == 32);
24109 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24110 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
24113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
24114 LDKChannelReestablish this_ptr_conv;
24115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24116 this_ptr_conv.is_owned = false;
24117 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
24121 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) {
24122 LDKChannelReestablish this_ptr_conv;
24123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24124 this_ptr_conv.is_owned = false;
24125 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
24128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
24129 LDKChannelReestablish this_ptr_conv;
24130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24131 this_ptr_conv.is_owned = false;
24132 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
24136 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) {
24137 LDKChannelReestablish this_ptr_conv;
24138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24139 this_ptr_conv.is_owned = false;
24140 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
24143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24144 LDKChannelReestablish orig_conv;
24145 orig_conv.inner = (void*)(orig & (~1));
24146 orig_conv.is_owned = false;
24147 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
24148 uint64_t ret_ref = 0;
24149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24151 ret_ref = (uint64_t)ret_var.inner;
24152 if (ret_var.is_owned) {
24158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24159 LDKAnnouncementSignatures this_obj_conv;
24160 this_obj_conv.inner = (void*)(this_obj & (~1));
24161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24162 AnnouncementSignatures_free(this_obj_conv);
24165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24166 LDKAnnouncementSignatures this_ptr_conv;
24167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24168 this_ptr_conv.is_owned = false;
24169 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24170 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
24174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24175 LDKAnnouncementSignatures this_ptr_conv;
24176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24177 this_ptr_conv.is_owned = false;
24178 LDKThirtyTwoBytes val_ref;
24179 CHECK((*env)->GetArrayLength(env, val) == 32);
24180 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24181 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
24184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24185 LDKAnnouncementSignatures this_ptr_conv;
24186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24187 this_ptr_conv.is_owned = false;
24188 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
24192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24193 LDKAnnouncementSignatures this_ptr_conv;
24194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24195 this_ptr_conv.is_owned = false;
24196 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
24199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
24200 LDKAnnouncementSignatures this_ptr_conv;
24201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24202 this_ptr_conv.is_owned = false;
24203 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
24208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24209 LDKAnnouncementSignatures this_ptr_conv;
24210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24211 this_ptr_conv.is_owned = false;
24212 LDKSignature val_ref;
24213 CHECK((*env)->GetArrayLength(env, val) == 64);
24214 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24215 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
24218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
24219 LDKAnnouncementSignatures this_ptr_conv;
24220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24221 this_ptr_conv.is_owned = false;
24222 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
24227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24228 LDKAnnouncementSignatures this_ptr_conv;
24229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24230 this_ptr_conv.is_owned = false;
24231 LDKSignature val_ref;
24232 CHECK((*env)->GetArrayLength(env, val) == 64);
24233 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24234 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
24237 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) {
24238 LDKThirtyTwoBytes channel_id_arg_ref;
24239 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
24240 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
24241 LDKSignature node_signature_arg_ref;
24242 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
24243 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
24244 LDKSignature bitcoin_signature_arg_ref;
24245 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
24246 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
24247 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
24248 uint64_t ret_ref = 0;
24249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24251 ret_ref = (uint64_t)ret_var.inner;
24252 if (ret_var.is_owned) {
24258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24259 LDKAnnouncementSignatures orig_conv;
24260 orig_conv.inner = (void*)(orig & (~1));
24261 orig_conv.is_owned = false;
24262 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
24263 uint64_t ret_ref = 0;
24264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24266 ret_ref = (uint64_t)ret_var.inner;
24267 if (ret_var.is_owned) {
24273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24274 if ((this_ptr & 1) != 0) return;
24275 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
24276 CHECK_ACCESS(this_ptr_ptr);
24277 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
24278 FREE((void*)this_ptr);
24279 NetAddress_free(this_ptr_conv);
24282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24283 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
24284 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24285 *ret_copy = NetAddress_clone(orig_conv);
24286 uint64_t ret_ref = (uint64_t)ret_copy;
24290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
24291 LDKFourBytes addr_ref;
24292 CHECK((*env)->GetArrayLength(env, addr) == 4);
24293 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
24294 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24295 *ret_copy = NetAddress_ipv4(addr_ref, port);
24296 uint64_t ret_ref = (uint64_t)ret_copy;
24300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
24301 LDKSixteenBytes addr_ref;
24302 CHECK((*env)->GetArrayLength(env, addr) == 16);
24303 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
24304 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24305 *ret_copy = NetAddress_ipv6(addr_ref, port);
24306 uint64_t ret_ref = (uint64_t)ret_copy;
24310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
24311 LDKTenBytes addr_ref;
24312 CHECK((*env)->GetArrayLength(env, addr) == 10);
24313 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
24314 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24315 *ret_copy = NetAddress_onion_v2(addr_ref, port);
24316 uint64_t ret_ref = (uint64_t)ret_copy;
24320 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) {
24321 LDKThirtyTwoBytes ed25519_pubkey_ref;
24322 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
24323 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
24324 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
24325 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
24326 uint64_t ret_ref = (uint64_t)ret_copy;
24330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
24331 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
24332 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
24333 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24334 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24335 CVec_u8Z_free(ret_var);
24339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24340 LDKu8slice ser_ref;
24341 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24342 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24343 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
24344 *ret_conv = NetAddress_read(ser_ref);
24345 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24346 return (uint64_t)ret_conv;
24349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24350 LDKUnsignedNodeAnnouncement this_obj_conv;
24351 this_obj_conv.inner = (void*)(this_obj & (~1));
24352 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24353 UnsignedNodeAnnouncement_free(this_obj_conv);
24356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24357 LDKUnsignedNodeAnnouncement this_ptr_conv;
24358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24359 this_ptr_conv.is_owned = false;
24360 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
24361 uint64_t ret_ref = 0;
24362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24364 ret_ref = (uint64_t)ret_var.inner;
24365 if (ret_var.is_owned) {
24371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24372 LDKUnsignedNodeAnnouncement this_ptr_conv;
24373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24374 this_ptr_conv.is_owned = false;
24375 LDKNodeFeatures val_conv;
24376 val_conv.inner = (void*)(val & (~1));
24377 val_conv.is_owned = (val & 1) || (val == 0);
24378 val_conv = NodeFeatures_clone(&val_conv);
24379 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
24382 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24383 LDKUnsignedNodeAnnouncement this_ptr_conv;
24384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24385 this_ptr_conv.is_owned = false;
24386 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
24390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24391 LDKUnsignedNodeAnnouncement this_ptr_conv;
24392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24393 this_ptr_conv.is_owned = false;
24394 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
24397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24398 LDKUnsignedNodeAnnouncement this_ptr_conv;
24399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24400 this_ptr_conv.is_owned = false;
24401 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24402 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
24406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24407 LDKUnsignedNodeAnnouncement this_ptr_conv;
24408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24409 this_ptr_conv.is_owned = false;
24410 LDKPublicKey val_ref;
24411 CHECK((*env)->GetArrayLength(env, val) == 33);
24412 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24413 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
24416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
24417 LDKUnsignedNodeAnnouncement this_ptr_conv;
24418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24419 this_ptr_conv.is_owned = false;
24420 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
24421 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
24425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24426 LDKUnsignedNodeAnnouncement this_ptr_conv;
24427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24428 this_ptr_conv.is_owned = false;
24429 LDKThreeBytes val_ref;
24430 CHECK((*env)->GetArrayLength(env, val) == 3);
24431 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
24432 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
24435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
24436 LDKUnsignedNodeAnnouncement this_ptr_conv;
24437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24438 this_ptr_conv.is_owned = false;
24439 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
24444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24445 LDKUnsignedNodeAnnouncement this_ptr_conv;
24446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24447 this_ptr_conv.is_owned = false;
24448 LDKThirtyTwoBytes val_ref;
24449 CHECK((*env)->GetArrayLength(env, val) == 32);
24450 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24451 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
24454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24455 LDKUnsignedNodeAnnouncement this_ptr_conv;
24456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24457 this_ptr_conv.is_owned = false;
24458 LDKCVec_NetAddressZ val_constr;
24459 val_constr.datalen = (*env)->GetArrayLength(env, val);
24460 if (val_constr.datalen > 0)
24461 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24463 val_constr.data = NULL;
24464 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24465 for (size_t m = 0; m < val_constr.datalen; m++) {
24466 int64_t val_conv_12 = val_vals[m];
24467 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
24468 CHECK_ACCESS(val_conv_12_ptr);
24469 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
24470 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24471 val_constr.data[m] = val_conv_12_conv;
24473 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24474 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
24477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24478 LDKUnsignedNodeAnnouncement orig_conv;
24479 orig_conv.inner = (void*)(orig & (~1));
24480 orig_conv.is_owned = false;
24481 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
24482 uint64_t ret_ref = 0;
24483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24485 ret_ref = (uint64_t)ret_var.inner;
24486 if (ret_var.is_owned) {
24492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24493 LDKNodeAnnouncement this_obj_conv;
24494 this_obj_conv.inner = (void*)(this_obj & (~1));
24495 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24496 NodeAnnouncement_free(this_obj_conv);
24499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
24500 LDKNodeAnnouncement this_ptr_conv;
24501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24502 this_ptr_conv.is_owned = false;
24503 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24504 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
24508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24509 LDKNodeAnnouncement this_ptr_conv;
24510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24511 this_ptr_conv.is_owned = false;
24512 LDKSignature val_ref;
24513 CHECK((*env)->GetArrayLength(env, val) == 64);
24514 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24515 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
24518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
24519 LDKNodeAnnouncement this_ptr_conv;
24520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24521 this_ptr_conv.is_owned = false;
24522 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
24523 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
24527 if (ret_var.is_owned) {
24533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24534 LDKNodeAnnouncement this_ptr_conv;
24535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24536 this_ptr_conv.is_owned = false;
24537 LDKUnsignedNodeAnnouncement val_conv;
24538 val_conv.inner = (void*)(val & (~1));
24539 val_conv.is_owned = (val & 1) || (val == 0);
24540 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
24541 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
24544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
24545 LDKSignature signature_arg_ref;
24546 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
24547 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
24548 LDKUnsignedNodeAnnouncement contents_arg_conv;
24549 contents_arg_conv.inner = (void*)(contents_arg & (~1));
24550 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
24551 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
24552 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
24553 uint64_t ret_ref = 0;
24554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24556 ret_ref = (uint64_t)ret_var.inner;
24557 if (ret_var.is_owned) {
24563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24564 LDKNodeAnnouncement orig_conv;
24565 orig_conv.inner = (void*)(orig & (~1));
24566 orig_conv.is_owned = false;
24567 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
24568 uint64_t ret_ref = 0;
24569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24571 ret_ref = (uint64_t)ret_var.inner;
24572 if (ret_var.is_owned) {
24578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24579 LDKUnsignedChannelAnnouncement this_obj_conv;
24580 this_obj_conv.inner = (void*)(this_obj & (~1));
24581 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24582 UnsignedChannelAnnouncement_free(this_obj_conv);
24585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24586 LDKUnsignedChannelAnnouncement this_ptr_conv;
24587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24588 this_ptr_conv.is_owned = false;
24589 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
24590 uint64_t ret_ref = 0;
24591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24593 ret_ref = (uint64_t)ret_var.inner;
24594 if (ret_var.is_owned) {
24600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24601 LDKUnsignedChannelAnnouncement this_ptr_conv;
24602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24603 this_ptr_conv.is_owned = false;
24604 LDKChannelFeatures val_conv;
24605 val_conv.inner = (void*)(val & (~1));
24606 val_conv.is_owned = (val & 1) || (val == 0);
24607 val_conv = ChannelFeatures_clone(&val_conv);
24608 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
24611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24612 LDKUnsignedChannelAnnouncement this_ptr_conv;
24613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24614 this_ptr_conv.is_owned = false;
24615 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24616 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
24620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24621 LDKUnsignedChannelAnnouncement this_ptr_conv;
24622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24623 this_ptr_conv.is_owned = false;
24624 LDKThirtyTwoBytes val_ref;
24625 CHECK((*env)->GetArrayLength(env, val) == 32);
24626 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24627 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
24630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24631 LDKUnsignedChannelAnnouncement this_ptr_conv;
24632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24633 this_ptr_conv.is_owned = false;
24634 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
24638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24639 LDKUnsignedChannelAnnouncement this_ptr_conv;
24640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24641 this_ptr_conv.is_owned = false;
24642 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
24645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
24646 LDKUnsignedChannelAnnouncement this_ptr_conv;
24647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24648 this_ptr_conv.is_owned = false;
24649 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24650 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
24654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24655 LDKUnsignedChannelAnnouncement this_ptr_conv;
24656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24657 this_ptr_conv.is_owned = false;
24658 LDKPublicKey val_ref;
24659 CHECK((*env)->GetArrayLength(env, val) == 33);
24660 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24661 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
24664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
24665 LDKUnsignedChannelAnnouncement this_ptr_conv;
24666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24667 this_ptr_conv.is_owned = false;
24668 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24669 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
24673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24674 LDKUnsignedChannelAnnouncement this_ptr_conv;
24675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24676 this_ptr_conv.is_owned = false;
24677 LDKPublicKey val_ref;
24678 CHECK((*env)->GetArrayLength(env, val) == 33);
24679 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24680 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
24683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
24684 LDKUnsignedChannelAnnouncement this_ptr_conv;
24685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24686 this_ptr_conv.is_owned = false;
24687 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24688 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
24692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24693 LDKUnsignedChannelAnnouncement this_ptr_conv;
24694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24695 this_ptr_conv.is_owned = false;
24696 LDKPublicKey val_ref;
24697 CHECK((*env)->GetArrayLength(env, val) == 33);
24698 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24699 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
24702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
24703 LDKUnsignedChannelAnnouncement this_ptr_conv;
24704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24705 this_ptr_conv.is_owned = false;
24706 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24707 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
24711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24712 LDKUnsignedChannelAnnouncement this_ptr_conv;
24713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24714 this_ptr_conv.is_owned = false;
24715 LDKPublicKey val_ref;
24716 CHECK((*env)->GetArrayLength(env, val) == 33);
24717 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24718 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
24721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24722 LDKUnsignedChannelAnnouncement orig_conv;
24723 orig_conv.inner = (void*)(orig & (~1));
24724 orig_conv.is_owned = false;
24725 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
24726 uint64_t ret_ref = 0;
24727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24729 ret_ref = (uint64_t)ret_var.inner;
24730 if (ret_var.is_owned) {
24736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24737 LDKChannelAnnouncement this_obj_conv;
24738 this_obj_conv.inner = (void*)(this_obj & (~1));
24739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24740 ChannelAnnouncement_free(this_obj_conv);
24743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
24744 LDKChannelAnnouncement this_ptr_conv;
24745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24746 this_ptr_conv.is_owned = false;
24747 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
24752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24753 LDKChannelAnnouncement this_ptr_conv;
24754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24755 this_ptr_conv.is_owned = false;
24756 LDKSignature val_ref;
24757 CHECK((*env)->GetArrayLength(env, val) == 64);
24758 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24759 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
24762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
24763 LDKChannelAnnouncement this_ptr_conv;
24764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24765 this_ptr_conv.is_owned = false;
24766 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24767 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
24771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24772 LDKChannelAnnouncement this_ptr_conv;
24773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24774 this_ptr_conv.is_owned = false;
24775 LDKSignature val_ref;
24776 CHECK((*env)->GetArrayLength(env, val) == 64);
24777 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24778 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
24781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
24782 LDKChannelAnnouncement this_ptr_conv;
24783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24784 this_ptr_conv.is_owned = false;
24785 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24786 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
24790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24791 LDKChannelAnnouncement this_ptr_conv;
24792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24793 this_ptr_conv.is_owned = false;
24794 LDKSignature val_ref;
24795 CHECK((*env)->GetArrayLength(env, val) == 64);
24796 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24797 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
24800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
24801 LDKChannelAnnouncement this_ptr_conv;
24802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24803 this_ptr_conv.is_owned = false;
24804 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
24805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
24809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24810 LDKChannelAnnouncement this_ptr_conv;
24811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24812 this_ptr_conv.is_owned = false;
24813 LDKSignature val_ref;
24814 CHECK((*env)->GetArrayLength(env, val) == 64);
24815 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
24816 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
24819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
24820 LDKChannelAnnouncement this_ptr_conv;
24821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24822 this_ptr_conv.is_owned = false;
24823 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
24824 uint64_t ret_ref = 0;
24825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24827 ret_ref = (uint64_t)ret_var.inner;
24828 if (ret_var.is_owned) {
24834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24835 LDKChannelAnnouncement this_ptr_conv;
24836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24837 this_ptr_conv.is_owned = false;
24838 LDKUnsignedChannelAnnouncement val_conv;
24839 val_conv.inner = (void*)(val & (~1));
24840 val_conv.is_owned = (val & 1) || (val == 0);
24841 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
24842 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
24845 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) {
24846 LDKSignature node_signature_1_arg_ref;
24847 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
24848 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
24849 LDKSignature node_signature_2_arg_ref;
24850 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
24851 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
24852 LDKSignature bitcoin_signature_1_arg_ref;
24853 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
24854 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
24855 LDKSignature bitcoin_signature_2_arg_ref;
24856 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
24857 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
24858 LDKUnsignedChannelAnnouncement contents_arg_conv;
24859 contents_arg_conv.inner = (void*)(contents_arg & (~1));
24860 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
24861 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
24862 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);
24863 uint64_t ret_ref = 0;
24864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24866 ret_ref = (uint64_t)ret_var.inner;
24867 if (ret_var.is_owned) {
24873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24874 LDKChannelAnnouncement orig_conv;
24875 orig_conv.inner = (void*)(orig & (~1));
24876 orig_conv.is_owned = false;
24877 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
24878 uint64_t ret_ref = 0;
24879 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24880 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24881 ret_ref = (uint64_t)ret_var.inner;
24882 if (ret_var.is_owned) {
24888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24889 LDKUnsignedChannelUpdate this_obj_conv;
24890 this_obj_conv.inner = (void*)(this_obj & (~1));
24891 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24892 UnsignedChannelUpdate_free(this_obj_conv);
24895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24896 LDKUnsignedChannelUpdate this_ptr_conv;
24897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24898 this_ptr_conv.is_owned = false;
24899 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24900 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
24904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24905 LDKUnsignedChannelUpdate this_ptr_conv;
24906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24907 this_ptr_conv.is_owned = false;
24908 LDKThirtyTwoBytes val_ref;
24909 CHECK((*env)->GetArrayLength(env, val) == 32);
24910 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24911 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
24914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24915 LDKUnsignedChannelUpdate this_ptr_conv;
24916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24917 this_ptr_conv.is_owned = false;
24918 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
24922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24923 LDKUnsignedChannelUpdate this_ptr_conv;
24924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24925 this_ptr_conv.is_owned = false;
24926 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
24929 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24930 LDKUnsignedChannelUpdate this_ptr_conv;
24931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24932 this_ptr_conv.is_owned = false;
24933 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
24937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24938 LDKUnsignedChannelUpdate this_ptr_conv;
24939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24940 this_ptr_conv.is_owned = false;
24941 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
24944 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
24945 LDKUnsignedChannelUpdate this_ptr_conv;
24946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24947 this_ptr_conv.is_owned = false;
24948 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
24952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
24953 LDKUnsignedChannelUpdate this_ptr_conv;
24954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24955 this_ptr_conv.is_owned = false;
24956 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
24959 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24960 LDKUnsignedChannelUpdate this_ptr_conv;
24961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24962 this_ptr_conv.is_owned = false;
24963 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
24967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24968 LDKUnsignedChannelUpdate this_ptr_conv;
24969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24970 this_ptr_conv.is_owned = false;
24971 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
24974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24975 LDKUnsignedChannelUpdate this_ptr_conv;
24976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24977 this_ptr_conv.is_owned = false;
24978 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
24982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24983 LDKUnsignedChannelUpdate this_ptr_conv;
24984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24985 this_ptr_conv.is_owned = false;
24986 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
24989 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24990 LDKUnsignedChannelUpdate this_ptr_conv;
24991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24992 this_ptr_conv.is_owned = false;
24993 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
24997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24998 LDKUnsignedChannelUpdate this_ptr_conv;
24999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25000 this_ptr_conv.is_owned = false;
25001 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
25004 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25005 LDKUnsignedChannelUpdate this_ptr_conv;
25006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25007 this_ptr_conv.is_owned = false;
25008 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
25012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25013 LDKUnsignedChannelUpdate this_ptr_conv;
25014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25015 this_ptr_conv.is_owned = false;
25016 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
25019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25020 LDKUnsignedChannelUpdate orig_conv;
25021 orig_conv.inner = (void*)(orig & (~1));
25022 orig_conv.is_owned = false;
25023 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
25024 uint64_t ret_ref = 0;
25025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25027 ret_ref = (uint64_t)ret_var.inner;
25028 if (ret_var.is_owned) {
25034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25035 LDKChannelUpdate this_obj_conv;
25036 this_obj_conv.inner = (void*)(this_obj & (~1));
25037 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25038 ChannelUpdate_free(this_obj_conv);
25041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
25042 LDKChannelUpdate this_ptr_conv;
25043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25044 this_ptr_conv.is_owned = false;
25045 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
25050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25051 LDKChannelUpdate this_ptr_conv;
25052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25053 this_ptr_conv.is_owned = false;
25054 LDKSignature val_ref;
25055 CHECK((*env)->GetArrayLength(env, val) == 64);
25056 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
25057 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
25060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
25061 LDKChannelUpdate this_ptr_conv;
25062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25063 this_ptr_conv.is_owned = false;
25064 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
25065 uint64_t ret_ref = 0;
25066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25068 ret_ref = (uint64_t)ret_var.inner;
25069 if (ret_var.is_owned) {
25075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25076 LDKChannelUpdate this_ptr_conv;
25077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25078 this_ptr_conv.is_owned = false;
25079 LDKUnsignedChannelUpdate val_conv;
25080 val_conv.inner = (void*)(val & (~1));
25081 val_conv.is_owned = (val & 1) || (val == 0);
25082 val_conv = UnsignedChannelUpdate_clone(&val_conv);
25083 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
25086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
25087 LDKSignature signature_arg_ref;
25088 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
25089 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
25090 LDKUnsignedChannelUpdate contents_arg_conv;
25091 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25092 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25093 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
25094 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
25095 uint64_t ret_ref = 0;
25096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25098 ret_ref = (uint64_t)ret_var.inner;
25099 if (ret_var.is_owned) {
25105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25106 LDKChannelUpdate orig_conv;
25107 orig_conv.inner = (void*)(orig & (~1));
25108 orig_conv.is_owned = false;
25109 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
25110 uint64_t ret_ref = 0;
25111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25113 ret_ref = (uint64_t)ret_var.inner;
25114 if (ret_var.is_owned) {
25120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25121 LDKQueryChannelRange this_obj_conv;
25122 this_obj_conv.inner = (void*)(this_obj & (~1));
25123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25124 QueryChannelRange_free(this_obj_conv);
25127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25128 LDKQueryChannelRange this_ptr_conv;
25129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25130 this_ptr_conv.is_owned = false;
25131 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25132 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
25136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25137 LDKQueryChannelRange this_ptr_conv;
25138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25139 this_ptr_conv.is_owned = false;
25140 LDKThirtyTwoBytes val_ref;
25141 CHECK((*env)->GetArrayLength(env, val) == 32);
25142 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25143 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
25146 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
25147 LDKQueryChannelRange this_ptr_conv;
25148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25149 this_ptr_conv.is_owned = false;
25150 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
25154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25155 LDKQueryChannelRange this_ptr_conv;
25156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25157 this_ptr_conv.is_owned = false;
25158 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
25161 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
25162 LDKQueryChannelRange this_ptr_conv;
25163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25164 this_ptr_conv.is_owned = false;
25165 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
25169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25170 LDKQueryChannelRange this_ptr_conv;
25171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25172 this_ptr_conv.is_owned = false;
25173 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
25176 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) {
25177 LDKThirtyTwoBytes chain_hash_arg_ref;
25178 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
25179 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
25180 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
25181 uint64_t ret_ref = 0;
25182 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25183 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25184 ret_ref = (uint64_t)ret_var.inner;
25185 if (ret_var.is_owned) {
25191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25192 LDKQueryChannelRange orig_conv;
25193 orig_conv.inner = (void*)(orig & (~1));
25194 orig_conv.is_owned = false;
25195 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
25196 uint64_t ret_ref = 0;
25197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25199 ret_ref = (uint64_t)ret_var.inner;
25200 if (ret_var.is_owned) {
25206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25207 LDKReplyChannelRange this_obj_conv;
25208 this_obj_conv.inner = (void*)(this_obj & (~1));
25209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25210 ReplyChannelRange_free(this_obj_conv);
25213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25214 LDKReplyChannelRange this_ptr_conv;
25215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25216 this_ptr_conv.is_owned = false;
25217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
25222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25223 LDKReplyChannelRange this_ptr_conv;
25224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25225 this_ptr_conv.is_owned = false;
25226 LDKThirtyTwoBytes val_ref;
25227 CHECK((*env)->GetArrayLength(env, val) == 32);
25228 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25229 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
25232 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
25233 LDKReplyChannelRange this_ptr_conv;
25234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25235 this_ptr_conv.is_owned = false;
25236 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
25240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25241 LDKReplyChannelRange this_ptr_conv;
25242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25243 this_ptr_conv.is_owned = false;
25244 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
25247 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
25248 LDKReplyChannelRange this_ptr_conv;
25249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25250 this_ptr_conv.is_owned = false;
25251 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
25255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25256 LDKReplyChannelRange this_ptr_conv;
25257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25258 this_ptr_conv.is_owned = false;
25259 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
25262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
25263 LDKReplyChannelRange this_ptr_conv;
25264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25265 this_ptr_conv.is_owned = false;
25266 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
25270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25271 LDKReplyChannelRange this_ptr_conv;
25272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25273 this_ptr_conv.is_owned = false;
25274 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
25277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25278 LDKReplyChannelRange this_ptr_conv;
25279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25280 this_ptr_conv.is_owned = false;
25281 LDKCVec_u64Z val_constr;
25282 val_constr.datalen = (*env)->GetArrayLength(env, val);
25283 if (val_constr.datalen > 0)
25284 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25286 val_constr.data = NULL;
25287 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25288 for (size_t g = 0; g < val_constr.datalen; g++) {
25289 int64_t val_conv_6 = val_vals[g];
25290 val_constr.data[g] = val_conv_6;
25292 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25293 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
25296 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) {
25297 LDKThirtyTwoBytes chain_hash_arg_ref;
25298 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
25299 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
25300 LDKCVec_u64Z short_channel_ids_arg_constr;
25301 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
25302 if (short_channel_ids_arg_constr.datalen > 0)
25303 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25305 short_channel_ids_arg_constr.data = NULL;
25306 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
25307 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
25308 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
25309 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
25311 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
25312 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
25313 uint64_t ret_ref = 0;
25314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25316 ret_ref = (uint64_t)ret_var.inner;
25317 if (ret_var.is_owned) {
25323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25324 LDKReplyChannelRange orig_conv;
25325 orig_conv.inner = (void*)(orig & (~1));
25326 orig_conv.is_owned = false;
25327 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
25328 uint64_t ret_ref = 0;
25329 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25330 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25331 ret_ref = (uint64_t)ret_var.inner;
25332 if (ret_var.is_owned) {
25338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25339 LDKQueryShortChannelIds this_obj_conv;
25340 this_obj_conv.inner = (void*)(this_obj & (~1));
25341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25342 QueryShortChannelIds_free(this_obj_conv);
25345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25346 LDKQueryShortChannelIds this_ptr_conv;
25347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25348 this_ptr_conv.is_owned = false;
25349 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
25354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25355 LDKQueryShortChannelIds this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 LDKThirtyTwoBytes val_ref;
25359 CHECK((*env)->GetArrayLength(env, val) == 32);
25360 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25361 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
25364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25365 LDKQueryShortChannelIds this_ptr_conv;
25366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25367 this_ptr_conv.is_owned = false;
25368 LDKCVec_u64Z val_constr;
25369 val_constr.datalen = (*env)->GetArrayLength(env, val);
25370 if (val_constr.datalen > 0)
25371 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25373 val_constr.data = NULL;
25374 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25375 for (size_t g = 0; g < val_constr.datalen; g++) {
25376 int64_t val_conv_6 = val_vals[g];
25377 val_constr.data[g] = val_conv_6;
25379 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25380 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
25383 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) {
25384 LDKThirtyTwoBytes chain_hash_arg_ref;
25385 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
25386 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
25387 LDKCVec_u64Z short_channel_ids_arg_constr;
25388 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
25389 if (short_channel_ids_arg_constr.datalen > 0)
25390 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25392 short_channel_ids_arg_constr.data = NULL;
25393 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
25394 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
25395 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
25396 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
25398 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
25399 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
25400 uint64_t ret_ref = 0;
25401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25403 ret_ref = (uint64_t)ret_var.inner;
25404 if (ret_var.is_owned) {
25410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25411 LDKQueryShortChannelIds orig_conv;
25412 orig_conv.inner = (void*)(orig & (~1));
25413 orig_conv.is_owned = false;
25414 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
25415 uint64_t ret_ref = 0;
25416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25418 ret_ref = (uint64_t)ret_var.inner;
25419 if (ret_var.is_owned) {
25425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25426 LDKReplyShortChannelIdsEnd this_obj_conv;
25427 this_obj_conv.inner = (void*)(this_obj & (~1));
25428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25429 ReplyShortChannelIdsEnd_free(this_obj_conv);
25432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25433 LDKReplyShortChannelIdsEnd this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25437 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
25441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25442 LDKReplyShortChannelIdsEnd this_ptr_conv;
25443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25444 this_ptr_conv.is_owned = false;
25445 LDKThirtyTwoBytes val_ref;
25446 CHECK((*env)->GetArrayLength(env, val) == 32);
25447 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25448 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
25451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
25452 LDKReplyShortChannelIdsEnd this_ptr_conv;
25453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25454 this_ptr_conv.is_owned = false;
25455 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
25459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25460 LDKReplyShortChannelIdsEnd this_ptr_conv;
25461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25462 this_ptr_conv.is_owned = false;
25463 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
25466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
25467 LDKThirtyTwoBytes chain_hash_arg_ref;
25468 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
25469 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
25470 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
25471 uint64_t ret_ref = 0;
25472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25474 ret_ref = (uint64_t)ret_var.inner;
25475 if (ret_var.is_owned) {
25481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25482 LDKReplyShortChannelIdsEnd orig_conv;
25483 orig_conv.inner = (void*)(orig & (~1));
25484 orig_conv.is_owned = false;
25485 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
25486 uint64_t ret_ref = 0;
25487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25489 ret_ref = (uint64_t)ret_var.inner;
25490 if (ret_var.is_owned) {
25496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25497 LDKGossipTimestampFilter this_obj_conv;
25498 this_obj_conv.inner = (void*)(this_obj & (~1));
25499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25500 GossipTimestampFilter_free(this_obj_conv);
25503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25504 LDKGossipTimestampFilter this_ptr_conv;
25505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25506 this_ptr_conv.is_owned = false;
25507 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25508 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
25512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25513 LDKGossipTimestampFilter this_ptr_conv;
25514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25515 this_ptr_conv.is_owned = false;
25516 LDKThirtyTwoBytes val_ref;
25517 CHECK((*env)->GetArrayLength(env, val) == 32);
25518 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25519 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
25522 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
25523 LDKGossipTimestampFilter this_ptr_conv;
25524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25525 this_ptr_conv.is_owned = false;
25526 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
25530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25531 LDKGossipTimestampFilter this_ptr_conv;
25532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25533 this_ptr_conv.is_owned = false;
25534 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
25537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
25538 LDKGossipTimestampFilter this_ptr_conv;
25539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25540 this_ptr_conv.is_owned = false;
25541 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
25545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25546 LDKGossipTimestampFilter this_ptr_conv;
25547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25548 this_ptr_conv.is_owned = false;
25549 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
25552 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) {
25553 LDKThirtyTwoBytes chain_hash_arg_ref;
25554 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
25555 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
25556 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
25557 uint64_t ret_ref = 0;
25558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25560 ret_ref = (uint64_t)ret_var.inner;
25561 if (ret_var.is_owned) {
25567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25568 LDKGossipTimestampFilter orig_conv;
25569 orig_conv.inner = (void*)(orig & (~1));
25570 orig_conv.is_owned = false;
25571 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
25572 uint64_t ret_ref = 0;
25573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25575 ret_ref = (uint64_t)ret_var.inner;
25576 if (ret_var.is_owned) {
25582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25583 if ((this_ptr & 1) != 0) return;
25584 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25585 CHECK_ACCESS(this_ptr_ptr);
25586 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
25587 FREE((void*)this_ptr);
25588 ErrorAction_free(this_ptr_conv);
25591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25592 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
25593 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25594 *ret_copy = ErrorAction_clone(orig_conv);
25595 uint64_t ret_ref = (uint64_t)ret_copy;
25599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
25600 LDKErrorMessage msg_conv;
25601 msg_conv.inner = (void*)(msg & (~1));
25602 msg_conv.is_owned = (msg & 1) || (msg == 0);
25603 msg_conv = ErrorMessage_clone(&msg_conv);
25604 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25605 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
25606 uint64_t ret_ref = (uint64_t)ret_copy;
25610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
25611 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25612 *ret_copy = ErrorAction_ignore_error();
25613 uint64_t ret_ref = (uint64_t)ret_copy;
25617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
25618 LDKLevel a_conv = LDKLevel_from_java(env, a);
25619 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25620 *ret_copy = ErrorAction_ignore_and_log(a_conv);
25621 uint64_t ret_ref = (uint64_t)ret_copy;
25625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
25626 LDKErrorMessage msg_conv;
25627 msg_conv.inner = (void*)(msg & (~1));
25628 msg_conv.is_owned = (msg & 1) || (msg == 0);
25629 msg_conv = ErrorMessage_clone(&msg_conv);
25630 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25631 *ret_copy = ErrorAction_send_error_message(msg_conv);
25632 uint64_t ret_ref = (uint64_t)ret_copy;
25636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25637 LDKLightningError this_obj_conv;
25638 this_obj_conv.inner = (void*)(this_obj & (~1));
25639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25640 LightningError_free(this_obj_conv);
25643 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
25644 LDKLightningError this_ptr_conv;
25645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25646 this_ptr_conv.is_owned = false;
25647 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
25648 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
25654 LDKLightningError this_ptr_conv;
25655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25656 this_ptr_conv.is_owned = false;
25657 LDKStr val_conv = java_to_owned_str(env, val);
25658 LightningError_set_err(&this_ptr_conv, val_conv);
25661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
25662 LDKLightningError this_ptr_conv;
25663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25664 this_ptr_conv.is_owned = false;
25665 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
25666 *ret_copy = LightningError_get_action(&this_ptr_conv);
25667 uint64_t ret_ref = (uint64_t)ret_copy;
25671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25672 LDKLightningError this_ptr_conv;
25673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25674 this_ptr_conv.is_owned = false;
25675 void* val_ptr = (void*)(((uint64_t)val) & ~1);
25676 CHECK_ACCESS(val_ptr);
25677 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
25678 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
25679 LightningError_set_action(&this_ptr_conv, val_conv);
25682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
25683 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
25684 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
25685 CHECK_ACCESS(action_arg_ptr);
25686 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
25687 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
25688 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
25689 uint64_t ret_ref = 0;
25690 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25691 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25692 ret_ref = (uint64_t)ret_var.inner;
25693 if (ret_var.is_owned) {
25699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25700 LDKLightningError orig_conv;
25701 orig_conv.inner = (void*)(orig & (~1));
25702 orig_conv.is_owned = false;
25703 LDKLightningError ret_var = LightningError_clone(&orig_conv);
25704 uint64_t ret_ref = 0;
25705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25707 ret_ref = (uint64_t)ret_var.inner;
25708 if (ret_var.is_owned) {
25714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25715 LDKCommitmentUpdate this_obj_conv;
25716 this_obj_conv.inner = (void*)(this_obj & (~1));
25717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25718 CommitmentUpdate_free(this_obj_conv);
25721 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25722 LDKCommitmentUpdate this_ptr_conv;
25723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25724 this_ptr_conv.is_owned = false;
25725 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
25726 int64_tArray ret_arr = NULL;
25727 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25728 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25729 for (size_t p = 0; p < ret_var.datalen; p++) {
25730 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
25731 uint64_t ret_conv_15_ref = 0;
25732 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25733 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25734 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
25735 if (ret_conv_15_var.is_owned) {
25736 ret_conv_15_ref |= 1;
25738 ret_arr_ptr[p] = ret_conv_15_ref;
25740 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25741 FREE(ret_var.data);
25745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25746 LDKCommitmentUpdate this_ptr_conv;
25747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25748 this_ptr_conv.is_owned = false;
25749 LDKCVec_UpdateAddHTLCZ val_constr;
25750 val_constr.datalen = (*env)->GetArrayLength(env, val);
25751 if (val_constr.datalen > 0)
25752 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25754 val_constr.data = NULL;
25755 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25756 for (size_t p = 0; p < val_constr.datalen; p++) {
25757 int64_t val_conv_15 = val_vals[p];
25758 LDKUpdateAddHTLC val_conv_15_conv;
25759 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
25760 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
25761 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
25762 val_constr.data[p] = val_conv_15_conv;
25764 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25765 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
25768 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25769 LDKCommitmentUpdate this_ptr_conv;
25770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25771 this_ptr_conv.is_owned = false;
25772 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
25773 int64_tArray ret_arr = NULL;
25774 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25775 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25776 for (size_t t = 0; t < ret_var.datalen; t++) {
25777 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
25778 uint64_t ret_conv_19_ref = 0;
25779 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25780 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25781 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
25782 if (ret_conv_19_var.is_owned) {
25783 ret_conv_19_ref |= 1;
25785 ret_arr_ptr[t] = ret_conv_19_ref;
25787 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25788 FREE(ret_var.data);
25792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25793 LDKCommitmentUpdate this_ptr_conv;
25794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25795 this_ptr_conv.is_owned = false;
25796 LDKCVec_UpdateFulfillHTLCZ val_constr;
25797 val_constr.datalen = (*env)->GetArrayLength(env, val);
25798 if (val_constr.datalen > 0)
25799 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25801 val_constr.data = NULL;
25802 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25803 for (size_t t = 0; t < val_constr.datalen; t++) {
25804 int64_t val_conv_19 = val_vals[t];
25805 LDKUpdateFulfillHTLC val_conv_19_conv;
25806 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
25807 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
25808 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
25809 val_constr.data[t] = val_conv_19_conv;
25811 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25812 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
25815 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25816 LDKCommitmentUpdate this_ptr_conv;
25817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25818 this_ptr_conv.is_owned = false;
25819 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
25820 int64_tArray ret_arr = NULL;
25821 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25822 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25823 for (size_t q = 0; q < ret_var.datalen; q++) {
25824 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
25825 uint64_t ret_conv_16_ref = 0;
25826 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25827 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25828 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
25829 if (ret_conv_16_var.is_owned) {
25830 ret_conv_16_ref |= 1;
25832 ret_arr_ptr[q] = ret_conv_16_ref;
25834 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25835 FREE(ret_var.data);
25839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25840 LDKCommitmentUpdate this_ptr_conv;
25841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25842 this_ptr_conv.is_owned = false;
25843 LDKCVec_UpdateFailHTLCZ val_constr;
25844 val_constr.datalen = (*env)->GetArrayLength(env, val);
25845 if (val_constr.datalen > 0)
25846 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
25848 val_constr.data = NULL;
25849 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25850 for (size_t q = 0; q < val_constr.datalen; q++) {
25851 int64_t val_conv_16 = val_vals[q];
25852 LDKUpdateFailHTLC val_conv_16_conv;
25853 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
25854 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
25855 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
25856 val_constr.data[q] = val_conv_16_conv;
25858 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25859 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
25862 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
25863 LDKCommitmentUpdate this_ptr_conv;
25864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25865 this_ptr_conv.is_owned = false;
25866 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
25867 int64_tArray ret_arr = NULL;
25868 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25869 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25870 for (size_t z = 0; z < ret_var.datalen; z++) {
25871 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
25872 uint64_t ret_conv_25_ref = 0;
25873 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25874 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25875 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
25876 if (ret_conv_25_var.is_owned) {
25877 ret_conv_25_ref |= 1;
25879 ret_arr_ptr[z] = ret_conv_25_ref;
25881 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25882 FREE(ret_var.data);
25886 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) {
25887 LDKCommitmentUpdate this_ptr_conv;
25888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25889 this_ptr_conv.is_owned = false;
25890 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
25891 val_constr.datalen = (*env)->GetArrayLength(env, val);
25892 if (val_constr.datalen > 0)
25893 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
25895 val_constr.data = NULL;
25896 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25897 for (size_t z = 0; z < val_constr.datalen; z++) {
25898 int64_t val_conv_25 = val_vals[z];
25899 LDKUpdateFailMalformedHTLC val_conv_25_conv;
25900 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
25901 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
25902 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
25903 val_constr.data[z] = val_conv_25_conv;
25905 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25906 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
25909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
25910 LDKCommitmentUpdate this_ptr_conv;
25911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25912 this_ptr_conv.is_owned = false;
25913 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
25914 uint64_t ret_ref = 0;
25915 if ((uint64_t)ret_var.inner > 4096) {
25916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25918 ret_ref = (uint64_t)ret_var.inner;
25919 if (ret_var.is_owned) {
25926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25927 LDKCommitmentUpdate this_ptr_conv;
25928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25929 this_ptr_conv.is_owned = false;
25930 LDKUpdateFee val_conv;
25931 val_conv.inner = (void*)(val & (~1));
25932 val_conv.is_owned = (val & 1) || (val == 0);
25933 val_conv = UpdateFee_clone(&val_conv);
25934 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
25937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
25938 LDKCommitmentUpdate this_ptr_conv;
25939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25940 this_ptr_conv.is_owned = false;
25941 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
25942 uint64_t ret_ref = 0;
25943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25945 ret_ref = (uint64_t)ret_var.inner;
25946 if (ret_var.is_owned) {
25952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25953 LDKCommitmentUpdate this_ptr_conv;
25954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25955 this_ptr_conv.is_owned = false;
25956 LDKCommitmentSigned val_conv;
25957 val_conv.inner = (void*)(val & (~1));
25958 val_conv.is_owned = (val & 1) || (val == 0);
25959 val_conv = CommitmentSigned_clone(&val_conv);
25960 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
25963 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) {
25964 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
25965 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
25966 if (update_add_htlcs_arg_constr.datalen > 0)
25967 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25969 update_add_htlcs_arg_constr.data = NULL;
25970 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
25971 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
25972 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
25973 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
25974 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
25975 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
25976 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
25977 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
25979 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
25980 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
25981 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
25982 if (update_fulfill_htlcs_arg_constr.datalen > 0)
25983 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25985 update_fulfill_htlcs_arg_constr.data = NULL;
25986 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
25987 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
25988 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
25989 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
25990 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
25991 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
25992 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
25993 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
25995 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
25996 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
25997 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
25998 if (update_fail_htlcs_arg_constr.datalen > 0)
25999 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
26001 update_fail_htlcs_arg_constr.data = NULL;
26002 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
26003 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
26004 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
26005 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
26006 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
26007 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
26008 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
26009 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
26011 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
26012 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
26013 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
26014 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
26015 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
26017 update_fail_malformed_htlcs_arg_constr.data = NULL;
26018 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
26019 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
26020 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
26021 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
26022 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
26023 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);
26024 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
26025 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
26027 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
26028 LDKUpdateFee update_fee_arg_conv;
26029 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
26030 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
26031 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
26032 LDKCommitmentSigned commitment_signed_arg_conv;
26033 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
26034 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
26035 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
26036 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);
26037 uint64_t ret_ref = 0;
26038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26040 ret_ref = (uint64_t)ret_var.inner;
26041 if (ret_var.is_owned) {
26047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26048 LDKCommitmentUpdate orig_conv;
26049 orig_conv.inner = (void*)(orig & (~1));
26050 orig_conv.is_owned = false;
26051 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
26052 uint64_t ret_ref = 0;
26053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26055 ret_ref = (uint64_t)ret_var.inner;
26056 if (ret_var.is_owned) {
26062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26063 if ((this_ptr & 1) != 0) return;
26064 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26065 CHECK_ACCESS(this_ptr_ptr);
26066 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
26067 FREE((void*)this_ptr);
26068 ChannelMessageHandler_free(this_ptr_conv);
26071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26072 if ((this_ptr & 1) != 0) return;
26073 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26074 CHECK_ACCESS(this_ptr_ptr);
26075 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
26076 FREE((void*)this_ptr);
26077 RoutingMessageHandler_free(this_ptr_conv);
26080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
26081 LDKAcceptChannel obj_conv;
26082 obj_conv.inner = (void*)(obj & (~1));
26083 obj_conv.is_owned = false;
26084 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
26085 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26086 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26087 CVec_u8Z_free(ret_var);
26091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26092 LDKu8slice ser_ref;
26093 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26094 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26095 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
26096 *ret_conv = AcceptChannel_read(ser_ref);
26097 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26098 return (uint64_t)ret_conv;
26101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26102 LDKAnnouncementSignatures obj_conv;
26103 obj_conv.inner = (void*)(obj & (~1));
26104 obj_conv.is_owned = false;
26105 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
26106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26108 CVec_u8Z_free(ret_var);
26112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26113 LDKu8slice ser_ref;
26114 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26115 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26116 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26117 *ret_conv = AnnouncementSignatures_read(ser_ref);
26118 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26119 return (uint64_t)ret_conv;
26122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
26123 LDKChannelReestablish obj_conv;
26124 obj_conv.inner = (void*)(obj & (~1));
26125 obj_conv.is_owned = false;
26126 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
26127 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26128 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26129 CVec_u8Z_free(ret_var);
26133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26134 LDKu8slice ser_ref;
26135 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26136 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26137 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26138 *ret_conv = ChannelReestablish_read(ser_ref);
26139 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26140 return (uint64_t)ret_conv;
26143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
26144 LDKClosingSigned obj_conv;
26145 obj_conv.inner = (void*)(obj & (~1));
26146 obj_conv.is_owned = false;
26147 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
26148 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26149 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26150 CVec_u8Z_free(ret_var);
26154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26155 LDKu8slice ser_ref;
26156 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26157 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26158 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26159 *ret_conv = ClosingSigned_read(ser_ref);
26160 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26161 return (uint64_t)ret_conv;
26164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
26165 LDKClosingSignedFeeRange obj_conv;
26166 obj_conv.inner = (void*)(obj & (~1));
26167 obj_conv.is_owned = false;
26168 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
26169 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26170 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26171 CVec_u8Z_free(ret_var);
26175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26176 LDKu8slice ser_ref;
26177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26179 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26180 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
26181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26182 return (uint64_t)ret_conv;
26185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
26186 LDKCommitmentSigned obj_conv;
26187 obj_conv.inner = (void*)(obj & (~1));
26188 obj_conv.is_owned = false;
26189 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
26190 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26191 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26192 CVec_u8Z_free(ret_var);
26196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26197 LDKu8slice ser_ref;
26198 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26199 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26200 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26201 *ret_conv = CommitmentSigned_read(ser_ref);
26202 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26203 return (uint64_t)ret_conv;
26206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
26207 LDKFundingCreated obj_conv;
26208 obj_conv.inner = (void*)(obj & (~1));
26209 obj_conv.is_owned = false;
26210 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
26211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26213 CVec_u8Z_free(ret_var);
26217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26218 LDKu8slice ser_ref;
26219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26221 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26222 *ret_conv = FundingCreated_read(ser_ref);
26223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26224 return (uint64_t)ret_conv;
26227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
26228 LDKFundingSigned obj_conv;
26229 obj_conv.inner = (void*)(obj & (~1));
26230 obj_conv.is_owned = false;
26231 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
26232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26234 CVec_u8Z_free(ret_var);
26238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26239 LDKu8slice ser_ref;
26240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26242 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26243 *ret_conv = FundingSigned_read(ser_ref);
26244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26245 return (uint64_t)ret_conv;
26248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
26249 LDKFundingLocked obj_conv;
26250 obj_conv.inner = (void*)(obj & (~1));
26251 obj_conv.is_owned = false;
26252 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
26253 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26254 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26255 CVec_u8Z_free(ret_var);
26259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26260 LDKu8slice ser_ref;
26261 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26262 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26263 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
26264 *ret_conv = FundingLocked_read(ser_ref);
26265 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26266 return (uint64_t)ret_conv;
26269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
26271 obj_conv.inner = (void*)(obj & (~1));
26272 obj_conv.is_owned = false;
26273 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
26274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26276 CVec_u8Z_free(ret_var);
26280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26281 LDKu8slice ser_ref;
26282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26284 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26285 *ret_conv = Init_read(ser_ref);
26286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26287 return (uint64_t)ret_conv;
26290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
26291 LDKOpenChannel obj_conv;
26292 obj_conv.inner = (void*)(obj & (~1));
26293 obj_conv.is_owned = false;
26294 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
26295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26297 CVec_u8Z_free(ret_var);
26301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26302 LDKu8slice ser_ref;
26303 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26304 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26305 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26306 *ret_conv = OpenChannel_read(ser_ref);
26307 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26308 return (uint64_t)ret_conv;
26311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
26312 LDKRevokeAndACK obj_conv;
26313 obj_conv.inner = (void*)(obj & (~1));
26314 obj_conv.is_owned = false;
26315 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
26316 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26317 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26318 CVec_u8Z_free(ret_var);
26322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26323 LDKu8slice ser_ref;
26324 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26325 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26326 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26327 *ret_conv = RevokeAndACK_read(ser_ref);
26328 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26329 return (uint64_t)ret_conv;
26332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
26333 LDKShutdown obj_conv;
26334 obj_conv.inner = (void*)(obj & (~1));
26335 obj_conv.is_owned = false;
26336 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
26337 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26338 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26339 CVec_u8Z_free(ret_var);
26343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26344 LDKu8slice ser_ref;
26345 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26346 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26347 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
26348 *ret_conv = Shutdown_read(ser_ref);
26349 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26350 return (uint64_t)ret_conv;
26353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
26354 LDKUpdateFailHTLC obj_conv;
26355 obj_conv.inner = (void*)(obj & (~1));
26356 obj_conv.is_owned = false;
26357 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
26358 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26359 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26360 CVec_u8Z_free(ret_var);
26364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26365 LDKu8slice ser_ref;
26366 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26367 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26368 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
26369 *ret_conv = UpdateFailHTLC_read(ser_ref);
26370 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26371 return (uint64_t)ret_conv;
26374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
26375 LDKUpdateFailMalformedHTLC obj_conv;
26376 obj_conv.inner = (void*)(obj & (~1));
26377 obj_conv.is_owned = false;
26378 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
26379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26381 CVec_u8Z_free(ret_var);
26385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26386 LDKu8slice ser_ref;
26387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26389 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
26390 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
26391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26392 return (uint64_t)ret_conv;
26395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
26396 LDKUpdateFee obj_conv;
26397 obj_conv.inner = (void*)(obj & (~1));
26398 obj_conv.is_owned = false;
26399 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
26400 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26401 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26402 CVec_u8Z_free(ret_var);
26406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26407 LDKu8slice ser_ref;
26408 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26409 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26410 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
26411 *ret_conv = UpdateFee_read(ser_ref);
26412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26413 return (uint64_t)ret_conv;
26416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
26417 LDKUpdateFulfillHTLC obj_conv;
26418 obj_conv.inner = (void*)(obj & (~1));
26419 obj_conv.is_owned = false;
26420 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
26421 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26422 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26423 CVec_u8Z_free(ret_var);
26427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26428 LDKu8slice ser_ref;
26429 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26430 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26431 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
26432 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
26433 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26434 return (uint64_t)ret_conv;
26437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
26438 LDKUpdateAddHTLC obj_conv;
26439 obj_conv.inner = (void*)(obj & (~1));
26440 obj_conv.is_owned = false;
26441 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
26442 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26443 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26444 CVec_u8Z_free(ret_var);
26448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26449 LDKu8slice ser_ref;
26450 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26451 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26452 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
26453 *ret_conv = UpdateAddHTLC_read(ser_ref);
26454 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26455 return (uint64_t)ret_conv;
26458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
26460 obj_conv.inner = (void*)(obj & (~1));
26461 obj_conv.is_owned = false;
26462 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
26463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26465 CVec_u8Z_free(ret_var);
26469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26470 LDKu8slice ser_ref;
26471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26473 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
26474 *ret_conv = Ping_read(ser_ref);
26475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26476 return (uint64_t)ret_conv;
26479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
26481 obj_conv.inner = (void*)(obj & (~1));
26482 obj_conv.is_owned = false;
26483 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
26484 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26485 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26486 CVec_u8Z_free(ret_var);
26490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26491 LDKu8slice ser_ref;
26492 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26493 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26494 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
26495 *ret_conv = Pong_read(ser_ref);
26496 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26497 return (uint64_t)ret_conv;
26500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
26501 LDKUnsignedChannelAnnouncement obj_conv;
26502 obj_conv.inner = (void*)(obj & (~1));
26503 obj_conv.is_owned = false;
26504 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
26505 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26506 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26507 CVec_u8Z_free(ret_var);
26511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26512 LDKu8slice ser_ref;
26513 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26514 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26515 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
26516 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
26517 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26518 return (uint64_t)ret_conv;
26521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
26522 LDKChannelAnnouncement obj_conv;
26523 obj_conv.inner = (void*)(obj & (~1));
26524 obj_conv.is_owned = false;
26525 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
26526 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26527 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26528 CVec_u8Z_free(ret_var);
26532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26533 LDKu8slice ser_ref;
26534 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26535 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26536 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
26537 *ret_conv = ChannelAnnouncement_read(ser_ref);
26538 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26539 return (uint64_t)ret_conv;
26542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26543 LDKUnsignedChannelUpdate obj_conv;
26544 obj_conv.inner = (void*)(obj & (~1));
26545 obj_conv.is_owned = false;
26546 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
26547 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26548 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26549 CVec_u8Z_free(ret_var);
26553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26554 LDKu8slice ser_ref;
26555 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26556 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26557 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
26558 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
26559 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26560 return (uint64_t)ret_conv;
26563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26564 LDKChannelUpdate obj_conv;
26565 obj_conv.inner = (void*)(obj & (~1));
26566 obj_conv.is_owned = false;
26567 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
26568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26570 CVec_u8Z_free(ret_var);
26574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26575 LDKu8slice ser_ref;
26576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26578 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
26579 *ret_conv = ChannelUpdate_read(ser_ref);
26580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26581 return (uint64_t)ret_conv;
26584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
26585 LDKErrorMessage obj_conv;
26586 obj_conv.inner = (void*)(obj & (~1));
26587 obj_conv.is_owned = false;
26588 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
26589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26591 CVec_u8Z_free(ret_var);
26595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26596 LDKu8slice ser_ref;
26597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26599 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
26600 *ret_conv = ErrorMessage_read(ser_ref);
26601 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26602 return (uint64_t)ret_conv;
26605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
26606 LDKUnsignedNodeAnnouncement obj_conv;
26607 obj_conv.inner = (void*)(obj & (~1));
26608 obj_conv.is_owned = false;
26609 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
26610 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26611 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26612 CVec_u8Z_free(ret_var);
26616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26617 LDKu8slice ser_ref;
26618 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26619 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26620 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26621 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
26622 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26623 return (uint64_t)ret_conv;
26626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
26627 LDKNodeAnnouncement obj_conv;
26628 obj_conv.inner = (void*)(obj & (~1));
26629 obj_conv.is_owned = false;
26630 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
26631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26633 CVec_u8Z_free(ret_var);
26637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26638 LDKu8slice ser_ref;
26639 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26640 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26641 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26642 *ret_conv = NodeAnnouncement_read(ser_ref);
26643 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26644 return (uint64_t)ret_conv;
26647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26648 LDKu8slice ser_ref;
26649 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26650 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26651 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26652 *ret_conv = QueryShortChannelIds_read(ser_ref);
26653 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26654 return (uint64_t)ret_conv;
26657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
26658 LDKQueryShortChannelIds obj_conv;
26659 obj_conv.inner = (void*)(obj & (~1));
26660 obj_conv.is_owned = false;
26661 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
26662 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26663 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26664 CVec_u8Z_free(ret_var);
26668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
26669 LDKReplyShortChannelIdsEnd obj_conv;
26670 obj_conv.inner = (void*)(obj & (~1));
26671 obj_conv.is_owned = false;
26672 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_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_ReplyShortChannelIdsEnd_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_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26684 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
26685 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26686 return (uint64_t)ret_conv;
26689 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
26690 LDKQueryChannelRange this_arg_conv;
26691 this_arg_conv.inner = (void*)(this_arg & (~1));
26692 this_arg_conv.is_owned = false;
26693 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
26697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
26698 LDKQueryChannelRange obj_conv;
26699 obj_conv.inner = (void*)(obj & (~1));
26700 obj_conv.is_owned = false;
26701 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
26702 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26703 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26704 CVec_u8Z_free(ret_var);
26708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26709 LDKu8slice ser_ref;
26710 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26711 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26712 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26713 *ret_conv = QueryChannelRange_read(ser_ref);
26714 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26715 return (uint64_t)ret_conv;
26718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26719 LDKu8slice ser_ref;
26720 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26721 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26722 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26723 *ret_conv = ReplyChannelRange_read(ser_ref);
26724 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26725 return (uint64_t)ret_conv;
26728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
26729 LDKReplyChannelRange obj_conv;
26730 obj_conv.inner = (void*)(obj & (~1));
26731 obj_conv.is_owned = false;
26732 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
26733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26735 CVec_u8Z_free(ret_var);
26739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
26740 LDKGossipTimestampFilter obj_conv;
26741 obj_conv.inner = (void*)(obj & (~1));
26742 obj_conv.is_owned = false;
26743 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
26744 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26745 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26746 CVec_u8Z_free(ret_var);
26750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26751 LDKu8slice ser_ref;
26752 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26753 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26754 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26755 *ret_conv = GossipTimestampFilter_read(ser_ref);
26756 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26757 return (uint64_t)ret_conv;
26760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26761 if ((this_ptr & 1) != 0) return;
26762 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26763 CHECK_ACCESS(this_ptr_ptr);
26764 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
26765 FREE((void*)this_ptr);
26766 CustomMessageHandler_free(this_ptr_conv);
26769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26770 LDKIgnoringMessageHandler this_obj_conv;
26771 this_obj_conv.inner = (void*)(this_obj & (~1));
26772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26773 IgnoringMessageHandler_free(this_obj_conv);
26776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
26777 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
26778 uint64_t ret_ref = 0;
26779 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26780 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26781 ret_ref = (uint64_t)ret_var.inner;
26782 if (ret_var.is_owned) {
26788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26789 LDKIgnoringMessageHandler this_arg_conv;
26790 this_arg_conv.inner = (void*)(this_arg & (~1));
26791 this_arg_conv.is_owned = false;
26792 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26793 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
26794 return (uint64_t)ret_ret;
26797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
26798 LDKIgnoringMessageHandler this_arg_conv;
26799 this_arg_conv.inner = (void*)(this_arg & (~1));
26800 this_arg_conv.is_owned = false;
26801 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
26802 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
26803 return (uint64_t)ret_ret;
26806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
26807 LDKIgnoringMessageHandler this_arg_conv;
26808 this_arg_conv.inner = (void*)(this_arg & (~1));
26809 this_arg_conv.is_owned = false;
26810 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
26811 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
26812 return (uint64_t)ret_ret;
26815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
26816 LDKIgnoringMessageHandler this_arg_conv;
26817 this_arg_conv.inner = (void*)(this_arg & (~1));
26818 this_arg_conv.is_owned = false;
26819 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
26820 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
26821 return (uint64_t)ret_ret;
26824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26825 LDKErroringMessageHandler this_obj_conv;
26826 this_obj_conv.inner = (void*)(this_obj & (~1));
26827 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26828 ErroringMessageHandler_free(this_obj_conv);
26831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
26832 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
26833 uint64_t ret_ref = 0;
26834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26836 ret_ref = (uint64_t)ret_var.inner;
26837 if (ret_var.is_owned) {
26843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26844 LDKErroringMessageHandler this_arg_conv;
26845 this_arg_conv.inner = (void*)(this_arg & (~1));
26846 this_arg_conv.is_owned = false;
26847 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
26848 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
26849 return (uint64_t)ret_ret;
26852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
26853 LDKErroringMessageHandler this_arg_conv;
26854 this_arg_conv.inner = (void*)(this_arg & (~1));
26855 this_arg_conv.is_owned = false;
26856 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
26857 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
26858 return (uint64_t)ret_ret;
26861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26862 LDKMessageHandler this_obj_conv;
26863 this_obj_conv.inner = (void*)(this_obj & (~1));
26864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26865 MessageHandler_free(this_obj_conv);
26868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
26869 LDKMessageHandler this_ptr_conv;
26870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26871 this_ptr_conv.is_owned = false;
26872 // WARNING: This object doesn't live past this scope, needs clone!
26873 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
26877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26878 LDKMessageHandler this_ptr_conv;
26879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26880 this_ptr_conv.is_owned = false;
26881 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26882 CHECK_ACCESS(val_ptr);
26883 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
26884 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
26885 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26886 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
26888 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
26891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
26892 LDKMessageHandler this_ptr_conv;
26893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26894 this_ptr_conv.is_owned = false;
26895 // WARNING: This object doesn't live past this scope, needs clone!
26896 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
26900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26901 LDKMessageHandler this_ptr_conv;
26902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26903 this_ptr_conv.is_owned = false;
26904 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26905 CHECK_ACCESS(val_ptr);
26906 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
26907 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
26908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26909 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
26911 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
26914 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) {
26915 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
26916 CHECK_ACCESS(chan_handler_arg_ptr);
26917 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
26918 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
26919 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26920 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
26922 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
26923 CHECK_ACCESS(route_handler_arg_ptr);
26924 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
26925 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
26926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26927 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
26929 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
26930 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
26934 if (ret_var.is_owned) {
26940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26941 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
26942 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
26943 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
26944 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
26945 *ret_ret = SocketDescriptor_clone(orig_conv);
26946 return (uint64_t)ret_ret;
26949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26950 if ((this_ptr & 1) != 0) return;
26951 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26952 CHECK_ACCESS(this_ptr_ptr);
26953 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
26954 FREE((void*)this_ptr);
26955 SocketDescriptor_free(this_ptr_conv);
26958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26959 LDKPeerHandleError this_obj_conv;
26960 this_obj_conv.inner = (void*)(this_obj & (~1));
26961 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26962 PeerHandleError_free(this_obj_conv);
26965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
26966 LDKPeerHandleError this_ptr_conv;
26967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26968 this_ptr_conv.is_owned = false;
26969 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
26973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26974 LDKPeerHandleError this_ptr_conv;
26975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26976 this_ptr_conv.is_owned = false;
26977 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
26980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
26981 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
26982 uint64_t ret_ref = 0;
26983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26985 ret_ref = (uint64_t)ret_var.inner;
26986 if (ret_var.is_owned) {
26992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26993 LDKPeerHandleError orig_conv;
26994 orig_conv.inner = (void*)(orig & (~1));
26995 orig_conv.is_owned = false;
26996 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
26997 uint64_t ret_ref = 0;
26998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27000 ret_ref = (uint64_t)ret_var.inner;
27001 if (ret_var.is_owned) {
27007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27008 LDKPeerManager this_obj_conv;
27009 this_obj_conv.inner = (void*)(this_obj & (~1));
27010 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27011 PeerManager_free(this_obj_conv);
27014 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) {
27015 LDKMessageHandler message_handler_conv;
27016 message_handler_conv.inner = (void*)(message_handler & (~1));
27017 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
27018 // Warning: we need a move here but no clone is available for LDKMessageHandler
27019 LDKSecretKey our_node_secret_ref;
27020 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
27021 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
27022 unsigned char ephemeral_random_data_arr[32];
27023 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
27024 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
27025 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
27026 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
27027 CHECK_ACCESS(logger_ptr);
27028 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27029 if (logger_conv.free == LDKLogger_JCalls_free) {
27030 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27031 LDKLogger_JCalls_cloned(&logger_conv);
27033 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
27034 CHECK_ACCESS(custom_message_handler_ptr);
27035 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
27036 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
27037 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27038 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
27040 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
27041 uint64_t ret_ref = 0;
27042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27044 ret_ref = (uint64_t)ret_var.inner;
27045 if (ret_var.is_owned) {
27051 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
27052 LDKPeerManager this_arg_conv;
27053 this_arg_conv.inner = (void*)(this_arg & (~1));
27054 this_arg_conv.is_owned = false;
27055 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
27056 jobjectArray ret_arr = NULL;
27057 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
27059 for (size_t i = 0; i < ret_var.datalen; i++) {
27060 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
27061 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
27062 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
27065 FREE(ret_var.data);
27069 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) {
27070 LDKPeerManager this_arg_conv;
27071 this_arg_conv.inner = (void*)(this_arg & (~1));
27072 this_arg_conv.is_owned = false;
27073 LDKPublicKey their_node_id_ref;
27074 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
27075 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
27076 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
27077 CHECK_ACCESS(descriptor_ptr);
27078 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
27079 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
27080 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27081 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
27083 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27084 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
27085 return (uint64_t)ret_conv;
27088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
27089 LDKPeerManager this_arg_conv;
27090 this_arg_conv.inner = (void*)(this_arg & (~1));
27091 this_arg_conv.is_owned = false;
27092 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
27093 CHECK_ACCESS(descriptor_ptr);
27094 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
27095 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
27096 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27097 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
27099 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27100 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
27101 return (uint64_t)ret_conv;
27104 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) {
27105 LDKPeerManager this_arg_conv;
27106 this_arg_conv.inner = (void*)(this_arg & (~1));
27107 this_arg_conv.is_owned = false;
27108 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
27109 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
27110 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
27111 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27112 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
27113 return (uint64_t)ret_conv;
27116 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) {
27117 LDKPeerManager this_arg_conv;
27118 this_arg_conv.inner = (void*)(this_arg & (~1));
27119 this_arg_conv.is_owned = false;
27120 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
27121 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
27122 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
27123 LDKu8slice data_ref;
27124 data_ref.datalen = (*env)->GetArrayLength(env, data);
27125 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
27126 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27127 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
27128 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
27129 return (uint64_t)ret_conv;
27132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
27133 LDKPeerManager this_arg_conv;
27134 this_arg_conv.inner = (void*)(this_arg & (~1));
27135 this_arg_conv.is_owned = false;
27136 PeerManager_process_events(&this_arg_conv);
27139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
27140 LDKPeerManager this_arg_conv;
27141 this_arg_conv.inner = (void*)(this_arg & (~1));
27142 this_arg_conv.is_owned = false;
27143 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
27144 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
27145 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
27146 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
27149 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) {
27150 LDKPeerManager this_arg_conv;
27151 this_arg_conv.inner = (void*)(this_arg & (~1));
27152 this_arg_conv.is_owned = false;
27153 LDKPublicKey node_id_ref;
27154 CHECK((*env)->GetArrayLength(env, node_id) == 33);
27155 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27156 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
27159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
27160 LDKPeerManager this_arg_conv;
27161 this_arg_conv.inner = (void*)(this_arg & (~1));
27162 this_arg_conv.is_owned = false;
27163 PeerManager_disconnect_all_peers(&this_arg_conv);
27166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
27167 LDKPeerManager this_arg_conv;
27168 this_arg_conv.inner = (void*)(this_arg & (~1));
27169 this_arg_conv.is_owned = false;
27170 PeerManager_timer_tick_occurred(&this_arg_conv);
27173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
27174 unsigned char commitment_seed_arr[32];
27175 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27176 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
27177 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
27178 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27179 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
27183 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) {
27184 LDKCVec_u8Z to_holder_script_ref;
27185 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
27186 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
27187 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
27188 LDKCVec_u8Z to_counterparty_script_ref;
27189 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
27190 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
27191 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
27192 LDKOutPoint funding_outpoint_conv;
27193 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
27194 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
27195 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
27196 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);
27197 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27198 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27199 Transaction_free(ret_var);
27203 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) {
27204 LDKPublicKey per_commitment_point_ref;
27205 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
27206 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
27207 unsigned char base_secret_arr[32];
27208 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
27209 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
27210 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
27211 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
27212 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
27213 return (uint64_t)ret_conv;
27216 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) {
27217 LDKPublicKey per_commitment_point_ref;
27218 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
27219 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
27220 LDKPublicKey base_point_ref;
27221 CHECK((*env)->GetArrayLength(env, base_point) == 33);
27222 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
27223 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
27224 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
27225 return (uint64_t)ret_conv;
27228 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) {
27229 unsigned char per_commitment_secret_arr[32];
27230 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
27231 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
27232 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
27233 unsigned char countersignatory_revocation_base_secret_arr[32];
27234 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
27235 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
27236 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
27237 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
27238 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
27239 return (uint64_t)ret_conv;
27242 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) {
27243 LDKPublicKey per_commitment_point_ref;
27244 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
27245 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
27246 LDKPublicKey countersignatory_revocation_base_point_ref;
27247 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
27248 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
27249 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
27250 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
27251 return (uint64_t)ret_conv;
27254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27255 LDKTxCreationKeys this_obj_conv;
27256 this_obj_conv.inner = (void*)(this_obj & (~1));
27257 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27258 TxCreationKeys_free(this_obj_conv);
27261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27262 LDKTxCreationKeys this_ptr_conv;
27263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27264 this_ptr_conv.is_owned = false;
27265 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27266 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
27270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27271 LDKTxCreationKeys this_ptr_conv;
27272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27273 this_ptr_conv.is_owned = false;
27274 LDKPublicKey val_ref;
27275 CHECK((*env)->GetArrayLength(env, val) == 33);
27276 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27277 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
27280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27281 LDKTxCreationKeys this_ptr_conv;
27282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27283 this_ptr_conv.is_owned = false;
27284 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27285 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
27289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27290 LDKTxCreationKeys this_ptr_conv;
27291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27292 this_ptr_conv.is_owned = false;
27293 LDKPublicKey val_ref;
27294 CHECK((*env)->GetArrayLength(env, val) == 33);
27295 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27296 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
27299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27300 LDKTxCreationKeys this_ptr_conv;
27301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27302 this_ptr_conv.is_owned = false;
27303 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
27308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27309 LDKTxCreationKeys this_ptr_conv;
27310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27311 this_ptr_conv.is_owned = false;
27312 LDKPublicKey val_ref;
27313 CHECK((*env)->GetArrayLength(env, val) == 33);
27314 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27315 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
27318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27319 LDKTxCreationKeys this_ptr_conv;
27320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27321 this_ptr_conv.is_owned = false;
27322 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27323 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
27327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27328 LDKTxCreationKeys this_ptr_conv;
27329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27330 this_ptr_conv.is_owned = false;
27331 LDKPublicKey val_ref;
27332 CHECK((*env)->GetArrayLength(env, val) == 33);
27333 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27334 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
27337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27338 LDKTxCreationKeys this_ptr_conv;
27339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27340 this_ptr_conv.is_owned = false;
27341 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27342 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
27346 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) {
27347 LDKTxCreationKeys this_ptr_conv;
27348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27349 this_ptr_conv.is_owned = false;
27350 LDKPublicKey val_ref;
27351 CHECK((*env)->GetArrayLength(env, val) == 33);
27352 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27353 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
27356 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) {
27357 LDKPublicKey per_commitment_point_arg_ref;
27358 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
27359 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
27360 LDKPublicKey revocation_key_arg_ref;
27361 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
27362 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
27363 LDKPublicKey broadcaster_htlc_key_arg_ref;
27364 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
27365 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
27366 LDKPublicKey countersignatory_htlc_key_arg_ref;
27367 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
27368 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
27369 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
27370 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
27371 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
27372 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);
27373 uint64_t ret_ref = 0;
27374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27376 ret_ref = (uint64_t)ret_var.inner;
27377 if (ret_var.is_owned) {
27383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27384 LDKTxCreationKeys orig_conv;
27385 orig_conv.inner = (void*)(orig & (~1));
27386 orig_conv.is_owned = false;
27387 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
27388 uint64_t ret_ref = 0;
27389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27391 ret_ref = (uint64_t)ret_var.inner;
27392 if (ret_var.is_owned) {
27398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
27399 LDKTxCreationKeys obj_conv;
27400 obj_conv.inner = (void*)(obj & (~1));
27401 obj_conv.is_owned = false;
27402 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
27403 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27404 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27405 CVec_u8Z_free(ret_var);
27409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27410 LDKu8slice ser_ref;
27411 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27412 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27413 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
27414 *ret_conv = TxCreationKeys_read(ser_ref);
27415 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27416 return (uint64_t)ret_conv;
27419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27420 LDKChannelPublicKeys this_obj_conv;
27421 this_obj_conv.inner = (void*)(this_obj & (~1));
27422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27423 ChannelPublicKeys_free(this_obj_conv);
27426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27427 LDKChannelPublicKeys this_ptr_conv;
27428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27429 this_ptr_conv.is_owned = false;
27430 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27431 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
27435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27436 LDKChannelPublicKeys this_ptr_conv;
27437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27438 this_ptr_conv.is_owned = false;
27439 LDKPublicKey val_ref;
27440 CHECK((*env)->GetArrayLength(env, val) == 33);
27441 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27442 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
27445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27446 LDKChannelPublicKeys this_ptr_conv;
27447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27448 this_ptr_conv.is_owned = false;
27449 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
27454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27455 LDKChannelPublicKeys this_ptr_conv;
27456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27457 this_ptr_conv.is_owned = false;
27458 LDKPublicKey val_ref;
27459 CHECK((*env)->GetArrayLength(env, val) == 33);
27460 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27461 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
27464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27465 LDKChannelPublicKeys this_ptr_conv;
27466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27467 this_ptr_conv.is_owned = false;
27468 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27469 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
27473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27474 LDKChannelPublicKeys this_ptr_conv;
27475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27476 this_ptr_conv.is_owned = false;
27477 LDKPublicKey val_ref;
27478 CHECK((*env)->GetArrayLength(env, val) == 33);
27479 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27480 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
27483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27484 LDKChannelPublicKeys this_ptr_conv;
27485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27486 this_ptr_conv.is_owned = false;
27487 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27488 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
27492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27493 LDKChannelPublicKeys this_ptr_conv;
27494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27495 this_ptr_conv.is_owned = false;
27496 LDKPublicKey val_ref;
27497 CHECK((*env)->GetArrayLength(env, val) == 33);
27498 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27499 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
27502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27503 LDKChannelPublicKeys this_ptr_conv;
27504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27505 this_ptr_conv.is_owned = false;
27506 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27507 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
27511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27512 LDKChannelPublicKeys this_ptr_conv;
27513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27514 this_ptr_conv.is_owned = false;
27515 LDKPublicKey val_ref;
27516 CHECK((*env)->GetArrayLength(env, val) == 33);
27517 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27518 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
27521 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) {
27522 LDKPublicKey funding_pubkey_arg_ref;
27523 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
27524 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
27525 LDKPublicKey revocation_basepoint_arg_ref;
27526 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
27527 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
27528 LDKPublicKey payment_point_arg_ref;
27529 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
27530 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
27531 LDKPublicKey delayed_payment_basepoint_arg_ref;
27532 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
27533 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
27534 LDKPublicKey htlc_basepoint_arg_ref;
27535 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
27536 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
27537 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);
27538 uint64_t ret_ref = 0;
27539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27541 ret_ref = (uint64_t)ret_var.inner;
27542 if (ret_var.is_owned) {
27548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27549 LDKChannelPublicKeys orig_conv;
27550 orig_conv.inner = (void*)(orig & (~1));
27551 orig_conv.is_owned = false;
27552 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
27553 uint64_t ret_ref = 0;
27554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27556 ret_ref = (uint64_t)ret_var.inner;
27557 if (ret_var.is_owned) {
27563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
27564 LDKChannelPublicKeys obj_conv;
27565 obj_conv.inner = (void*)(obj & (~1));
27566 obj_conv.is_owned = false;
27567 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
27568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27570 CVec_u8Z_free(ret_var);
27574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27575 LDKu8slice ser_ref;
27576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27578 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
27579 *ret_conv = ChannelPublicKeys_read(ser_ref);
27580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27581 return (uint64_t)ret_conv;
27584 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) {
27585 LDKPublicKey per_commitment_point_ref;
27586 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
27587 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
27588 LDKPublicKey broadcaster_delayed_payment_base_ref;
27589 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
27590 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
27591 LDKPublicKey broadcaster_htlc_base_ref;
27592 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
27593 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
27594 LDKPublicKey countersignatory_revocation_base_ref;
27595 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
27596 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
27597 LDKPublicKey countersignatory_htlc_base_ref;
27598 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
27599 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
27600 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
27601 *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);
27602 return (uint64_t)ret_conv;
27605 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) {
27606 LDKPublicKey per_commitment_point_ref;
27607 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
27608 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
27609 LDKChannelPublicKeys broadcaster_keys_conv;
27610 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
27611 broadcaster_keys_conv.is_owned = false;
27612 LDKChannelPublicKeys countersignatory_keys_conv;
27613 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
27614 countersignatory_keys_conv.is_owned = false;
27615 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
27616 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
27617 return (uint64_t)ret_conv;
27620 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) {
27621 LDKPublicKey revocation_key_ref;
27622 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
27623 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
27624 LDKPublicKey broadcaster_delayed_payment_key_ref;
27625 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
27626 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
27627 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
27628 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27629 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27630 CVec_u8Z_free(ret_var);
27634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27635 LDKHTLCOutputInCommitment this_obj_conv;
27636 this_obj_conv.inner = (void*)(this_obj & (~1));
27637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27638 HTLCOutputInCommitment_free(this_obj_conv);
27641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
27642 LDKHTLCOutputInCommitment this_ptr_conv;
27643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27644 this_ptr_conv.is_owned = false;
27645 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
27649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27650 LDKHTLCOutputInCommitment this_ptr_conv;
27651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27652 this_ptr_conv.is_owned = false;
27653 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
27656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27657 LDKHTLCOutputInCommitment this_ptr_conv;
27658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27659 this_ptr_conv.is_owned = false;
27660 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
27664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27665 LDKHTLCOutputInCommitment this_ptr_conv;
27666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27667 this_ptr_conv.is_owned = false;
27668 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
27671 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
27672 LDKHTLCOutputInCommitment this_ptr_conv;
27673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27674 this_ptr_conv.is_owned = false;
27675 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
27679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27680 LDKHTLCOutputInCommitment this_ptr_conv;
27681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27682 this_ptr_conv.is_owned = false;
27683 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
27686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
27687 LDKHTLCOutputInCommitment this_ptr_conv;
27688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27689 this_ptr_conv.is_owned = false;
27690 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27691 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
27695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27696 LDKHTLCOutputInCommitment this_ptr_conv;
27697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27698 this_ptr_conv.is_owned = false;
27699 LDKThirtyTwoBytes val_ref;
27700 CHECK((*env)->GetArrayLength(env, val) == 32);
27701 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27702 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
27705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
27706 LDKHTLCOutputInCommitment this_ptr_conv;
27707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27708 this_ptr_conv.is_owned = false;
27709 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27710 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
27711 uint64_t ret_ref = (uint64_t)ret_copy;
27715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27716 LDKHTLCOutputInCommitment this_ptr_conv;
27717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27718 this_ptr_conv.is_owned = false;
27719 void* val_ptr = (void*)(((uint64_t)val) & ~1);
27720 CHECK_ACCESS(val_ptr);
27721 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27722 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
27723 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
27726 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) {
27727 LDKThirtyTwoBytes payment_hash_arg_ref;
27728 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
27729 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
27730 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
27731 CHECK_ACCESS(transaction_output_index_arg_ptr);
27732 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
27733 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
27734 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
27735 uint64_t ret_ref = 0;
27736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27738 ret_ref = (uint64_t)ret_var.inner;
27739 if (ret_var.is_owned) {
27745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27746 LDKHTLCOutputInCommitment orig_conv;
27747 orig_conv.inner = (void*)(orig & (~1));
27748 orig_conv.is_owned = false;
27749 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
27750 uint64_t ret_ref = 0;
27751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27753 ret_ref = (uint64_t)ret_var.inner;
27754 if (ret_var.is_owned) {
27760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
27761 LDKHTLCOutputInCommitment obj_conv;
27762 obj_conv.inner = (void*)(obj & (~1));
27763 obj_conv.is_owned = false;
27764 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
27765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27767 CVec_u8Z_free(ret_var);
27771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27772 LDKu8slice ser_ref;
27773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27775 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
27776 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
27777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27778 return (uint64_t)ret_conv;
27781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
27782 LDKHTLCOutputInCommitment htlc_conv;
27783 htlc_conv.inner = (void*)(htlc & (~1));
27784 htlc_conv.is_owned = false;
27785 LDKTxCreationKeys keys_conv;
27786 keys_conv.inner = (void*)(keys & (~1));
27787 keys_conv.is_owned = false;
27788 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
27789 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27790 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27791 CVec_u8Z_free(ret_var);
27795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
27796 LDKPublicKey broadcaster_ref;
27797 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
27798 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
27799 LDKPublicKey countersignatory_ref;
27800 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
27801 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
27802 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
27803 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27804 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27805 CVec_u8Z_free(ret_var);
27809 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) {
27810 unsigned char commitment_txid_arr[32];
27811 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
27812 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
27813 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
27814 LDKHTLCOutputInCommitment htlc_conv;
27815 htlc_conv.inner = (void*)(htlc & (~1));
27816 htlc_conv.is_owned = false;
27817 LDKPublicKey broadcaster_delayed_payment_key_ref;
27818 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
27819 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
27820 LDKPublicKey revocation_key_ref;
27821 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
27822 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
27823 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
27824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27826 Transaction_free(ret_var);
27830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27831 LDKChannelTransactionParameters this_obj_conv;
27832 this_obj_conv.inner = (void*)(this_obj & (~1));
27833 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27834 ChannelTransactionParameters_free(this_obj_conv);
27837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
27838 LDKChannelTransactionParameters this_ptr_conv;
27839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27840 this_ptr_conv.is_owned = false;
27841 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
27842 uint64_t ret_ref = 0;
27843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27845 ret_ref = (uint64_t)ret_var.inner;
27846 if (ret_var.is_owned) {
27852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27853 LDKChannelTransactionParameters this_ptr_conv;
27854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27855 this_ptr_conv.is_owned = false;
27856 LDKChannelPublicKeys val_conv;
27857 val_conv.inner = (void*)(val & (~1));
27858 val_conv.is_owned = (val & 1) || (val == 0);
27859 val_conv = ChannelPublicKeys_clone(&val_conv);
27860 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
27863 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27864 LDKChannelTransactionParameters this_ptr_conv;
27865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27866 this_ptr_conv.is_owned = false;
27867 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
27871 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) {
27872 LDKChannelTransactionParameters this_ptr_conv;
27873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27874 this_ptr_conv.is_owned = false;
27875 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
27878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
27879 LDKChannelTransactionParameters this_ptr_conv;
27880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27881 this_ptr_conv.is_owned = false;
27882 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
27886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27887 LDKChannelTransactionParameters this_ptr_conv;
27888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27889 this_ptr_conv.is_owned = false;
27890 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
27893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
27894 LDKChannelTransactionParameters this_ptr_conv;
27895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27896 this_ptr_conv.is_owned = false;
27897 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
27898 uint64_t ret_ref = 0;
27899 if ((uint64_t)ret_var.inner > 4096) {
27900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27902 ret_ref = (uint64_t)ret_var.inner;
27903 if (ret_var.is_owned) {
27910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27911 LDKChannelTransactionParameters this_ptr_conv;
27912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27913 this_ptr_conv.is_owned = false;
27914 LDKCounterpartyChannelTransactionParameters val_conv;
27915 val_conv.inner = (void*)(val & (~1));
27916 val_conv.is_owned = (val & 1) || (val == 0);
27917 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
27918 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
27921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27922 LDKChannelTransactionParameters this_ptr_conv;
27923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27924 this_ptr_conv.is_owned = false;
27925 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
27926 uint64_t ret_ref = 0;
27927 if ((uint64_t)ret_var.inner > 4096) {
27928 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27929 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27930 ret_ref = (uint64_t)ret_var.inner;
27931 if (ret_var.is_owned) {
27938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27939 LDKChannelTransactionParameters this_ptr_conv;
27940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27941 this_ptr_conv.is_owned = false;
27942 LDKOutPoint val_conv;
27943 val_conv.inner = (void*)(val & (~1));
27944 val_conv.is_owned = (val & 1) || (val == 0);
27945 val_conv = OutPoint_clone(&val_conv);
27946 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
27949 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) {
27950 LDKChannelPublicKeys holder_pubkeys_arg_conv;
27951 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
27952 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
27953 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
27954 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
27955 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
27956 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
27957 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
27958 LDKOutPoint funding_outpoint_arg_conv;
27959 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
27960 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
27961 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
27962 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);
27963 uint64_t ret_ref = 0;
27964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27966 ret_ref = (uint64_t)ret_var.inner;
27967 if (ret_var.is_owned) {
27973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27974 LDKChannelTransactionParameters orig_conv;
27975 orig_conv.inner = (void*)(orig & (~1));
27976 orig_conv.is_owned = false;
27977 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
27978 uint64_t ret_ref = 0;
27979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27981 ret_ref = (uint64_t)ret_var.inner;
27982 if (ret_var.is_owned) {
27988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27989 LDKCounterpartyChannelTransactionParameters this_obj_conv;
27990 this_obj_conv.inner = (void*)(this_obj & (~1));
27991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27992 CounterpartyChannelTransactionParameters_free(this_obj_conv);
27995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
27996 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
27997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27998 this_ptr_conv.is_owned = false;
27999 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
28000 uint64_t ret_ref = 0;
28001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28003 ret_ref = (uint64_t)ret_var.inner;
28004 if (ret_var.is_owned) {
28010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28011 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
28012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28013 this_ptr_conv.is_owned = false;
28014 LDKChannelPublicKeys val_conv;
28015 val_conv.inner = (void*)(val & (~1));
28016 val_conv.is_owned = (val & 1) || (val == 0);
28017 val_conv = ChannelPublicKeys_clone(&val_conv);
28018 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
28021 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28022 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
28023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28024 this_ptr_conv.is_owned = false;
28025 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
28029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28030 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
28031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28032 this_ptr_conv.is_owned = false;
28033 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
28036 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) {
28037 LDKChannelPublicKeys pubkeys_arg_conv;
28038 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
28039 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
28040 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
28041 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
28042 uint64_t ret_ref = 0;
28043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28045 ret_ref = (uint64_t)ret_var.inner;
28046 if (ret_var.is_owned) {
28052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28053 LDKCounterpartyChannelTransactionParameters orig_conv;
28054 orig_conv.inner = (void*)(orig & (~1));
28055 orig_conv.is_owned = false;
28056 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
28057 uint64_t ret_ref = 0;
28058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28060 ret_ref = (uint64_t)ret_var.inner;
28061 if (ret_var.is_owned) {
28067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
28068 LDKChannelTransactionParameters this_arg_conv;
28069 this_arg_conv.inner = (void*)(this_arg & (~1));
28070 this_arg_conv.is_owned = false;
28071 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
28075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
28076 LDKChannelTransactionParameters this_arg_conv;
28077 this_arg_conv.inner = (void*)(this_arg & (~1));
28078 this_arg_conv.is_owned = false;
28079 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
28080 uint64_t ret_ref = 0;
28081 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28082 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28083 ret_ref = (uint64_t)ret_var.inner;
28084 if (ret_var.is_owned) {
28090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
28091 LDKChannelTransactionParameters this_arg_conv;
28092 this_arg_conv.inner = (void*)(this_arg & (~1));
28093 this_arg_conv.is_owned = false;
28094 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
28095 uint64_t ret_ref = 0;
28096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28098 ret_ref = (uint64_t)ret_var.inner;
28099 if (ret_var.is_owned) {
28105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
28106 LDKCounterpartyChannelTransactionParameters obj_conv;
28107 obj_conv.inner = (void*)(obj & (~1));
28108 obj_conv.is_owned = false;
28109 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
28110 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28111 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28112 CVec_u8Z_free(ret_var);
28116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28117 LDKu8slice ser_ref;
28118 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28119 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28120 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28121 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
28122 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28123 return (uint64_t)ret_conv;
28126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
28127 LDKChannelTransactionParameters obj_conv;
28128 obj_conv.inner = (void*)(obj & (~1));
28129 obj_conv.is_owned = false;
28130 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
28131 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28132 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28133 CVec_u8Z_free(ret_var);
28137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28138 LDKu8slice ser_ref;
28139 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28140 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28141 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28142 *ret_conv = ChannelTransactionParameters_read(ser_ref);
28143 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28144 return (uint64_t)ret_conv;
28147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28148 LDKDirectedChannelTransactionParameters this_obj_conv;
28149 this_obj_conv.inner = (void*)(this_obj & (~1));
28150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28151 DirectedChannelTransactionParameters_free(this_obj_conv);
28154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28155 LDKDirectedChannelTransactionParameters this_arg_conv;
28156 this_arg_conv.inner = (void*)(this_arg & (~1));
28157 this_arg_conv.is_owned = false;
28158 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
28159 uint64_t ret_ref = 0;
28160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28162 ret_ref = (uint64_t)ret_var.inner;
28163 if (ret_var.is_owned) {
28169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
28170 LDKDirectedChannelTransactionParameters this_arg_conv;
28171 this_arg_conv.inner = (void*)(this_arg & (~1));
28172 this_arg_conv.is_owned = false;
28173 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
28174 uint64_t ret_ref = 0;
28175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28177 ret_ref = (uint64_t)ret_var.inner;
28178 if (ret_var.is_owned) {
28184 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
28185 LDKDirectedChannelTransactionParameters this_arg_conv;
28186 this_arg_conv.inner = (void*)(this_arg & (~1));
28187 this_arg_conv.is_owned = false;
28188 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
28192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
28193 LDKDirectedChannelTransactionParameters this_arg_conv;
28194 this_arg_conv.inner = (void*)(this_arg & (~1));
28195 this_arg_conv.is_owned = false;
28196 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
28200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
28201 LDKDirectedChannelTransactionParameters this_arg_conv;
28202 this_arg_conv.inner = (void*)(this_arg & (~1));
28203 this_arg_conv.is_owned = false;
28204 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
28205 uint64_t ret_ref = 0;
28206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28208 ret_ref = (uint64_t)ret_var.inner;
28209 if (ret_var.is_owned) {
28215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28216 LDKHolderCommitmentTransaction this_obj_conv;
28217 this_obj_conv.inner = (void*)(this_obj & (~1));
28218 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28219 HolderCommitmentTransaction_free(this_obj_conv);
28222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
28223 LDKHolderCommitmentTransaction this_ptr_conv;
28224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28225 this_ptr_conv.is_owned = false;
28226 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28227 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
28231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28232 LDKHolderCommitmentTransaction this_ptr_conv;
28233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28234 this_ptr_conv.is_owned = false;
28235 LDKSignature val_ref;
28236 CHECK((*env)->GetArrayLength(env, val) == 64);
28237 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
28238 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
28241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
28242 LDKHolderCommitmentTransaction this_ptr_conv;
28243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28244 this_ptr_conv.is_owned = false;
28245 LDKCVec_SignatureZ val_constr;
28246 val_constr.datalen = (*env)->GetArrayLength(env, val);
28247 if (val_constr.datalen > 0)
28248 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28250 val_constr.data = NULL;
28251 for (size_t i = 0; i < val_constr.datalen; i++) {
28252 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
28253 LDKSignature val_conv_8_ref;
28254 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
28255 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
28256 val_constr.data[i] = val_conv_8_ref;
28258 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
28261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28262 LDKHolderCommitmentTransaction orig_conv;
28263 orig_conv.inner = (void*)(orig & (~1));
28264 orig_conv.is_owned = false;
28265 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
28266 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
28270 if (ret_var.is_owned) {
28276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
28277 LDKHolderCommitmentTransaction obj_conv;
28278 obj_conv.inner = (void*)(obj & (~1));
28279 obj_conv.is_owned = false;
28280 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
28281 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28282 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28283 CVec_u8Z_free(ret_var);
28287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28288 LDKu8slice ser_ref;
28289 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28290 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28291 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28292 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
28293 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28294 return (uint64_t)ret_conv;
28297 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) {
28298 LDKCommitmentTransaction commitment_tx_conv;
28299 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
28300 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
28301 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
28302 LDKSignature counterparty_sig_ref;
28303 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
28304 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
28305 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
28306 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
28307 if (counterparty_htlc_sigs_constr.datalen > 0)
28308 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28310 counterparty_htlc_sigs_constr.data = NULL;
28311 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
28312 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
28313 LDKSignature counterparty_htlc_sigs_conv_8_ref;
28314 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
28315 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
28316 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
28318 LDKPublicKey holder_funding_key_ref;
28319 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
28320 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
28321 LDKPublicKey counterparty_funding_key_ref;
28322 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
28323 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
28324 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
28325 uint64_t ret_ref = 0;
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 ret_ref = (uint64_t)ret_var.inner;
28329 if (ret_var.is_owned) {
28335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28336 LDKBuiltCommitmentTransaction this_obj_conv;
28337 this_obj_conv.inner = (void*)(this_obj & (~1));
28338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28339 BuiltCommitmentTransaction_free(this_obj_conv);
28342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
28343 LDKBuiltCommitmentTransaction this_ptr_conv;
28344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28345 this_ptr_conv.is_owned = false;
28346 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
28347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28349 Transaction_free(ret_var);
28353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28354 LDKBuiltCommitmentTransaction this_ptr_conv;
28355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28356 this_ptr_conv.is_owned = false;
28357 LDKTransaction val_ref;
28358 val_ref.datalen = (*env)->GetArrayLength(env, val);
28359 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
28360 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
28361 val_ref.data_is_owned = true;
28362 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
28365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28366 LDKBuiltCommitmentTransaction this_ptr_conv;
28367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28368 this_ptr_conv.is_owned = false;
28369 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28370 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
28374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28375 LDKBuiltCommitmentTransaction this_ptr_conv;
28376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28377 this_ptr_conv.is_owned = false;
28378 LDKThirtyTwoBytes val_ref;
28379 CHECK((*env)->GetArrayLength(env, val) == 32);
28380 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28381 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
28384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
28385 LDKTransaction transaction_arg_ref;
28386 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
28387 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
28388 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
28389 transaction_arg_ref.data_is_owned = true;
28390 LDKThirtyTwoBytes txid_arg_ref;
28391 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
28392 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
28393 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
28394 uint64_t ret_ref = 0;
28395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28397 ret_ref = (uint64_t)ret_var.inner;
28398 if (ret_var.is_owned) {
28404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28405 LDKBuiltCommitmentTransaction orig_conv;
28406 orig_conv.inner = (void*)(orig & (~1));
28407 orig_conv.is_owned = false;
28408 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
28409 uint64_t ret_ref = 0;
28410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28412 ret_ref = (uint64_t)ret_var.inner;
28413 if (ret_var.is_owned) {
28419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
28420 LDKBuiltCommitmentTransaction obj_conv;
28421 obj_conv.inner = (void*)(obj & (~1));
28422 obj_conv.is_owned = false;
28423 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
28424 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28425 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28426 CVec_u8Z_free(ret_var);
28430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28431 LDKu8slice ser_ref;
28432 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28433 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28434 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28435 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
28436 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28437 return (uint64_t)ret_conv;
28440 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) {
28441 LDKBuiltCommitmentTransaction this_arg_conv;
28442 this_arg_conv.inner = (void*)(this_arg & (~1));
28443 this_arg_conv.is_owned = false;
28444 LDKu8slice funding_redeemscript_ref;
28445 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
28446 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
28447 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
28449 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
28453 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) {
28454 LDKBuiltCommitmentTransaction this_arg_conv;
28455 this_arg_conv.inner = (void*)(this_arg & (~1));
28456 this_arg_conv.is_owned = false;
28457 unsigned char funding_key_arr[32];
28458 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
28459 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
28460 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
28461 LDKu8slice funding_redeemscript_ref;
28462 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
28463 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
28464 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28465 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
28466 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
28470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28471 LDKClosingTransaction this_obj_conv;
28472 this_obj_conv.inner = (void*)(this_obj & (~1));
28473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28474 ClosingTransaction_free(this_obj_conv);
28477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28478 LDKClosingTransaction orig_conv;
28479 orig_conv.inner = (void*)(orig & (~1));
28480 orig_conv.is_owned = false;
28481 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
28482 uint64_t ret_ref = 0;
28483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28485 ret_ref = (uint64_t)ret_var.inner;
28486 if (ret_var.is_owned) {
28492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
28493 LDKClosingTransaction o_conv;
28494 o_conv.inner = (void*)(o & (~1));
28495 o_conv.is_owned = false;
28496 int64_t ret_val = ClosingTransaction_hash(&o_conv);
28500 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) {
28501 LDKCVec_u8Z to_holder_script_ref;
28502 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
28503 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28504 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
28505 LDKCVec_u8Z to_counterparty_script_ref;
28506 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
28507 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28508 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
28509 LDKOutPoint funding_outpoint_conv;
28510 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28511 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28512 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28513 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
28514 uint64_t ret_ref = 0;
28515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28517 ret_ref = (uint64_t)ret_var.inner;
28518 if (ret_var.is_owned) {
28524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
28525 LDKClosingTransaction this_arg_conv;
28526 this_arg_conv.inner = (void*)(this_arg & (~1));
28527 this_arg_conv.is_owned = false;
28528 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
28529 uint64_t ret_ref = 0;
28530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28532 ret_ref = (uint64_t)ret_var.inner;
28533 if (ret_var.is_owned) {
28539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
28540 LDKClosingTransaction this_arg_conv;
28541 this_arg_conv.inner = (void*)(this_arg & (~1));
28542 this_arg_conv.is_owned = false;
28543 LDKOutPoint funding_outpoint_conv;
28544 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28545 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28546 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28547 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28548 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
28549 return (uint64_t)ret_conv;
28552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
28553 LDKClosingTransaction this_arg_conv;
28554 this_arg_conv.inner = (void*)(this_arg & (~1));
28555 this_arg_conv.is_owned = false;
28556 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
28560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
28561 LDKClosingTransaction this_arg_conv;
28562 this_arg_conv.inner = (void*)(this_arg & (~1));
28563 this_arg_conv.is_owned = false;
28564 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
28568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
28569 LDKClosingTransaction this_arg_conv;
28570 this_arg_conv.inner = (void*)(this_arg & (~1));
28571 this_arg_conv.is_owned = false;
28572 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
28573 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28574 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
28579 LDKClosingTransaction this_arg_conv;
28580 this_arg_conv.inner = (void*)(this_arg & (~1));
28581 this_arg_conv.is_owned = false;
28582 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
28583 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28584 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28589 LDKTrustedClosingTransaction this_obj_conv;
28590 this_obj_conv.inner = (void*)(this_obj & (~1));
28591 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28592 TrustedClosingTransaction_free(this_obj_conv);
28595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
28596 LDKTrustedClosingTransaction this_arg_conv;
28597 this_arg_conv.inner = (void*)(this_arg & (~1));
28598 this_arg_conv.is_owned = false;
28599 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
28600 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28601 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28602 Transaction_free(ret_var);
28606 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) {
28607 LDKTrustedClosingTransaction this_arg_conv;
28608 this_arg_conv.inner = (void*)(this_arg & (~1));
28609 this_arg_conv.is_owned = false;
28610 LDKu8slice funding_redeemscript_ref;
28611 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
28612 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
28613 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28614 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
28615 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
28619 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) {
28620 LDKTrustedClosingTransaction this_arg_conv;
28621 this_arg_conv.inner = (void*)(this_arg & (~1));
28622 this_arg_conv.is_owned = false;
28623 unsigned char funding_key_arr[32];
28624 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
28625 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
28626 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
28627 LDKu8slice funding_redeemscript_ref;
28628 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
28629 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
28630 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28631 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
28632 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
28636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28637 LDKCommitmentTransaction this_obj_conv;
28638 this_obj_conv.inner = (void*)(this_obj & (~1));
28639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28640 CommitmentTransaction_free(this_obj_conv);
28643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28644 LDKCommitmentTransaction orig_conv;
28645 orig_conv.inner = (void*)(orig & (~1));
28646 orig_conv.is_owned = false;
28647 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
28648 uint64_t ret_ref = 0;
28649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28651 ret_ref = (uint64_t)ret_var.inner;
28652 if (ret_var.is_owned) {
28658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
28659 LDKCommitmentTransaction obj_conv;
28660 obj_conv.inner = (void*)(obj & (~1));
28661 obj_conv.is_owned = false;
28662 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
28663 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28664 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28665 CVec_u8Z_free(ret_var);
28669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28670 LDKu8slice ser_ref;
28671 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28672 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28673 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28674 *ret_conv = CommitmentTransaction_read(ser_ref);
28675 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28676 return (uint64_t)ret_conv;
28679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
28680 LDKCommitmentTransaction this_arg_conv;
28681 this_arg_conv.inner = (void*)(this_arg & (~1));
28682 this_arg_conv.is_owned = false;
28683 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
28687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
28688 LDKCommitmentTransaction this_arg_conv;
28689 this_arg_conv.inner = (void*)(this_arg & (~1));
28690 this_arg_conv.is_owned = false;
28691 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
28695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
28696 LDKCommitmentTransaction this_arg_conv;
28697 this_arg_conv.inner = (void*)(this_arg & (~1));
28698 this_arg_conv.is_owned = false;
28699 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
28703 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
28704 LDKCommitmentTransaction this_arg_conv;
28705 this_arg_conv.inner = (void*)(this_arg & (~1));
28706 this_arg_conv.is_owned = false;
28707 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
28711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
28712 LDKCommitmentTransaction this_arg_conv;
28713 this_arg_conv.inner = (void*)(this_arg & (~1));
28714 this_arg_conv.is_owned = false;
28715 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
28716 uint64_t ret_ref = 0;
28717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28719 ret_ref = (uint64_t)ret_var.inner;
28720 if (ret_var.is_owned) {
28726 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) {
28727 LDKCommitmentTransaction this_arg_conv;
28728 this_arg_conv.inner = (void*)(this_arg & (~1));
28729 this_arg_conv.is_owned = false;
28730 LDKDirectedChannelTransactionParameters channel_parameters_conv;
28731 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
28732 channel_parameters_conv.is_owned = false;
28733 LDKChannelPublicKeys broadcaster_keys_conv;
28734 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
28735 broadcaster_keys_conv.is_owned = false;
28736 LDKChannelPublicKeys countersignatory_keys_conv;
28737 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
28738 countersignatory_keys_conv.is_owned = false;
28739 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
28740 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
28741 return (uint64_t)ret_conv;
28744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28745 LDKTrustedCommitmentTransaction this_obj_conv;
28746 this_obj_conv.inner = (void*)(this_obj & (~1));
28747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28748 TrustedCommitmentTransaction_free(this_obj_conv);
28751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
28752 LDKTrustedCommitmentTransaction this_arg_conv;
28753 this_arg_conv.inner = (void*)(this_arg & (~1));
28754 this_arg_conv.is_owned = false;
28755 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
28760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
28761 LDKTrustedCommitmentTransaction this_arg_conv;
28762 this_arg_conv.inner = (void*)(this_arg & (~1));
28763 this_arg_conv.is_owned = false;
28764 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
28765 uint64_t ret_ref = 0;
28766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28768 ret_ref = (uint64_t)ret_var.inner;
28769 if (ret_var.is_owned) {
28775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
28776 LDKTrustedCommitmentTransaction this_arg_conv;
28777 this_arg_conv.inner = (void*)(this_arg & (~1));
28778 this_arg_conv.is_owned = false;
28779 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
28780 uint64_t ret_ref = 0;
28781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28783 ret_ref = (uint64_t)ret_var.inner;
28784 if (ret_var.is_owned) {
28790 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) {
28791 LDKTrustedCommitmentTransaction this_arg_conv;
28792 this_arg_conv.inner = (void*)(this_arg & (~1));
28793 this_arg_conv.is_owned = false;
28794 unsigned char htlc_base_key_arr[32];
28795 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
28796 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
28797 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
28798 LDKDirectedChannelTransactionParameters channel_parameters_conv;
28799 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
28800 channel_parameters_conv.is_owned = false;
28801 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
28802 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
28803 return (uint64_t)ret_conv;
28806 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) {
28807 LDKPublicKey broadcaster_payment_basepoint_ref;
28808 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
28809 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
28810 LDKPublicKey countersignatory_payment_basepoint_ref;
28811 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
28812 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
28813 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
28817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28818 LDKInitFeatures a_conv;
28819 a_conv.inner = (void*)(a & (~1));
28820 a_conv.is_owned = false;
28821 LDKInitFeatures b_conv;
28822 b_conv.inner = (void*)(b & (~1));
28823 b_conv.is_owned = false;
28824 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
28828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28829 LDKNodeFeatures a_conv;
28830 a_conv.inner = (void*)(a & (~1));
28831 a_conv.is_owned = false;
28832 LDKNodeFeatures b_conv;
28833 b_conv.inner = (void*)(b & (~1));
28834 b_conv.is_owned = false;
28835 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
28839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28840 LDKChannelFeatures a_conv;
28841 a_conv.inner = (void*)(a & (~1));
28842 a_conv.is_owned = false;
28843 LDKChannelFeatures b_conv;
28844 b_conv.inner = (void*)(b & (~1));
28845 b_conv.is_owned = false;
28846 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
28850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28851 LDKInvoiceFeatures a_conv;
28852 a_conv.inner = (void*)(a & (~1));
28853 a_conv.is_owned = false;
28854 LDKInvoiceFeatures b_conv;
28855 b_conv.inner = (void*)(b & (~1));
28856 b_conv.is_owned = false;
28857 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
28861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28862 LDKInitFeatures orig_conv;
28863 orig_conv.inner = (void*)(orig & (~1));
28864 orig_conv.is_owned = false;
28865 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
28866 uint64_t ret_ref = 0;
28867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28869 ret_ref = (uint64_t)ret_var.inner;
28870 if (ret_var.is_owned) {
28876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28877 LDKNodeFeatures orig_conv;
28878 orig_conv.inner = (void*)(orig & (~1));
28879 orig_conv.is_owned = false;
28880 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
28881 uint64_t ret_ref = 0;
28882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28884 ret_ref = (uint64_t)ret_var.inner;
28885 if (ret_var.is_owned) {
28891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28892 LDKChannelFeatures orig_conv;
28893 orig_conv.inner = (void*)(orig & (~1));
28894 orig_conv.is_owned = false;
28895 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
28896 uint64_t ret_ref = 0;
28897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28899 ret_ref = (uint64_t)ret_var.inner;
28900 if (ret_var.is_owned) {
28906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28907 LDKInvoiceFeatures orig_conv;
28908 orig_conv.inner = (void*)(orig & (~1));
28909 orig_conv.is_owned = false;
28910 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
28911 uint64_t ret_ref = 0;
28912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28914 ret_ref = (uint64_t)ret_var.inner;
28915 if (ret_var.is_owned) {
28921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28922 LDKInitFeatures this_obj_conv;
28923 this_obj_conv.inner = (void*)(this_obj & (~1));
28924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28925 InitFeatures_free(this_obj_conv);
28928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28929 LDKNodeFeatures this_obj_conv;
28930 this_obj_conv.inner = (void*)(this_obj & (~1));
28931 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28932 NodeFeatures_free(this_obj_conv);
28935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28936 LDKChannelFeatures this_obj_conv;
28937 this_obj_conv.inner = (void*)(this_obj & (~1));
28938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28939 ChannelFeatures_free(this_obj_conv);
28942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28943 LDKInvoiceFeatures this_obj_conv;
28944 this_obj_conv.inner = (void*)(this_obj & (~1));
28945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28946 InvoiceFeatures_free(this_obj_conv);
28949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
28950 LDKInitFeatures ret_var = InitFeatures_empty();
28951 uint64_t ret_ref = 0;
28952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28954 ret_ref = (uint64_t)ret_var.inner;
28955 if (ret_var.is_owned) {
28961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
28962 LDKInitFeatures ret_var = InitFeatures_known();
28963 uint64_t ret_ref = 0;
28964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28966 ret_ref = (uint64_t)ret_var.inner;
28967 if (ret_var.is_owned) {
28973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
28974 LDKInitFeatures this_arg_conv;
28975 this_arg_conv.inner = (void*)(this_arg & (~1));
28976 this_arg_conv.is_owned = false;
28977 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
28981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
28982 LDKNodeFeatures ret_var = NodeFeatures_empty();
28983 uint64_t ret_ref = 0;
28984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28986 ret_ref = (uint64_t)ret_var.inner;
28987 if (ret_var.is_owned) {
28993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
28994 LDKNodeFeatures ret_var = NodeFeatures_known();
28995 uint64_t ret_ref = 0;
28996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28998 ret_ref = (uint64_t)ret_var.inner;
28999 if (ret_var.is_owned) {
29005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
29006 LDKNodeFeatures this_arg_conv;
29007 this_arg_conv.inner = (void*)(this_arg & (~1));
29008 this_arg_conv.is_owned = false;
29009 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
29013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
29014 LDKChannelFeatures ret_var = ChannelFeatures_empty();
29015 uint64_t ret_ref = 0;
29016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29018 ret_ref = (uint64_t)ret_var.inner;
29019 if (ret_var.is_owned) {
29025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
29026 LDKChannelFeatures ret_var = ChannelFeatures_known();
29027 uint64_t ret_ref = 0;
29028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29030 ret_ref = (uint64_t)ret_var.inner;
29031 if (ret_var.is_owned) {
29037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
29038 LDKChannelFeatures this_arg_conv;
29039 this_arg_conv.inner = (void*)(this_arg & (~1));
29040 this_arg_conv.is_owned = false;
29041 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
29045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
29046 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
29047 uint64_t ret_ref = 0;
29048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29050 ret_ref = (uint64_t)ret_var.inner;
29051 if (ret_var.is_owned) {
29057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
29058 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
29059 uint64_t ret_ref = 0;
29060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29062 ret_ref = (uint64_t)ret_var.inner;
29063 if (ret_var.is_owned) {
29069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
29070 LDKInvoiceFeatures this_arg_conv;
29071 this_arg_conv.inner = (void*)(this_arg & (~1));
29072 this_arg_conv.is_owned = false;
29073 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
29077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29078 LDKInitFeatures this_arg_conv;
29079 this_arg_conv.inner = (void*)(this_arg & (~1));
29080 this_arg_conv.is_owned = false;
29081 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
29085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29086 LDKNodeFeatures this_arg_conv;
29087 this_arg_conv.inner = (void*)(this_arg & (~1));
29088 this_arg_conv.is_owned = false;
29089 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
29093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29094 LDKInvoiceFeatures this_arg_conv;
29095 this_arg_conv.inner = (void*)(this_arg & (~1));
29096 this_arg_conv.is_owned = false;
29097 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
29101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
29102 LDKInitFeatures obj_conv;
29103 obj_conv.inner = (void*)(obj & (~1));
29104 obj_conv.is_owned = false;
29105 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
29106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29108 CVec_u8Z_free(ret_var);
29112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
29113 LDKNodeFeatures obj_conv;
29114 obj_conv.inner = (void*)(obj & (~1));
29115 obj_conv.is_owned = false;
29116 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
29117 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29118 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29119 CVec_u8Z_free(ret_var);
29123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
29124 LDKChannelFeatures obj_conv;
29125 obj_conv.inner = (void*)(obj & (~1));
29126 obj_conv.is_owned = false;
29127 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
29128 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29129 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29130 CVec_u8Z_free(ret_var);
29134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
29135 LDKInvoiceFeatures obj_conv;
29136 obj_conv.inner = (void*)(obj & (~1));
29137 obj_conv.is_owned = false;
29138 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
29139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29141 CVec_u8Z_free(ret_var);
29145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29146 LDKu8slice ser_ref;
29147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29149 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
29150 *ret_conv = InitFeatures_read(ser_ref);
29151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29152 return (uint64_t)ret_conv;
29155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29156 LDKu8slice ser_ref;
29157 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29158 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29159 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
29160 *ret_conv = NodeFeatures_read(ser_ref);
29161 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29162 return (uint64_t)ret_conv;
29165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29166 LDKu8slice ser_ref;
29167 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29168 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29169 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
29170 *ret_conv = ChannelFeatures_read(ser_ref);
29171 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29172 return (uint64_t)ret_conv;
29175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29176 LDKu8slice ser_ref;
29177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29179 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
29180 *ret_conv = InvoiceFeatures_read(ser_ref);
29181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29182 return (uint64_t)ret_conv;
29185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29186 LDKShutdownScript this_obj_conv;
29187 this_obj_conv.inner = (void*)(this_obj & (~1));
29188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29189 ShutdownScript_free(this_obj_conv);
29192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29193 LDKShutdownScript orig_conv;
29194 orig_conv.inner = (void*)(orig & (~1));
29195 orig_conv.is_owned = false;
29196 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
29197 uint64_t ret_ref = 0;
29198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29200 ret_ref = (uint64_t)ret_var.inner;
29201 if (ret_var.is_owned) {
29207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29208 LDKInvalidShutdownScript this_obj_conv;
29209 this_obj_conv.inner = (void*)(this_obj & (~1));
29210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29211 InvalidShutdownScript_free(this_obj_conv);
29214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
29215 LDKInvalidShutdownScript this_ptr_conv;
29216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29217 this_ptr_conv.is_owned = false;
29218 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
29219 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29220 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29225 LDKInvalidShutdownScript this_ptr_conv;
29226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29227 this_ptr_conv.is_owned = false;
29228 LDKCVec_u8Z val_ref;
29229 val_ref.datalen = (*env)->GetArrayLength(env, val);
29230 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29231 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
29232 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
29235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
29236 LDKCVec_u8Z script_arg_ref;
29237 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
29238 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29239 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
29240 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
29241 uint64_t ret_ref = 0;
29242 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29243 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29244 ret_ref = (uint64_t)ret_var.inner;
29245 if (ret_var.is_owned) {
29251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29252 LDKInvalidShutdownScript orig_conv;
29253 orig_conv.inner = (void*)(orig & (~1));
29254 orig_conv.is_owned = false;
29255 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
29256 uint64_t ret_ref = 0;
29257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29259 ret_ref = (uint64_t)ret_var.inner;
29260 if (ret_var.is_owned) {
29266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
29267 LDKShutdownScript obj_conv;
29268 obj_conv.inner = (void*)(obj & (~1));
29269 obj_conv.is_owned = false;
29270 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
29271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29273 CVec_u8Z_free(ret_var);
29277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29278 LDKu8slice ser_ref;
29279 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29280 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29281 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29282 *ret_conv = ShutdownScript_read(ser_ref);
29283 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29284 return (uint64_t)ret_conv;
29287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
29288 unsigned char pubkey_hash_arr[20];
29289 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
29290 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
29291 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
29292 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
29293 uint64_t ret_ref = 0;
29294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29296 ret_ref = (uint64_t)ret_var.inner;
29297 if (ret_var.is_owned) {
29303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
29304 unsigned char script_hash_arr[32];
29305 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
29306 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
29307 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
29308 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
29309 uint64_t ret_ref = 0;
29310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29312 ret_ref = (uint64_t)ret_var.inner;
29313 if (ret_var.is_owned) {
29319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
29320 LDKu8slice program_ref;
29321 program_ref.datalen = (*env)->GetArrayLength(env, program);
29322 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
29323 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29324 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
29325 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
29326 return (uint64_t)ret_conv;
29329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29330 LDKShutdownScript this_arg_conv;
29331 this_arg_conv.inner = (void*)(this_arg & (~1));
29332 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29333 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
29334 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
29335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29337 CVec_u8Z_free(ret_var);
29341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
29342 LDKShutdownScript this_arg_conv;
29343 this_arg_conv.inner = (void*)(this_arg & (~1));
29344 this_arg_conv.is_owned = false;
29345 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29346 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
29350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
29351 LDKShutdownScript this_arg_conv;
29352 this_arg_conv.inner = (void*)(this_arg & (~1));
29353 this_arg_conv.is_owned = false;
29354 LDKInitFeatures features_conv;
29355 features_conv.inner = (void*)(features & (~1));
29356 features_conv.is_owned = false;
29357 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
29361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29362 if ((this_ptr & 1) != 0) return;
29363 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29364 CHECK_ACCESS(this_ptr_ptr);
29365 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
29366 FREE((void*)this_ptr);
29367 CustomMessageReader_free(this_ptr_conv);
29370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29371 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
29372 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
29373 LDKType* orig_conv = (LDKType*)orig_ptr;
29374 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
29375 *ret_ret = Type_clone(orig_conv);
29376 return (uint64_t)ret_ret;
29379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29380 if ((this_ptr & 1) != 0) return;
29381 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29382 CHECK_ACCESS(this_ptr_ptr);
29383 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
29384 FREE((void*)this_ptr);
29385 Type_free(this_ptr_conv);
29388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29389 if ((this_ptr & 1) != 0) return;
29390 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29391 CHECK_ACCESS(this_ptr_ptr);
29392 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
29393 FREE((void*)this_ptr);
29394 Score_free(this_ptr_conv);
29397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29398 LDKLockableScore this_obj_conv;
29399 this_obj_conv.inner = (void*)(this_obj & (~1));
29400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29401 LockableScore_free(this_obj_conv);
29404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
29405 void* score_ptr = (void*)(((uint64_t)score) & ~1);
29406 CHECK_ACCESS(score_ptr);
29407 LDKScore score_conv = *(LDKScore*)(score_ptr);
29408 if (score_conv.free == LDKScore_JCalls_free) {
29409 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29410 LDKScore_JCalls_cloned(&score_conv);
29412 LDKLockableScore ret_var = LockableScore_new(score_conv);
29413 uint64_t ret_ref = 0;
29414 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29415 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29416 ret_ref = (uint64_t)ret_var.inner;
29417 if (ret_var.is_owned) {
29423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
29424 LDKLockableScore obj_conv;
29425 obj_conv.inner = (void*)(obj & (~1));
29426 obj_conv.is_owned = false;
29427 LDKCVec_u8Z ret_var = LockableScore_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 void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29435 LDKNodeId this_obj_conv;
29436 this_obj_conv.inner = (void*)(this_obj & (~1));
29437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29438 NodeId_free(this_obj_conv);
29441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29442 LDKNodeId orig_conv;
29443 orig_conv.inner = (void*)(orig & (~1));
29444 orig_conv.is_owned = false;
29445 LDKNodeId ret_var = NodeId_clone(&orig_conv);
29446 uint64_t ret_ref = 0;
29447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29449 ret_ref = (uint64_t)ret_var.inner;
29450 if (ret_var.is_owned) {
29456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
29457 LDKPublicKey pubkey_ref;
29458 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
29459 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
29460 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
29461 uint64_t ret_ref = 0;
29462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29464 ret_ref = (uint64_t)ret_var.inner;
29465 if (ret_var.is_owned) {
29471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
29472 LDKNodeId this_arg_conv;
29473 this_arg_conv.inner = (void*)(this_arg & (~1));
29474 this_arg_conv.is_owned = false;
29475 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
29476 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29477 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
29483 o_conv.inner = (void*)(o & (~1));
29484 o_conv.is_owned = false;
29485 int64_t ret_val = NodeId_hash(&o_conv);
29489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
29490 LDKNodeId obj_conv;
29491 obj_conv.inner = (void*)(obj & (~1));
29492 obj_conv.is_owned = false;
29493 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
29494 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29495 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29496 CVec_u8Z_free(ret_var);
29500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29501 LDKu8slice ser_ref;
29502 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29503 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29504 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
29505 *ret_conv = NodeId_read(ser_ref);
29506 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29507 return (uint64_t)ret_conv;
29510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29511 LDKNetworkGraph this_obj_conv;
29512 this_obj_conv.inner = (void*)(this_obj & (~1));
29513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29514 NetworkGraph_free(this_obj_conv);
29517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29518 LDKNetworkGraph orig_conv;
29519 orig_conv.inner = (void*)(orig & (~1));
29520 orig_conv.is_owned = false;
29521 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
29522 uint64_t ret_ref = 0;
29523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29525 ret_ref = (uint64_t)ret_var.inner;
29526 if (ret_var.is_owned) {
29532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29533 LDKReadOnlyNetworkGraph this_obj_conv;
29534 this_obj_conv.inner = (void*)(this_obj & (~1));
29535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29536 ReadOnlyNetworkGraph_free(this_obj_conv);
29539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29540 if ((this_ptr & 1) != 0) return;
29541 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
29542 CHECK_ACCESS(this_ptr_ptr);
29543 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
29544 FREE((void*)this_ptr);
29545 NetworkUpdate_free(this_ptr_conv);
29548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29549 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
29550 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
29551 *ret_copy = NetworkUpdate_clone(orig_conv);
29552 uint64_t ret_ref = (uint64_t)ret_copy;
29556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
29557 LDKChannelUpdate msg_conv;
29558 msg_conv.inner = (void*)(msg & (~1));
29559 msg_conv.is_owned = (msg & 1) || (msg == 0);
29560 msg_conv = ChannelUpdate_clone(&msg_conv);
29561 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
29562 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
29563 uint64_t ret_ref = (uint64_t)ret_copy;
29567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
29568 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
29569 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
29570 uint64_t ret_ref = (uint64_t)ret_copy;
29574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
29575 LDKPublicKey node_id_ref;
29576 CHECK((*env)->GetArrayLength(env, node_id) == 33);
29577 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
29578 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
29579 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
29580 uint64_t ret_ref = (uint64_t)ret_copy;
29584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
29585 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
29586 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
29587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29589 CVec_u8Z_free(ret_var);
29593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29594 LDKNetGraphMsgHandler this_arg_conv;
29595 this_arg_conv.inner = (void*)(this_arg & (~1));
29596 this_arg_conv.is_owned = false;
29597 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
29598 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
29599 return (uint64_t)ret_ret;
29602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29603 LDKNetGraphMsgHandler this_obj_conv;
29604 this_obj_conv.inner = (void*)(this_obj & (~1));
29605 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29606 NetGraphMsgHandler_free(this_obj_conv);
29609 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) {
29610 LDKNetworkGraph network_graph_conv;
29611 network_graph_conv.inner = (void*)(network_graph & (~1));
29612 network_graph_conv.is_owned = false;
29613 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
29614 CHECK_ACCESS(chain_access_ptr);
29615 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
29616 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
29617 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
29618 // Manually implement clone for Java trait instances
29619 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
29620 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29621 LDKAccess_JCalls_cloned(&chain_access_conv.some);
29624 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
29625 CHECK_ACCESS(logger_ptr);
29626 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29627 if (logger_conv.free == LDKLogger_JCalls_free) {
29628 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29629 LDKLogger_JCalls_cloned(&logger_conv);
29631 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
29632 uint64_t ret_ref = 0;
29633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29635 ret_ref = (uint64_t)ret_var.inner;
29636 if (ret_var.is_owned) {
29642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
29643 LDKNetGraphMsgHandler this_arg_conv;
29644 this_arg_conv.inner = (void*)(this_arg & (~1));
29645 this_arg_conv.is_owned = false;
29646 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
29647 CHECK_ACCESS(chain_access_ptr);
29648 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
29649 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
29650 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
29651 // Manually implement clone for Java trait instances
29652 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
29653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29654 LDKAccess_JCalls_cloned(&chain_access_conv.some);
29657 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
29660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29661 LDKNetGraphMsgHandler this_arg_conv;
29662 this_arg_conv.inner = (void*)(this_arg & (~1));
29663 this_arg_conv.is_owned = false;
29664 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
29665 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
29666 return (uint64_t)ret_ret;
29669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29670 LDKNetGraphMsgHandler this_arg_conv;
29671 this_arg_conv.inner = (void*)(this_arg & (~1));
29672 this_arg_conv.is_owned = false;
29673 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29674 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
29675 return (uint64_t)ret_ret;
29678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29679 LDKDirectionalChannelInfo this_obj_conv;
29680 this_obj_conv.inner = (void*)(this_obj & (~1));
29681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29682 DirectionalChannelInfo_free(this_obj_conv);
29685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
29686 LDKDirectionalChannelInfo this_ptr_conv;
29687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29688 this_ptr_conv.is_owned = false;
29689 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
29693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29694 LDKDirectionalChannelInfo this_ptr_conv;
29695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29696 this_ptr_conv.is_owned = false;
29697 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
29700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
29701 LDKDirectionalChannelInfo this_ptr_conv;
29702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29703 this_ptr_conv.is_owned = false;
29704 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
29708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29709 LDKDirectionalChannelInfo this_ptr_conv;
29710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29711 this_ptr_conv.is_owned = false;
29712 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
29715 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
29716 LDKDirectionalChannelInfo this_ptr_conv;
29717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29718 this_ptr_conv.is_owned = false;
29719 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
29723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29724 LDKDirectionalChannelInfo this_ptr_conv;
29725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29726 this_ptr_conv.is_owned = false;
29727 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
29730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29731 LDKDirectionalChannelInfo this_ptr_conv;
29732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29733 this_ptr_conv.is_owned = false;
29734 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
29738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29739 LDKDirectionalChannelInfo this_ptr_conv;
29740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29741 this_ptr_conv.is_owned = false;
29742 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
29745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29746 LDKDirectionalChannelInfo this_ptr_conv;
29747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29748 this_ptr_conv.is_owned = false;
29749 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29750 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
29751 uint64_t ret_ref = (uint64_t)ret_copy;
29755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29756 LDKDirectionalChannelInfo this_ptr_conv;
29757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29758 this_ptr_conv.is_owned = false;
29759 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29760 CHECK_ACCESS(val_ptr);
29761 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29762 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
29763 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
29766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
29767 LDKDirectionalChannelInfo this_ptr_conv;
29768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29769 this_ptr_conv.is_owned = false;
29770 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
29771 uint64_t ret_ref = 0;
29772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29774 ret_ref = (uint64_t)ret_var.inner;
29775 if (ret_var.is_owned) {
29781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29782 LDKDirectionalChannelInfo this_ptr_conv;
29783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29784 this_ptr_conv.is_owned = false;
29785 LDKRoutingFees val_conv;
29786 val_conv.inner = (void*)(val & (~1));
29787 val_conv.is_owned = (val & 1) || (val == 0);
29788 val_conv = RoutingFees_clone(&val_conv);
29789 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
29792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
29793 LDKDirectionalChannelInfo this_ptr_conv;
29794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29795 this_ptr_conv.is_owned = false;
29796 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
29797 uint64_t ret_ref = 0;
29798 if ((uint64_t)ret_var.inner > 4096) {
29799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29801 ret_ref = (uint64_t)ret_var.inner;
29802 if (ret_var.is_owned) {
29809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29810 LDKDirectionalChannelInfo this_ptr_conv;
29811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29812 this_ptr_conv.is_owned = false;
29813 LDKChannelUpdate val_conv;
29814 val_conv.inner = (void*)(val & (~1));
29815 val_conv.is_owned = (val & 1) || (val == 0);
29816 val_conv = ChannelUpdate_clone(&val_conv);
29817 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
29820 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) {
29821 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
29822 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
29823 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
29824 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
29825 LDKRoutingFees fees_arg_conv;
29826 fees_arg_conv.inner = (void*)(fees_arg & (~1));
29827 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
29828 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
29829 LDKChannelUpdate last_update_message_arg_conv;
29830 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
29831 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
29832 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
29833 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);
29834 uint64_t ret_ref = 0;
29835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29837 ret_ref = (uint64_t)ret_var.inner;
29838 if (ret_var.is_owned) {
29844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29845 LDKDirectionalChannelInfo orig_conv;
29846 orig_conv.inner = (void*)(orig & (~1));
29847 orig_conv.is_owned = false;
29848 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
29849 uint64_t ret_ref = 0;
29850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29852 ret_ref = (uint64_t)ret_var.inner;
29853 if (ret_var.is_owned) {
29859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29860 LDKDirectionalChannelInfo obj_conv;
29861 obj_conv.inner = (void*)(obj & (~1));
29862 obj_conv.is_owned = false;
29863 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
29864 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29865 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29866 CVec_u8Z_free(ret_var);
29870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29871 LDKu8slice ser_ref;
29872 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29873 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29874 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
29875 *ret_conv = DirectionalChannelInfo_read(ser_ref);
29876 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29877 return (uint64_t)ret_conv;
29880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29881 LDKChannelInfo this_obj_conv;
29882 this_obj_conv.inner = (void*)(this_obj & (~1));
29883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29884 ChannelInfo_free(this_obj_conv);
29887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29888 LDKChannelInfo this_ptr_conv;
29889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29890 this_ptr_conv.is_owned = false;
29891 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
29892 uint64_t ret_ref = 0;
29893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29895 ret_ref = (uint64_t)ret_var.inner;
29896 if (ret_var.is_owned) {
29902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29903 LDKChannelInfo this_ptr_conv;
29904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29905 this_ptr_conv.is_owned = false;
29906 LDKChannelFeatures val_conv;
29907 val_conv.inner = (void*)(val & (~1));
29908 val_conv.is_owned = (val & 1) || (val == 0);
29909 val_conv = ChannelFeatures_clone(&val_conv);
29910 ChannelInfo_set_features(&this_ptr_conv, val_conv);
29913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
29914 LDKChannelInfo this_ptr_conv;
29915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29916 this_ptr_conv.is_owned = false;
29917 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
29918 uint64_t ret_ref = 0;
29919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29921 ret_ref = (uint64_t)ret_var.inner;
29922 if (ret_var.is_owned) {
29928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29929 LDKChannelInfo this_ptr_conv;
29930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29931 this_ptr_conv.is_owned = false;
29932 LDKNodeId val_conv;
29933 val_conv.inner = (void*)(val & (~1));
29934 val_conv.is_owned = (val & 1) || (val == 0);
29935 val_conv = NodeId_clone(&val_conv);
29936 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
29939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
29940 LDKChannelInfo this_ptr_conv;
29941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29942 this_ptr_conv.is_owned = false;
29943 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
29944 uint64_t ret_ref = 0;
29945 if ((uint64_t)ret_var.inner > 4096) {
29946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29948 ret_ref = (uint64_t)ret_var.inner;
29949 if (ret_var.is_owned) {
29956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29957 LDKChannelInfo this_ptr_conv;
29958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29959 this_ptr_conv.is_owned = false;
29960 LDKDirectionalChannelInfo val_conv;
29961 val_conv.inner = (void*)(val & (~1));
29962 val_conv.is_owned = (val & 1) || (val == 0);
29963 val_conv = DirectionalChannelInfo_clone(&val_conv);
29964 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
29967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
29968 LDKChannelInfo this_ptr_conv;
29969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29970 this_ptr_conv.is_owned = false;
29971 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
29972 uint64_t ret_ref = 0;
29973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29975 ret_ref = (uint64_t)ret_var.inner;
29976 if (ret_var.is_owned) {
29982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29983 LDKChannelInfo this_ptr_conv;
29984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29985 this_ptr_conv.is_owned = false;
29986 LDKNodeId val_conv;
29987 val_conv.inner = (void*)(val & (~1));
29988 val_conv.is_owned = (val & 1) || (val == 0);
29989 val_conv = NodeId_clone(&val_conv);
29990 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
29993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
29994 LDKChannelInfo this_ptr_conv;
29995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29996 this_ptr_conv.is_owned = false;
29997 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
29998 uint64_t ret_ref = 0;
29999 if ((uint64_t)ret_var.inner > 4096) {
30000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30002 ret_ref = (uint64_t)ret_var.inner;
30003 if (ret_var.is_owned) {
30010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30011 LDKChannelInfo this_ptr_conv;
30012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30013 this_ptr_conv.is_owned = false;
30014 LDKDirectionalChannelInfo val_conv;
30015 val_conv.inner = (void*)(val & (~1));
30016 val_conv.is_owned = (val & 1) || (val == 0);
30017 val_conv = DirectionalChannelInfo_clone(&val_conv);
30018 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
30021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
30022 LDKChannelInfo this_ptr_conv;
30023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30024 this_ptr_conv.is_owned = false;
30025 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30026 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
30027 uint64_t ret_ref = (uint64_t)ret_copy;
30031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30032 LDKChannelInfo this_ptr_conv;
30033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30034 this_ptr_conv.is_owned = false;
30035 void* val_ptr = (void*)(((uint64_t)val) & ~1);
30036 CHECK_ACCESS(val_ptr);
30037 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30038 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
30039 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
30042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
30043 LDKChannelInfo this_ptr_conv;
30044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30045 this_ptr_conv.is_owned = false;
30046 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
30047 uint64_t ret_ref = 0;
30048 if ((uint64_t)ret_var.inner > 4096) {
30049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30051 ret_ref = (uint64_t)ret_var.inner;
30052 if (ret_var.is_owned) {
30059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30060 LDKChannelInfo this_ptr_conv;
30061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30062 this_ptr_conv.is_owned = false;
30063 LDKChannelAnnouncement val_conv;
30064 val_conv.inner = (void*)(val & (~1));
30065 val_conv.is_owned = (val & 1) || (val == 0);
30066 val_conv = ChannelAnnouncement_clone(&val_conv);
30067 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
30070 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) {
30071 LDKChannelFeatures features_arg_conv;
30072 features_arg_conv.inner = (void*)(features_arg & (~1));
30073 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
30074 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
30075 LDKNodeId node_one_arg_conv;
30076 node_one_arg_conv.inner = (void*)(node_one_arg & (~1));
30077 node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0);
30078 node_one_arg_conv = NodeId_clone(&node_one_arg_conv);
30079 LDKDirectionalChannelInfo one_to_two_arg_conv;
30080 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
30081 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
30082 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
30083 LDKNodeId node_two_arg_conv;
30084 node_two_arg_conv.inner = (void*)(node_two_arg & (~1));
30085 node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0);
30086 node_two_arg_conv = NodeId_clone(&node_two_arg_conv);
30087 LDKDirectionalChannelInfo two_to_one_arg_conv;
30088 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
30089 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
30090 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
30091 void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1);
30092 CHECK_ACCESS(capacity_sats_arg_ptr);
30093 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr);
30094 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
30095 LDKChannelAnnouncement announcement_message_arg_conv;
30096 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
30097 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
30098 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
30099 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);
30100 uint64_t ret_ref = 0;
30101 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30102 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30103 ret_ref = (uint64_t)ret_var.inner;
30104 if (ret_var.is_owned) {
30110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30111 LDKChannelInfo orig_conv;
30112 orig_conv.inner = (void*)(orig & (~1));
30113 orig_conv.is_owned = false;
30114 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
30115 uint64_t ret_ref = 0;
30116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30118 ret_ref = (uint64_t)ret_var.inner;
30119 if (ret_var.is_owned) {
30125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30126 LDKChannelInfo obj_conv;
30127 obj_conv.inner = (void*)(obj & (~1));
30128 obj_conv.is_owned = false;
30129 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
30130 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30131 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30132 CVec_u8Z_free(ret_var);
30136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30137 LDKu8slice ser_ref;
30138 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30139 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30140 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
30141 *ret_conv = ChannelInfo_read(ser_ref);
30142 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30143 return (uint64_t)ret_conv;
30146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30147 LDKRoutingFees this_obj_conv;
30148 this_obj_conv.inner = (void*)(this_obj & (~1));
30149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30150 RoutingFees_free(this_obj_conv);
30153 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30154 LDKRoutingFees this_ptr_conv;
30155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30156 this_ptr_conv.is_owned = false;
30157 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
30161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30162 LDKRoutingFees this_ptr_conv;
30163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30164 this_ptr_conv.is_owned = false;
30165 RoutingFees_set_base_msat(&this_ptr_conv, val);
30168 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
30169 LDKRoutingFees this_ptr_conv;
30170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30171 this_ptr_conv.is_owned = false;
30172 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
30176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30177 LDKRoutingFees this_ptr_conv;
30178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30179 this_ptr_conv.is_owned = false;
30180 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
30183 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) {
30184 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
30185 uint64_t ret_ref = 0;
30186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30188 ret_ref = (uint64_t)ret_var.inner;
30189 if (ret_var.is_owned) {
30195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30196 LDKRoutingFees a_conv;
30197 a_conv.inner = (void*)(a & (~1));
30198 a_conv.is_owned = false;
30199 LDKRoutingFees b_conv;
30200 b_conv.inner = (void*)(b & (~1));
30201 b_conv.is_owned = false;
30202 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
30206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30207 LDKRoutingFees orig_conv;
30208 orig_conv.inner = (void*)(orig & (~1));
30209 orig_conv.is_owned = false;
30210 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
30211 uint64_t ret_ref = 0;
30212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30214 ret_ref = (uint64_t)ret_var.inner;
30215 if (ret_var.is_owned) {
30221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
30222 LDKRoutingFees o_conv;
30223 o_conv.inner = (void*)(o & (~1));
30224 o_conv.is_owned = false;
30225 int64_t ret_val = RoutingFees_hash(&o_conv);
30229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
30230 LDKRoutingFees obj_conv;
30231 obj_conv.inner = (void*)(obj & (~1));
30232 obj_conv.is_owned = false;
30233 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
30234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30236 CVec_u8Z_free(ret_var);
30240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30241 LDKu8slice ser_ref;
30242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30244 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
30245 *ret_conv = RoutingFees_read(ser_ref);
30246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30247 return (uint64_t)ret_conv;
30250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30251 LDKNodeAnnouncementInfo this_obj_conv;
30252 this_obj_conv.inner = (void*)(this_obj & (~1));
30253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30254 NodeAnnouncementInfo_free(this_obj_conv);
30257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30258 LDKNodeAnnouncementInfo this_ptr_conv;
30259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30260 this_ptr_conv.is_owned = false;
30261 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
30262 uint64_t ret_ref = 0;
30263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30265 ret_ref = (uint64_t)ret_var.inner;
30266 if (ret_var.is_owned) {
30272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30273 LDKNodeAnnouncementInfo this_ptr_conv;
30274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30275 this_ptr_conv.is_owned = false;
30276 LDKNodeFeatures val_conv;
30277 val_conv.inner = (void*)(val & (~1));
30278 val_conv.is_owned = (val & 1) || (val == 0);
30279 val_conv = NodeFeatures_clone(&val_conv);
30280 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
30283 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
30284 LDKNodeAnnouncementInfo this_ptr_conv;
30285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30286 this_ptr_conv.is_owned = false;
30287 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
30291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30292 LDKNodeAnnouncementInfo this_ptr_conv;
30293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30294 this_ptr_conv.is_owned = false;
30295 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
30298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
30299 LDKNodeAnnouncementInfo this_ptr_conv;
30300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30301 this_ptr_conv.is_owned = false;
30302 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
30303 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
30307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30308 LDKNodeAnnouncementInfo this_ptr_conv;
30309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30310 this_ptr_conv.is_owned = false;
30311 LDKThreeBytes val_ref;
30312 CHECK((*env)->GetArrayLength(env, val) == 3);
30313 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
30314 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
30317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
30318 LDKNodeAnnouncementInfo this_ptr_conv;
30319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30320 this_ptr_conv.is_owned = false;
30321 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
30326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30327 LDKNodeAnnouncementInfo this_ptr_conv;
30328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30329 this_ptr_conv.is_owned = false;
30330 LDKThirtyTwoBytes val_ref;
30331 CHECK((*env)->GetArrayLength(env, val) == 32);
30332 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30333 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
30336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30337 LDKNodeAnnouncementInfo this_ptr_conv;
30338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30339 this_ptr_conv.is_owned = false;
30340 LDKCVec_NetAddressZ val_constr;
30341 val_constr.datalen = (*env)->GetArrayLength(env, val);
30342 if (val_constr.datalen > 0)
30343 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30345 val_constr.data = NULL;
30346 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30347 for (size_t m = 0; m < val_constr.datalen; m++) {
30348 int64_t val_conv_12 = val_vals[m];
30349 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
30350 CHECK_ACCESS(val_conv_12_ptr);
30351 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30352 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
30353 val_constr.data[m] = val_conv_12_conv;
30355 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30356 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
30359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
30360 LDKNodeAnnouncementInfo this_ptr_conv;
30361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30362 this_ptr_conv.is_owned = false;
30363 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
30364 uint64_t ret_ref = 0;
30365 if ((uint64_t)ret_var.inner > 4096) {
30366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30368 ret_ref = (uint64_t)ret_var.inner;
30369 if (ret_var.is_owned) {
30376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30377 LDKNodeAnnouncementInfo this_ptr_conv;
30378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30379 this_ptr_conv.is_owned = false;
30380 LDKNodeAnnouncement val_conv;
30381 val_conv.inner = (void*)(val & (~1));
30382 val_conv.is_owned = (val & 1) || (val == 0);
30383 val_conv = NodeAnnouncement_clone(&val_conv);
30384 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
30387 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) {
30388 LDKNodeFeatures features_arg_conv;
30389 features_arg_conv.inner = (void*)(features_arg & (~1));
30390 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
30391 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
30392 LDKThreeBytes rgb_arg_ref;
30393 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
30394 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
30395 LDKThirtyTwoBytes alias_arg_ref;
30396 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
30397 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
30398 LDKCVec_NetAddressZ addresses_arg_constr;
30399 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
30400 if (addresses_arg_constr.datalen > 0)
30401 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30403 addresses_arg_constr.data = NULL;
30404 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
30405 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
30406 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
30407 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
30408 CHECK_ACCESS(addresses_arg_conv_12_ptr);
30409 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
30410 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
30412 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
30413 LDKNodeAnnouncement announcement_message_arg_conv;
30414 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
30415 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
30416 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
30417 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
30418 uint64_t ret_ref = 0;
30419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30421 ret_ref = (uint64_t)ret_var.inner;
30422 if (ret_var.is_owned) {
30428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30429 LDKNodeAnnouncementInfo orig_conv;
30430 orig_conv.inner = (void*)(orig & (~1));
30431 orig_conv.is_owned = false;
30432 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
30433 uint64_t ret_ref = 0;
30434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30436 ret_ref = (uint64_t)ret_var.inner;
30437 if (ret_var.is_owned) {
30443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30444 LDKNodeAnnouncementInfo obj_conv;
30445 obj_conv.inner = (void*)(obj & (~1));
30446 obj_conv.is_owned = false;
30447 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
30448 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30449 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30450 CVec_u8Z_free(ret_var);
30454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30455 LDKu8slice ser_ref;
30456 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30457 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30458 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
30459 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
30460 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30461 return (uint64_t)ret_conv;
30464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30465 LDKNodeInfo this_obj_conv;
30466 this_obj_conv.inner = (void*)(this_obj & (~1));
30467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30468 NodeInfo_free(this_obj_conv);
30471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30472 LDKNodeInfo this_ptr_conv;
30473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30474 this_ptr_conv.is_owned = false;
30475 LDKCVec_u64Z val_constr;
30476 val_constr.datalen = (*env)->GetArrayLength(env, val);
30477 if (val_constr.datalen > 0)
30478 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30480 val_constr.data = NULL;
30481 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30482 for (size_t g = 0; g < val_constr.datalen; g++) {
30483 int64_t val_conv_6 = val_vals[g];
30484 val_constr.data[g] = val_conv_6;
30486 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30487 NodeInfo_set_channels(&this_ptr_conv, val_constr);
30490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
30491 LDKNodeInfo this_ptr_conv;
30492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30493 this_ptr_conv.is_owned = false;
30494 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
30495 uint64_t ret_ref = 0;
30496 if ((uint64_t)ret_var.inner > 4096) {
30497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30499 ret_ref = (uint64_t)ret_var.inner;
30500 if (ret_var.is_owned) {
30507 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) {
30508 LDKNodeInfo this_ptr_conv;
30509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30510 this_ptr_conv.is_owned = false;
30511 LDKRoutingFees val_conv;
30512 val_conv.inner = (void*)(val & (~1));
30513 val_conv.is_owned = (val & 1) || (val == 0);
30514 val_conv = RoutingFees_clone(&val_conv);
30515 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
30518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
30519 LDKNodeInfo this_ptr_conv;
30520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30521 this_ptr_conv.is_owned = false;
30522 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
30523 uint64_t ret_ref = 0;
30524 if ((uint64_t)ret_var.inner > 4096) {
30525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30527 ret_ref = (uint64_t)ret_var.inner;
30528 if (ret_var.is_owned) {
30535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30536 LDKNodeInfo this_ptr_conv;
30537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30538 this_ptr_conv.is_owned = false;
30539 LDKNodeAnnouncementInfo val_conv;
30540 val_conv.inner = (void*)(val & (~1));
30541 val_conv.is_owned = (val & 1) || (val == 0);
30542 val_conv = NodeAnnouncementInfo_clone(&val_conv);
30543 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
30546 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) {
30547 LDKCVec_u64Z channels_arg_constr;
30548 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
30549 if (channels_arg_constr.datalen > 0)
30550 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30552 channels_arg_constr.data = NULL;
30553 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
30554 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
30555 int64_t channels_arg_conv_6 = channels_arg_vals[g];
30556 channels_arg_constr.data[g] = channels_arg_conv_6;
30558 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
30559 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
30560 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
30561 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
30562 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
30563 LDKNodeAnnouncementInfo announcement_info_arg_conv;
30564 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
30565 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
30566 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
30567 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
30568 uint64_t ret_ref = 0;
30569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30571 ret_ref = (uint64_t)ret_var.inner;
30572 if (ret_var.is_owned) {
30578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30579 LDKNodeInfo orig_conv;
30580 orig_conv.inner = (void*)(orig & (~1));
30581 orig_conv.is_owned = false;
30582 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
30583 uint64_t ret_ref = 0;
30584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30586 ret_ref = (uint64_t)ret_var.inner;
30587 if (ret_var.is_owned) {
30593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30594 LDKNodeInfo obj_conv;
30595 obj_conv.inner = (void*)(obj & (~1));
30596 obj_conv.is_owned = false;
30597 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
30598 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30599 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30600 CVec_u8Z_free(ret_var);
30604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30605 LDKu8slice ser_ref;
30606 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30607 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30608 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
30609 *ret_conv = NodeInfo_read(ser_ref);
30610 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30611 return (uint64_t)ret_conv;
30614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
30615 LDKNetworkGraph obj_conv;
30616 obj_conv.inner = (void*)(obj & (~1));
30617 obj_conv.is_owned = false;
30618 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
30619 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30620 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30621 CVec_u8Z_free(ret_var);
30625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30626 LDKu8slice ser_ref;
30627 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30628 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30629 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
30630 *ret_conv = NetworkGraph_read(ser_ref);
30631 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30632 return (uint64_t)ret_conv;
30635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
30636 LDKThirtyTwoBytes genesis_hash_ref;
30637 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
30638 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
30639 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
30640 uint64_t ret_ref = 0;
30641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30643 ret_ref = (uint64_t)ret_var.inner;
30644 if (ret_var.is_owned) {
30650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
30651 LDKNetworkGraph this_arg_conv;
30652 this_arg_conv.inner = (void*)(this_arg & (~1));
30653 this_arg_conv.is_owned = false;
30654 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
30655 uint64_t ret_ref = 0;
30656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30658 ret_ref = (uint64_t)ret_var.inner;
30659 if (ret_var.is_owned) {
30665 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) {
30666 LDKNetworkGraph this_arg_conv;
30667 this_arg_conv.inner = (void*)(this_arg & (~1));
30668 this_arg_conv.is_owned = false;
30669 LDKNodeAnnouncement msg_conv;
30670 msg_conv.inner = (void*)(msg & (~1));
30671 msg_conv.is_owned = false;
30672 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30673 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
30674 return (uint64_t)ret_conv;
30677 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) {
30678 LDKNetworkGraph this_arg_conv;
30679 this_arg_conv.inner = (void*)(this_arg & (~1));
30680 this_arg_conv.is_owned = false;
30681 LDKUnsignedNodeAnnouncement msg_conv;
30682 msg_conv.inner = (void*)(msg & (~1));
30683 msg_conv.is_owned = false;
30684 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30685 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
30686 return (uint64_t)ret_conv;
30689 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) {
30690 LDKNetworkGraph this_arg_conv;
30691 this_arg_conv.inner = (void*)(this_arg & (~1));
30692 this_arg_conv.is_owned = false;
30693 LDKChannelAnnouncement msg_conv;
30694 msg_conv.inner = (void*)(msg & (~1));
30695 msg_conv.is_owned = false;
30696 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
30697 CHECK_ACCESS(chain_access_ptr);
30698 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
30699 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
30700 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
30701 // Manually implement clone for Java trait instances
30702 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
30703 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30704 LDKAccess_JCalls_cloned(&chain_access_conv.some);
30707 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30708 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
30709 return (uint64_t)ret_conv;
30712 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) {
30713 LDKNetworkGraph this_arg_conv;
30714 this_arg_conv.inner = (void*)(this_arg & (~1));
30715 this_arg_conv.is_owned = false;
30716 LDKUnsignedChannelAnnouncement msg_conv;
30717 msg_conv.inner = (void*)(msg & (~1));
30718 msg_conv.is_owned = false;
30719 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
30720 CHECK_ACCESS(chain_access_ptr);
30721 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
30722 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
30723 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
30724 // Manually implement clone for Java trait instances
30725 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
30726 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30727 LDKAccess_JCalls_cloned(&chain_access_conv.some);
30730 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30731 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
30732 return (uint64_t)ret_conv;
30735 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) {
30736 LDKNetworkGraph this_arg_conv;
30737 this_arg_conv.inner = (void*)(this_arg & (~1));
30738 this_arg_conv.is_owned = false;
30739 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
30742 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) {
30743 LDKNetworkGraph this_arg_conv;
30744 this_arg_conv.inner = (void*)(this_arg & (~1));
30745 this_arg_conv.is_owned = false;
30746 LDKPublicKey _node_id_ref;
30747 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
30748 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
30749 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
30752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
30753 LDKNetworkGraph this_arg_conv;
30754 this_arg_conv.inner = (void*)(this_arg & (~1));
30755 this_arg_conv.is_owned = false;
30756 LDKChannelUpdate msg_conv;
30757 msg_conv.inner = (void*)(msg & (~1));
30758 msg_conv.is_owned = false;
30759 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30760 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
30761 return (uint64_t)ret_conv;
30764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
30765 LDKNetworkGraph this_arg_conv;
30766 this_arg_conv.inner = (void*)(this_arg & (~1));
30767 this_arg_conv.is_owned = false;
30768 LDKUnsignedChannelUpdate msg_conv;
30769 msg_conv.inner = (void*)(msg & (~1));
30770 msg_conv.is_owned = false;
30771 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
30772 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
30773 return (uint64_t)ret_conv;
30776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
30777 LDKReadOnlyNetworkGraph this_arg_conv;
30778 this_arg_conv.inner = (void*)(this_arg & (~1));
30779 this_arg_conv.is_owned = false;
30780 LDKPublicKey pubkey_ref;
30781 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
30782 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
30783 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
30784 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
30785 uint64_t ret_ref = (uint64_t)ret_copy;
30789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30790 LDKRouteHop this_obj_conv;
30791 this_obj_conv.inner = (void*)(this_obj & (~1));
30792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30793 RouteHop_free(this_obj_conv);
30796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30797 LDKRouteHop this_ptr_conv;
30798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30799 this_ptr_conv.is_owned = false;
30800 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30801 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
30805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30806 LDKRouteHop this_ptr_conv;
30807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30808 this_ptr_conv.is_owned = false;
30809 LDKPublicKey val_ref;
30810 CHECK((*env)->GetArrayLength(env, val) == 33);
30811 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30812 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
30815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30816 LDKRouteHop this_ptr_conv;
30817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30818 this_ptr_conv.is_owned = false;
30819 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
30820 uint64_t ret_ref = 0;
30821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30823 ret_ref = (uint64_t)ret_var.inner;
30824 if (ret_var.is_owned) {
30830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30831 LDKRouteHop this_ptr_conv;
30832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30833 this_ptr_conv.is_owned = false;
30834 LDKNodeFeatures val_conv;
30835 val_conv.inner = (void*)(val & (~1));
30836 val_conv.is_owned = (val & 1) || (val == 0);
30837 val_conv = NodeFeatures_clone(&val_conv);
30838 RouteHop_set_node_features(&this_ptr_conv, val_conv);
30841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30842 LDKRouteHop this_ptr_conv;
30843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30844 this_ptr_conv.is_owned = false;
30845 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
30849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30850 LDKRouteHop this_ptr_conv;
30851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30852 this_ptr_conv.is_owned = false;
30853 RouteHop_set_short_channel_id(&this_ptr_conv, val);
30856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30857 LDKRouteHop this_ptr_conv;
30858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30859 this_ptr_conv.is_owned = false;
30860 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
30861 uint64_t ret_ref = 0;
30862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30864 ret_ref = (uint64_t)ret_var.inner;
30865 if (ret_var.is_owned) {
30871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30872 LDKRouteHop this_ptr_conv;
30873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30874 this_ptr_conv.is_owned = false;
30875 LDKChannelFeatures val_conv;
30876 val_conv.inner = (void*)(val & (~1));
30877 val_conv.is_owned = (val & 1) || (val == 0);
30878 val_conv = ChannelFeatures_clone(&val_conv);
30879 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30883 LDKRouteHop this_ptr_conv;
30884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30885 this_ptr_conv.is_owned = false;
30886 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
30890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30891 LDKRouteHop this_ptr_conv;
30892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30893 this_ptr_conv.is_owned = false;
30894 RouteHop_set_fee_msat(&this_ptr_conv, val);
30897 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
30898 LDKRouteHop this_ptr_conv;
30899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30900 this_ptr_conv.is_owned = false;
30901 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
30905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30906 LDKRouteHop this_ptr_conv;
30907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30908 this_ptr_conv.is_owned = false;
30909 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
30912 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) {
30913 LDKPublicKey pubkey_arg_ref;
30914 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
30915 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
30916 LDKNodeFeatures node_features_arg_conv;
30917 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
30918 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
30919 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
30920 LDKChannelFeatures channel_features_arg_conv;
30921 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
30922 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
30923 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
30924 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);
30925 uint64_t ret_ref = 0;
30926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30928 ret_ref = (uint64_t)ret_var.inner;
30929 if (ret_var.is_owned) {
30935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30936 LDKRouteHop orig_conv;
30937 orig_conv.inner = (void*)(orig & (~1));
30938 orig_conv.is_owned = false;
30939 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
30940 uint64_t ret_ref = 0;
30941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30943 ret_ref = (uint64_t)ret_var.inner;
30944 if (ret_var.is_owned) {
30950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
30951 LDKRouteHop o_conv;
30952 o_conv.inner = (void*)(o & (~1));
30953 o_conv.is_owned = false;
30954 int64_t ret_val = RouteHop_hash(&o_conv);
30958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
30959 LDKRouteHop a_conv;
30960 a_conv.inner = (void*)(a & (~1));
30961 a_conv.is_owned = false;
30962 LDKRouteHop b_conv;
30963 b_conv.inner = (void*)(b & (~1));
30964 b_conv.is_owned = false;
30965 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
30969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
30970 LDKRouteHop obj_conv;
30971 obj_conv.inner = (void*)(obj & (~1));
30972 obj_conv.is_owned = false;
30973 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
30974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30976 CVec_u8Z_free(ret_var);
30980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30981 LDKu8slice ser_ref;
30982 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30983 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30984 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
30985 *ret_conv = RouteHop_read(ser_ref);
30986 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30987 return (uint64_t)ret_conv;
30990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30991 LDKRoute this_obj_conv;
30992 this_obj_conv.inner = (void*)(this_obj & (~1));
30993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30994 Route_free(this_obj_conv);
30997 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
30998 LDKRoute this_ptr_conv;
30999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31000 this_ptr_conv.is_owned = false;
31001 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
31002 jobjectArray ret_arr = NULL;
31003 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
31005 for (size_t m = 0; m < ret_var.datalen; m++) {
31006 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
31007 int64_tArray ret_conv_12_arr = NULL;
31008 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
31009 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
31010 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
31011 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
31012 uint64_t ret_conv_12_conv_10_ref = 0;
31013 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31014 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31015 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
31016 if (ret_conv_12_conv_10_var.is_owned) {
31017 ret_conv_12_conv_10_ref |= 1;
31019 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
31021 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
31022 FREE(ret_conv_12_var.data);
31023 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
31026 FREE(ret_var.data);
31030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
31031 LDKRoute this_ptr_conv;
31032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31033 this_ptr_conv.is_owned = false;
31034 LDKCVec_CVec_RouteHopZZ val_constr;
31035 val_constr.datalen = (*env)->GetArrayLength(env, val);
31036 if (val_constr.datalen > 0)
31037 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
31039 val_constr.data = NULL;
31040 for (size_t m = 0; m < val_constr.datalen; m++) {
31041 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
31042 LDKCVec_RouteHopZ val_conv_12_constr;
31043 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
31044 if (val_conv_12_constr.datalen > 0)
31045 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
31047 val_conv_12_constr.data = NULL;
31048 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
31049 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
31050 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
31051 LDKRouteHop val_conv_12_conv_10_conv;
31052 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
31053 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
31054 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
31055 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
31057 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
31058 val_constr.data[m] = val_conv_12_constr;
31060 Route_set_paths(&this_ptr_conv, val_constr);
31063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
31064 LDKRoute this_ptr_conv;
31065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31066 this_ptr_conv.is_owned = false;
31067 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
31068 uint64_t ret_ref = 0;
31069 if ((uint64_t)ret_var.inner > 4096) {
31070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31072 ret_ref = (uint64_t)ret_var.inner;
31073 if (ret_var.is_owned) {
31080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31081 LDKRoute this_ptr_conv;
31082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31083 this_ptr_conv.is_owned = false;
31085 val_conv.inner = (void*)(val & (~1));
31086 val_conv.is_owned = (val & 1) || (val == 0);
31087 val_conv = Payee_clone(&val_conv);
31088 Route_set_payee(&this_ptr_conv, val_conv);
31091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) {
31092 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
31093 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
31094 if (paths_arg_constr.datalen > 0)
31095 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
31097 paths_arg_constr.data = NULL;
31098 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
31099 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
31100 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
31101 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
31102 if (paths_arg_conv_12_constr.datalen > 0)
31103 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
31105 paths_arg_conv_12_constr.data = NULL;
31106 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
31107 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
31108 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
31109 LDKRouteHop paths_arg_conv_12_conv_10_conv;
31110 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
31111 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
31112 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
31113 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
31115 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
31116 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
31118 LDKPayee payee_arg_conv;
31119 payee_arg_conv.inner = (void*)(payee_arg & (~1));
31120 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
31121 payee_arg_conv = Payee_clone(&payee_arg_conv);
31122 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
31123 uint64_t ret_ref = 0;
31124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31126 ret_ref = (uint64_t)ret_var.inner;
31127 if (ret_var.is_owned) {
31133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31134 LDKRoute orig_conv;
31135 orig_conv.inner = (void*)(orig & (~1));
31136 orig_conv.is_owned = false;
31137 LDKRoute ret_var = Route_clone(&orig_conv);
31138 uint64_t ret_ref = 0;
31139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31141 ret_ref = (uint64_t)ret_var.inner;
31142 if (ret_var.is_owned) {
31148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
31150 o_conv.inner = (void*)(o & (~1));
31151 o_conv.is_owned = false;
31152 int64_t ret_val = Route_hash(&o_conv);
31156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31158 a_conv.inner = (void*)(a & (~1));
31159 a_conv.is_owned = false;
31161 b_conv.inner = (void*)(b & (~1));
31162 b_conv.is_owned = false;
31163 jboolean ret_val = Route_eq(&a_conv, &b_conv);
31167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
31168 LDKRoute this_arg_conv;
31169 this_arg_conv.inner = (void*)(this_arg & (~1));
31170 this_arg_conv.is_owned = false;
31171 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
31175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
31176 LDKRoute this_arg_conv;
31177 this_arg_conv.inner = (void*)(this_arg & (~1));
31178 this_arg_conv.is_owned = false;
31179 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
31183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
31185 obj_conv.inner = (void*)(obj & (~1));
31186 obj_conv.is_owned = false;
31187 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
31188 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31189 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31190 CVec_u8Z_free(ret_var);
31194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31195 LDKu8slice ser_ref;
31196 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31197 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31198 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
31199 *ret_conv = Route_read(ser_ref);
31200 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31201 return (uint64_t)ret_conv;
31204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31205 LDKRouteParameters this_obj_conv;
31206 this_obj_conv.inner = (void*)(this_obj & (~1));
31207 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31208 RouteParameters_free(this_obj_conv);
31211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
31212 LDKRouteParameters this_ptr_conv;
31213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31214 this_ptr_conv.is_owned = false;
31215 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
31216 uint64_t ret_ref = 0;
31217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31219 ret_ref = (uint64_t)ret_var.inner;
31220 if (ret_var.is_owned) {
31226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31227 LDKRouteParameters this_ptr_conv;
31228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31229 this_ptr_conv.is_owned = false;
31231 val_conv.inner = (void*)(val & (~1));
31232 val_conv.is_owned = (val & 1) || (val == 0);
31233 val_conv = Payee_clone(&val_conv);
31234 RouteParameters_set_payee(&this_ptr_conv, val_conv);
31237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31238 LDKRouteParameters this_ptr_conv;
31239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31240 this_ptr_conv.is_owned = false;
31241 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
31245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31246 LDKRouteParameters this_ptr_conv;
31247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31248 this_ptr_conv.is_owned = false;
31249 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
31252 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
31253 LDKRouteParameters this_ptr_conv;
31254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31255 this_ptr_conv.is_owned = false;
31256 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
31260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31261 LDKRouteParameters this_ptr_conv;
31262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31263 this_ptr_conv.is_owned = false;
31264 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
31267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
31268 LDKPayee payee_arg_conv;
31269 payee_arg_conv.inner = (void*)(payee_arg & (~1));
31270 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
31271 payee_arg_conv = Payee_clone(&payee_arg_conv);
31272 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
31273 uint64_t ret_ref = 0;
31274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31276 ret_ref = (uint64_t)ret_var.inner;
31277 if (ret_var.is_owned) {
31283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31284 LDKRouteParameters orig_conv;
31285 orig_conv.inner = (void*)(orig & (~1));
31286 orig_conv.is_owned = false;
31287 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
31288 uint64_t ret_ref = 0;
31289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31291 ret_ref = (uint64_t)ret_var.inner;
31292 if (ret_var.is_owned) {
31298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
31299 LDKRouteParameters obj_conv;
31300 obj_conv.inner = (void*)(obj & (~1));
31301 obj_conv.is_owned = false;
31302 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
31303 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31304 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31305 CVec_u8Z_free(ret_var);
31309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31310 LDKu8slice ser_ref;
31311 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31312 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31313 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
31314 *ret_conv = RouteParameters_read(ser_ref);
31315 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31316 return (uint64_t)ret_conv;
31319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31320 LDKPayee this_obj_conv;
31321 this_obj_conv.inner = (void*)(this_obj & (~1));
31322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31323 Payee_free(this_obj_conv);
31326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31327 LDKPayee this_ptr_conv;
31328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31329 this_ptr_conv.is_owned = false;
31330 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form);
31335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31336 LDKPayee this_ptr_conv;
31337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31338 this_ptr_conv.is_owned = false;
31339 LDKPublicKey val_ref;
31340 CHECK((*env)->GetArrayLength(env, val) == 33);
31341 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31342 Payee_set_pubkey(&this_ptr_conv, val_ref);
31345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
31346 LDKPayee this_ptr_conv;
31347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31348 this_ptr_conv.is_owned = false;
31349 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
31350 uint64_t ret_ref = 0;
31351 if ((uint64_t)ret_var.inner > 4096) {
31352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31354 ret_ref = (uint64_t)ret_var.inner;
31355 if (ret_var.is_owned) {
31362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31363 LDKPayee this_ptr_conv;
31364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31365 this_ptr_conv.is_owned = false;
31366 LDKInvoiceFeatures val_conv;
31367 val_conv.inner = (void*)(val & (~1));
31368 val_conv.is_owned = (val & 1) || (val == 0);
31369 val_conv = InvoiceFeatures_clone(&val_conv);
31370 Payee_set_features(&this_ptr_conv, val_conv);
31373 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
31374 LDKPayee this_ptr_conv;
31375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31376 this_ptr_conv.is_owned = false;
31377 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
31378 int64_tArray ret_arr = NULL;
31379 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31380 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31381 for (size_t l = 0; l < ret_var.datalen; l++) {
31382 LDKRouteHint ret_conv_11_var = ret_var.data[l];
31383 uint64_t ret_conv_11_ref = 0;
31384 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31385 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31386 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
31387 if (ret_conv_11_var.is_owned) {
31388 ret_conv_11_ref |= 1;
31390 ret_arr_ptr[l] = ret_conv_11_ref;
31392 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31393 FREE(ret_var.data);
31397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31398 LDKPayee this_ptr_conv;
31399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31400 this_ptr_conv.is_owned = false;
31401 LDKCVec_RouteHintZ val_constr;
31402 val_constr.datalen = (*env)->GetArrayLength(env, val);
31403 if (val_constr.datalen > 0)
31404 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
31406 val_constr.data = NULL;
31407 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31408 for (size_t l = 0; l < val_constr.datalen; l++) {
31409 int64_t val_conv_11 = val_vals[l];
31410 LDKRouteHint val_conv_11_conv;
31411 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
31412 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
31413 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
31414 val_constr.data[l] = val_conv_11_conv;
31416 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31417 Payee_set_route_hints(&this_ptr_conv, val_constr);
31420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
31421 LDKPayee this_ptr_conv;
31422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31423 this_ptr_conv.is_owned = false;
31424 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31425 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
31426 uint64_t ret_ref = (uint64_t)ret_copy;
31430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31431 LDKPayee this_ptr_conv;
31432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31433 this_ptr_conv.is_owned = false;
31434 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31435 CHECK_ACCESS(val_ptr);
31436 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31437 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31438 Payee_set_expiry_time(&this_ptr_conv, val_conv);
31441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) {
31442 LDKPublicKey pubkey_arg_ref;
31443 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
31444 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
31445 LDKInvoiceFeatures features_arg_conv;
31446 features_arg_conv.inner = (void*)(features_arg & (~1));
31447 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
31448 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
31449 LDKCVec_RouteHintZ route_hints_arg_constr;
31450 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
31451 if (route_hints_arg_constr.datalen > 0)
31452 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
31454 route_hints_arg_constr.data = NULL;
31455 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
31456 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
31457 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
31458 LDKRouteHint route_hints_arg_conv_11_conv;
31459 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
31460 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
31461 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
31462 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
31464 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
31465 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
31466 CHECK_ACCESS(expiry_time_arg_ptr);
31467 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
31468 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
31469 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
31470 uint64_t ret_ref = 0;
31471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31473 ret_ref = (uint64_t)ret_var.inner;
31474 if (ret_var.is_owned) {
31480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31481 LDKPayee orig_conv;
31482 orig_conv.inner = (void*)(orig & (~1));
31483 orig_conv.is_owned = false;
31484 LDKPayee ret_var = Payee_clone(&orig_conv);
31485 uint64_t ret_ref = 0;
31486 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31487 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31488 ret_ref = (uint64_t)ret_var.inner;
31489 if (ret_var.is_owned) {
31495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
31497 o_conv.inner = (void*)(o & (~1));
31498 o_conv.is_owned = false;
31499 int64_t ret_val = Payee_hash(&o_conv);
31503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31505 a_conv.inner = (void*)(a & (~1));
31506 a_conv.is_owned = false;
31508 b_conv.inner = (void*)(b & (~1));
31509 b_conv.is_owned = false;
31510 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
31514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) {
31516 obj_conv.inner = (void*)(obj & (~1));
31517 obj_conv.is_owned = false;
31518 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
31519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31521 CVec_u8Z_free(ret_var);
31525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31526 LDKu8slice ser_ref;
31527 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31528 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31529 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
31530 *ret_conv = Payee_read(ser_ref);
31531 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31532 return (uint64_t)ret_conv;
31535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) {
31536 LDKPublicKey pubkey_ref;
31537 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
31538 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
31539 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
31540 uint64_t ret_ref = 0;
31541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31543 ret_ref = (uint64_t)ret_var.inner;
31544 if (ret_var.is_owned) {
31550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) {
31551 LDKPublicKey pubkey_ref;
31552 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
31553 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
31554 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
31555 uint64_t ret_ref = 0;
31556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31558 ret_ref = (uint64_t)ret_var.inner;
31559 if (ret_var.is_owned) {
31565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31566 LDKRouteHint this_obj_conv;
31567 this_obj_conv.inner = (void*)(this_obj & (~1));
31568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31569 RouteHint_free(this_obj_conv);
31572 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
31573 LDKRouteHint this_ptr_conv;
31574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31575 this_ptr_conv.is_owned = false;
31576 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
31577 int64_tArray ret_arr = NULL;
31578 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31579 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31580 for (size_t o = 0; o < ret_var.datalen; o++) {
31581 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
31582 uint64_t ret_conv_14_ref = 0;
31583 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31584 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31585 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
31586 if (ret_conv_14_var.is_owned) {
31587 ret_conv_14_ref |= 1;
31589 ret_arr_ptr[o] = ret_conv_14_ref;
31591 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31592 FREE(ret_var.data);
31596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31597 LDKRouteHint this_ptr_conv;
31598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31599 this_ptr_conv.is_owned = false;
31600 LDKCVec_RouteHintHopZ val_constr;
31601 val_constr.datalen = (*env)->GetArrayLength(env, val);
31602 if (val_constr.datalen > 0)
31603 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
31605 val_constr.data = NULL;
31606 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31607 for (size_t o = 0; o < val_constr.datalen; o++) {
31608 int64_t val_conv_14 = val_vals[o];
31609 LDKRouteHintHop val_conv_14_conv;
31610 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
31611 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
31612 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
31613 val_constr.data[o] = val_conv_14_conv;
31615 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31616 RouteHint_set_a(&this_ptr_conv, val_constr);
31619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
31620 LDKCVec_RouteHintHopZ a_arg_constr;
31621 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
31622 if (a_arg_constr.datalen > 0)
31623 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
31625 a_arg_constr.data = NULL;
31626 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
31627 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
31628 int64_t a_arg_conv_14 = a_arg_vals[o];
31629 LDKRouteHintHop a_arg_conv_14_conv;
31630 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
31631 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
31632 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
31633 a_arg_constr.data[o] = a_arg_conv_14_conv;
31635 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
31636 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
31637 uint64_t ret_ref = 0;
31638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31640 ret_ref = (uint64_t)ret_var.inner;
31641 if (ret_var.is_owned) {
31647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31648 LDKRouteHint orig_conv;
31649 orig_conv.inner = (void*)(orig & (~1));
31650 orig_conv.is_owned = false;
31651 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
31652 uint64_t ret_ref = 0;
31653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31655 ret_ref = (uint64_t)ret_var.inner;
31656 if (ret_var.is_owned) {
31662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
31663 LDKRouteHint o_conv;
31664 o_conv.inner = (void*)(o & (~1));
31665 o_conv.is_owned = false;
31666 int64_t ret_val = RouteHint_hash(&o_conv);
31670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31671 LDKRouteHint a_conv;
31672 a_conv.inner = (void*)(a & (~1));
31673 a_conv.is_owned = false;
31674 LDKRouteHint b_conv;
31675 b_conv.inner = (void*)(b & (~1));
31676 b_conv.is_owned = false;
31677 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
31681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
31682 LDKRouteHint obj_conv;
31683 obj_conv.inner = (void*)(obj & (~1));
31684 obj_conv.is_owned = false;
31685 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
31686 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31687 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31688 CVec_u8Z_free(ret_var);
31692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31693 LDKu8slice ser_ref;
31694 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31695 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31696 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
31697 *ret_conv = RouteHint_read(ser_ref);
31698 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31699 return (uint64_t)ret_conv;
31702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31703 LDKRouteHintHop this_obj_conv;
31704 this_obj_conv.inner = (void*)(this_obj & (~1));
31705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31706 RouteHintHop_free(this_obj_conv);
31709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31710 LDKRouteHintHop this_ptr_conv;
31711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31712 this_ptr_conv.is_owned = false;
31713 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31714 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
31718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31719 LDKRouteHintHop this_ptr_conv;
31720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31721 this_ptr_conv.is_owned = false;
31722 LDKPublicKey val_ref;
31723 CHECK((*env)->GetArrayLength(env, val) == 33);
31724 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31725 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
31728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31729 LDKRouteHintHop this_ptr_conv;
31730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31731 this_ptr_conv.is_owned = false;
31732 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
31736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31737 LDKRouteHintHop this_ptr_conv;
31738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31739 this_ptr_conv.is_owned = false;
31740 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
31743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
31744 LDKRouteHintHop this_ptr_conv;
31745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31746 this_ptr_conv.is_owned = false;
31747 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
31748 uint64_t ret_ref = 0;
31749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31751 ret_ref = (uint64_t)ret_var.inner;
31752 if (ret_var.is_owned) {
31758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31759 LDKRouteHintHop this_ptr_conv;
31760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31761 this_ptr_conv.is_owned = false;
31762 LDKRoutingFees val_conv;
31763 val_conv.inner = (void*)(val & (~1));
31764 val_conv.is_owned = (val & 1) || (val == 0);
31765 val_conv = RoutingFees_clone(&val_conv);
31766 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
31769 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
31770 LDKRouteHintHop this_ptr_conv;
31771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31772 this_ptr_conv.is_owned = false;
31773 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
31777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31778 LDKRouteHintHop this_ptr_conv;
31779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31780 this_ptr_conv.is_owned = false;
31781 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
31784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31785 LDKRouteHintHop this_ptr_conv;
31786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31787 this_ptr_conv.is_owned = false;
31788 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31789 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
31790 uint64_t ret_ref = (uint64_t)ret_copy;
31794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31795 LDKRouteHintHop this_ptr_conv;
31796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31797 this_ptr_conv.is_owned = false;
31798 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31799 CHECK_ACCESS(val_ptr);
31800 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31801 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31802 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
31805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31806 LDKRouteHintHop this_ptr_conv;
31807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31808 this_ptr_conv.is_owned = false;
31809 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31810 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
31811 uint64_t ret_ref = (uint64_t)ret_copy;
31815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31816 LDKRouteHintHop this_ptr_conv;
31817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31818 this_ptr_conv.is_owned = false;
31819 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31820 CHECK_ACCESS(val_ptr);
31821 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31822 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31823 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
31826 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) {
31827 LDKPublicKey src_node_id_arg_ref;
31828 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
31829 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
31830 LDKRoutingFees fees_arg_conv;
31831 fees_arg_conv.inner = (void*)(fees_arg & (~1));
31832 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
31833 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
31834 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
31835 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
31836 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
31837 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
31838 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
31839 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
31840 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
31841 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
31842 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);
31843 uint64_t ret_ref = 0;
31844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31846 ret_ref = (uint64_t)ret_var.inner;
31847 if (ret_var.is_owned) {
31853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31854 LDKRouteHintHop orig_conv;
31855 orig_conv.inner = (void*)(orig & (~1));
31856 orig_conv.is_owned = false;
31857 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
31858 uint64_t ret_ref = 0;
31859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31861 ret_ref = (uint64_t)ret_var.inner;
31862 if (ret_var.is_owned) {
31868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
31869 LDKRouteHintHop o_conv;
31870 o_conv.inner = (void*)(o & (~1));
31871 o_conv.is_owned = false;
31872 int64_t ret_val = RouteHintHop_hash(&o_conv);
31876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
31877 LDKRouteHintHop a_conv;
31878 a_conv.inner = (void*)(a & (~1));
31879 a_conv.is_owned = false;
31880 LDKRouteHintHop b_conv;
31881 b_conv.inner = (void*)(b & (~1));
31882 b_conv.is_owned = false;
31883 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
31887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
31888 LDKRouteHintHop obj_conv;
31889 obj_conv.inner = (void*)(obj & (~1));
31890 obj_conv.is_owned = false;
31891 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
31892 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31893 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31894 CVec_u8Z_free(ret_var);
31898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31899 LDKu8slice ser_ref;
31900 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31901 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31902 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
31903 *ret_conv = RouteHintHop_read(ser_ref);
31904 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31905 return (uint64_t)ret_conv;
31908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) {
31909 LDKPublicKey our_node_pubkey_ref;
31910 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
31911 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
31912 LDKRouteParameters params_conv;
31913 params_conv.inner = (void*)(params & (~1));
31914 params_conv.is_owned = false;
31915 LDKNetworkGraph network_conv;
31916 network_conv.inner = (void*)(network & (~1));
31917 network_conv.is_owned = false;
31918 LDKCVec_ChannelDetailsZ first_hops_constr;
31919 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
31920 if (first_hops != NULL) {
31921 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
31922 if (first_hops_constr.datalen > 0)
31923 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
31925 first_hops_constr.data = NULL;
31926 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
31927 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
31928 int64_t first_hops_conv_16 = first_hops_vals[q];
31929 LDKChannelDetails first_hops_conv_16_conv;
31930 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
31931 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
31932 first_hops_constr.data[q] = first_hops_conv_16_conv;
31934 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
31935 first_hops_ptr = &first_hops_constr;
31937 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31938 CHECK_ACCESS(logger_ptr);
31939 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31940 if (logger_conv.free == LDKLogger_JCalls_free) {
31941 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31942 LDKLogger_JCalls_cloned(&logger_conv);
31944 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
31945 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
31946 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
31947 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
31948 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
31949 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
31950 return (uint64_t)ret_conv;
31953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31954 LDKScorer this_obj_conv;
31955 this_obj_conv.inner = (void*)(this_obj & (~1));
31956 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31957 Scorer_free(this_obj_conv);
31960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31961 LDKScoringParameters this_obj_conv;
31962 this_obj_conv.inner = (void*)(this_obj & (~1));
31963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31964 ScoringParameters_free(this_obj_conv);
31967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31968 LDKScoringParameters this_ptr_conv;
31969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31970 this_ptr_conv.is_owned = false;
31971 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
31975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31976 LDKScoringParameters this_ptr_conv;
31977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31978 this_ptr_conv.is_owned = false;
31979 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
31982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31983 LDKScoringParameters this_ptr_conv;
31984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31985 this_ptr_conv.is_owned = false;
31986 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
31990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31991 LDKScoringParameters this_ptr_conv;
31992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31993 this_ptr_conv.is_owned = false;
31994 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
31997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
31998 LDKScoringParameters this_ptr_conv;
31999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32000 this_ptr_conv.is_owned = false;
32001 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
32005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32006 LDKScoringParameters this_ptr_conv;
32007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32008 this_ptr_conv.is_owned = false;
32009 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
32012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) {
32013 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
32014 uint64_t ret_ref = 0;
32015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32017 ret_ref = (uint64_t)ret_var.inner;
32018 if (ret_var.is_owned) {
32024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
32025 LDKScoringParameters obj_conv;
32026 obj_conv.inner = (void*)(obj & (~1));
32027 obj_conv.is_owned = false;
32028 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
32029 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32030 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32031 CVec_u8Z_free(ret_var);
32035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32036 LDKu8slice ser_ref;
32037 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32038 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32039 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
32040 *ret_conv = ScoringParameters_read(ser_ref);
32041 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32042 return (uint64_t)ret_conv;
32045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
32046 LDKScoringParameters params_conv;
32047 params_conv.inner = (void*)(params & (~1));
32048 params_conv.is_owned = (params & 1) || (params == 0);
32049 // Warning: we need a move here but no clone is available for LDKScoringParameters
32050 LDKScorer ret_var = Scorer_new(params_conv);
32051 uint64_t ret_ref = 0;
32052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32054 ret_ref = (uint64_t)ret_var.inner;
32055 if (ret_var.is_owned) {
32061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
32062 LDKScorer ret_var = Scorer_default();
32063 uint64_t ret_ref = 0;
32064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32066 ret_ref = (uint64_t)ret_var.inner;
32067 if (ret_var.is_owned) {
32073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
32074 LDKScoringParameters ret_var = ScoringParameters_default();
32075 uint64_t ret_ref = 0;
32076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32078 ret_ref = (uint64_t)ret_var.inner;
32079 if (ret_var.is_owned) {
32085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
32086 LDKScorer this_arg_conv;
32087 this_arg_conv.inner = (void*)(this_arg & (~1));
32088 this_arg_conv.is_owned = false;
32089 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
32090 *ret_ret = Scorer_as_Score(&this_arg_conv);
32091 return (uint64_t)ret_ret;
32094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
32095 LDKScorer obj_conv;
32096 obj_conv.inner = (void*)(obj & (~1));
32097 obj_conv.is_owned = false;
32098 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
32099 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32100 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32101 CVec_u8Z_free(ret_var);
32105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32106 LDKu8slice ser_ref;
32107 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32108 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32109 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
32110 *ret_conv = Scorer_read(ser_ref);
32111 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32112 return (uint64_t)ret_conv;
32115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32116 LDKFilesystemPersister this_obj_conv;
32117 this_obj_conv.inner = (void*)(this_obj & (~1));
32118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32119 FilesystemPersister_free(this_obj_conv);
32122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
32123 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
32124 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
32125 uint64_t ret_ref = 0;
32126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32128 ret_ref = (uint64_t)ret_var.inner;
32129 if (ret_var.is_owned) {
32135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
32136 LDKFilesystemPersister this_arg_conv;
32137 this_arg_conv.inner = (void*)(this_arg & (~1));
32138 this_arg_conv.is_owned = false;
32139 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
32140 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
32146 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
32147 LDKChannelManager manager_conv;
32148 manager_conv.inner = (void*)(manager & (~1));
32149 manager_conv.is_owned = false;
32150 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
32151 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
32152 return (uint64_t)ret_conv;
32155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
32156 LDKFilesystemPersister this_arg_conv;
32157 this_arg_conv.inner = (void*)(this_arg & (~1));
32158 this_arg_conv.is_owned = false;
32159 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
32160 CHECK_ACCESS(keys_manager_ptr);
32161 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
32162 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
32163 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32164 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
32166 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
32167 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
32168 return (uint64_t)ret_conv;
32171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
32172 LDKFilesystemPersister this_arg_conv;
32173 this_arg_conv.inner = (void*)(this_arg & (~1));
32174 this_arg_conv.is_owned = false;
32175 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
32176 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
32177 return (uint64_t)ret_ret;
32180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32181 LDKBackgroundProcessor this_obj_conv;
32182 this_obj_conv.inner = (void*)(this_obj & (~1));
32183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32184 BackgroundProcessor_free(this_obj_conv);
32187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32188 if ((this_ptr & 1) != 0) return;
32189 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
32190 CHECK_ACCESS(this_ptr_ptr);
32191 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
32192 FREE((void*)this_ptr);
32193 ChannelManagerPersister_free(this_ptr_conv);
32196 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) {
32197 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
32198 CHECK_ACCESS(persister_ptr);
32199 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
32200 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
32201 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32202 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
32204 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
32205 CHECK_ACCESS(event_handler_ptr);
32206 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
32207 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
32208 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32209 LDKEventHandler_JCalls_cloned(&event_handler_conv);
32211 LDKChainMonitor chain_monitor_conv;
32212 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
32213 chain_monitor_conv.is_owned = false;
32214 LDKChannelManager channel_manager_conv;
32215 channel_manager_conv.inner = (void*)(channel_manager & (~1));
32216 channel_manager_conv.is_owned = false;
32217 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
32218 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
32219 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
32220 LDKPeerManager peer_manager_conv;
32221 peer_manager_conv.inner = (void*)(peer_manager & (~1));
32222 peer_manager_conv.is_owned = false;
32223 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
32224 CHECK_ACCESS(logger_ptr);
32225 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32226 if (logger_conv.free == LDKLogger_JCalls_free) {
32227 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32228 LDKLogger_JCalls_cloned(&logger_conv);
32230 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);
32231 uint64_t ret_ref = 0;
32232 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32233 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32234 ret_ref = (uint64_t)ret_var.inner;
32235 if (ret_var.is_owned) {
32241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
32242 LDKBackgroundProcessor this_arg_conv;
32243 this_arg_conv.inner = (void*)(this_arg & (~1));
32244 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
32245 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
32246 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
32247 *ret_conv = BackgroundProcessor_join(this_arg_conv);
32248 return (uint64_t)ret_conv;
32251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
32252 LDKBackgroundProcessor this_arg_conv;
32253 this_arg_conv.inner = (void*)(this_arg & (~1));
32254 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
32255 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
32256 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
32257 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
32258 return (uint64_t)ret_conv;
32261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
32265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32266 LDKInvoice this_obj_conv;
32267 this_obj_conv.inner = (void*)(this_obj & (~1));
32268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32269 Invoice_free(this_obj_conv);
32272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32274 a_conv.inner = (void*)(a & (~1));
32275 a_conv.is_owned = false;
32277 b_conv.inner = (void*)(b & (~1));
32278 b_conv.is_owned = false;
32279 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
32283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32284 LDKInvoice orig_conv;
32285 orig_conv.inner = (void*)(orig & (~1));
32286 orig_conv.is_owned = false;
32287 LDKInvoice ret_var = Invoice_clone(&orig_conv);
32288 uint64_t ret_ref = 0;
32289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32291 ret_ref = (uint64_t)ret_var.inner;
32292 if (ret_var.is_owned) {
32298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32299 LDKSignedRawInvoice this_obj_conv;
32300 this_obj_conv.inner = (void*)(this_obj & (~1));
32301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32302 SignedRawInvoice_free(this_obj_conv);
32305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32306 LDKSignedRawInvoice a_conv;
32307 a_conv.inner = (void*)(a & (~1));
32308 a_conv.is_owned = false;
32309 LDKSignedRawInvoice b_conv;
32310 b_conv.inner = (void*)(b & (~1));
32311 b_conv.is_owned = false;
32312 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
32316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32317 LDKSignedRawInvoice orig_conv;
32318 orig_conv.inner = (void*)(orig & (~1));
32319 orig_conv.is_owned = false;
32320 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
32321 uint64_t ret_ref = 0;
32322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32324 ret_ref = (uint64_t)ret_var.inner;
32325 if (ret_var.is_owned) {
32331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32332 LDKRawInvoice this_obj_conv;
32333 this_obj_conv.inner = (void*)(this_obj & (~1));
32334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32335 RawInvoice_free(this_obj_conv);
32338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32339 LDKRawInvoice this_ptr_conv;
32340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32341 this_ptr_conv.is_owned = false;
32342 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
32343 uint64_t ret_ref = 0;
32344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32346 ret_ref = (uint64_t)ret_var.inner;
32347 if (ret_var.is_owned) {
32353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32354 LDKRawInvoice this_ptr_conv;
32355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32356 this_ptr_conv.is_owned = false;
32357 LDKRawDataPart val_conv;
32358 val_conv.inner = (void*)(val & (~1));
32359 val_conv.is_owned = (val & 1) || (val == 0);
32360 val_conv = RawDataPart_clone(&val_conv);
32361 RawInvoice_set_data(&this_ptr_conv, val_conv);
32364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32365 LDKRawInvoice a_conv;
32366 a_conv.inner = (void*)(a & (~1));
32367 a_conv.is_owned = false;
32368 LDKRawInvoice b_conv;
32369 b_conv.inner = (void*)(b & (~1));
32370 b_conv.is_owned = false;
32371 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
32375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32376 LDKRawInvoice orig_conv;
32377 orig_conv.inner = (void*)(orig & (~1));
32378 orig_conv.is_owned = false;
32379 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
32380 uint64_t ret_ref = 0;
32381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32383 ret_ref = (uint64_t)ret_var.inner;
32384 if (ret_var.is_owned) {
32390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32391 LDKRawDataPart this_obj_conv;
32392 this_obj_conv.inner = (void*)(this_obj & (~1));
32393 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32394 RawDataPart_free(this_obj_conv);
32397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
32398 LDKRawDataPart this_ptr_conv;
32399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32400 this_ptr_conv.is_owned = false;
32401 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
32402 uint64_t ret_ref = 0;
32403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32405 ret_ref = (uint64_t)ret_var.inner;
32406 if (ret_var.is_owned) {
32412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32413 LDKRawDataPart this_ptr_conv;
32414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32415 this_ptr_conv.is_owned = false;
32416 LDKPositiveTimestamp val_conv;
32417 val_conv.inner = (void*)(val & (~1));
32418 val_conv.is_owned = (val & 1) || (val == 0);
32419 val_conv = PositiveTimestamp_clone(&val_conv);
32420 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
32423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32424 LDKRawDataPart a_conv;
32425 a_conv.inner = (void*)(a & (~1));
32426 a_conv.is_owned = false;
32427 LDKRawDataPart b_conv;
32428 b_conv.inner = (void*)(b & (~1));
32429 b_conv.is_owned = false;
32430 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
32434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32435 LDKRawDataPart orig_conv;
32436 orig_conv.inner = (void*)(orig & (~1));
32437 orig_conv.is_owned = false;
32438 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
32439 uint64_t ret_ref = 0;
32440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32442 ret_ref = (uint64_t)ret_var.inner;
32443 if (ret_var.is_owned) {
32449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32450 LDKPositiveTimestamp this_obj_conv;
32451 this_obj_conv.inner = (void*)(this_obj & (~1));
32452 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32453 PositiveTimestamp_free(this_obj_conv);
32456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32457 LDKPositiveTimestamp a_conv;
32458 a_conv.inner = (void*)(a & (~1));
32459 a_conv.is_owned = false;
32460 LDKPositiveTimestamp b_conv;
32461 b_conv.inner = (void*)(b & (~1));
32462 b_conv.is_owned = false;
32463 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
32467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32468 LDKPositiveTimestamp orig_conv;
32469 orig_conv.inner = (void*)(orig & (~1));
32470 orig_conv.is_owned = false;
32471 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
32472 uint64_t ret_ref = 0;
32473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32475 ret_ref = (uint64_t)ret_var.inner;
32476 if (ret_var.is_owned) {
32482 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32483 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
32484 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
32488 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
32489 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
32493 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
32494 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
32498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
32499 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
32503 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
32504 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
32508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32509 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
32510 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
32511 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
32515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
32516 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
32517 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
32521 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32522 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
32523 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
32527 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
32528 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
32532 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
32533 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
32537 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
32538 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
32542 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
32543 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
32547 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
32548 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
32552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
32553 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
32554 int64_t ret_val = Currency_hash(o_conv);
32558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32559 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
32560 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
32561 jboolean ret_val = Currency_eq(a_conv, b_conv);
32565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32566 LDKSha256 this_obj_conv;
32567 this_obj_conv.inner = (void*)(this_obj & (~1));
32568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32569 Sha256_free(this_obj_conv);
32572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32573 LDKSha256 orig_conv;
32574 orig_conv.inner = (void*)(orig & (~1));
32575 orig_conv.is_owned = false;
32576 LDKSha256 ret_var = Sha256_clone(&orig_conv);
32577 uint64_t ret_ref = 0;
32578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32580 ret_ref = (uint64_t)ret_var.inner;
32581 if (ret_var.is_owned) {
32587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
32589 o_conv.inner = (void*)(o & (~1));
32590 o_conv.is_owned = false;
32591 int64_t ret_val = Sha256_hash(&o_conv);
32595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32597 a_conv.inner = (void*)(a & (~1));
32598 a_conv.is_owned = false;
32600 b_conv.inner = (void*)(b & (~1));
32601 b_conv.is_owned = false;
32602 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
32606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32607 LDKDescription this_obj_conv;
32608 this_obj_conv.inner = (void*)(this_obj & (~1));
32609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32610 Description_free(this_obj_conv);
32613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32614 LDKDescription orig_conv;
32615 orig_conv.inner = (void*)(orig & (~1));
32616 orig_conv.is_owned = false;
32617 LDKDescription ret_var = Description_clone(&orig_conv);
32618 uint64_t ret_ref = 0;
32619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32621 ret_ref = (uint64_t)ret_var.inner;
32622 if (ret_var.is_owned) {
32628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
32629 LDKDescription o_conv;
32630 o_conv.inner = (void*)(o & (~1));
32631 o_conv.is_owned = false;
32632 int64_t ret_val = Description_hash(&o_conv);
32636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32637 LDKDescription a_conv;
32638 a_conv.inner = (void*)(a & (~1));
32639 a_conv.is_owned = false;
32640 LDKDescription b_conv;
32641 b_conv.inner = (void*)(b & (~1));
32642 b_conv.is_owned = false;
32643 jboolean ret_val = Description_eq(&a_conv, &b_conv);
32647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32648 LDKPayeePubKey this_obj_conv;
32649 this_obj_conv.inner = (void*)(this_obj & (~1));
32650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32651 PayeePubKey_free(this_obj_conv);
32654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
32655 LDKPayeePubKey this_ptr_conv;
32656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32657 this_ptr_conv.is_owned = false;
32658 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
32663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32664 LDKPayeePubKey this_ptr_conv;
32665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32666 this_ptr_conv.is_owned = false;
32667 LDKPublicKey val_ref;
32668 CHECK((*env)->GetArrayLength(env, val) == 33);
32669 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32670 PayeePubKey_set_a(&this_ptr_conv, val_ref);
32673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
32674 LDKPublicKey a_arg_ref;
32675 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
32676 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
32677 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
32678 uint64_t ret_ref = 0;
32679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32681 ret_ref = (uint64_t)ret_var.inner;
32682 if (ret_var.is_owned) {
32688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32689 LDKPayeePubKey orig_conv;
32690 orig_conv.inner = (void*)(orig & (~1));
32691 orig_conv.is_owned = false;
32692 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
32693 uint64_t ret_ref = 0;
32694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32696 ret_ref = (uint64_t)ret_var.inner;
32697 if (ret_var.is_owned) {
32703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
32704 LDKPayeePubKey o_conv;
32705 o_conv.inner = (void*)(o & (~1));
32706 o_conv.is_owned = false;
32707 int64_t ret_val = PayeePubKey_hash(&o_conv);
32711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32712 LDKPayeePubKey a_conv;
32713 a_conv.inner = (void*)(a & (~1));
32714 a_conv.is_owned = false;
32715 LDKPayeePubKey b_conv;
32716 b_conv.inner = (void*)(b & (~1));
32717 b_conv.is_owned = false;
32718 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
32722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32723 LDKExpiryTime this_obj_conv;
32724 this_obj_conv.inner = (void*)(this_obj & (~1));
32725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32726 ExpiryTime_free(this_obj_conv);
32729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32730 LDKExpiryTime orig_conv;
32731 orig_conv.inner = (void*)(orig & (~1));
32732 orig_conv.is_owned = false;
32733 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
32734 uint64_t ret_ref = 0;
32735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32737 ret_ref = (uint64_t)ret_var.inner;
32738 if (ret_var.is_owned) {
32744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
32745 LDKExpiryTime o_conv;
32746 o_conv.inner = (void*)(o & (~1));
32747 o_conv.is_owned = false;
32748 int64_t ret_val = ExpiryTime_hash(&o_conv);
32752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32753 LDKExpiryTime a_conv;
32754 a_conv.inner = (void*)(a & (~1));
32755 a_conv.is_owned = false;
32756 LDKExpiryTime b_conv;
32757 b_conv.inner = (void*)(b & (~1));
32758 b_conv.is_owned = false;
32759 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
32763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32764 LDKMinFinalCltvExpiry this_obj_conv;
32765 this_obj_conv.inner = (void*)(this_obj & (~1));
32766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32767 MinFinalCltvExpiry_free(this_obj_conv);
32770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
32771 LDKMinFinalCltvExpiry this_ptr_conv;
32772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32773 this_ptr_conv.is_owned = false;
32774 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
32778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32779 LDKMinFinalCltvExpiry this_ptr_conv;
32780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32781 this_ptr_conv.is_owned = false;
32782 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
32785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
32786 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
32787 uint64_t ret_ref = 0;
32788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32790 ret_ref = (uint64_t)ret_var.inner;
32791 if (ret_var.is_owned) {
32797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32798 LDKMinFinalCltvExpiry orig_conv;
32799 orig_conv.inner = (void*)(orig & (~1));
32800 orig_conv.is_owned = false;
32801 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
32802 uint64_t ret_ref = 0;
32803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32805 ret_ref = (uint64_t)ret_var.inner;
32806 if (ret_var.is_owned) {
32812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
32813 LDKMinFinalCltvExpiry o_conv;
32814 o_conv.inner = (void*)(o & (~1));
32815 o_conv.is_owned = false;
32816 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
32820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32821 LDKMinFinalCltvExpiry a_conv;
32822 a_conv.inner = (void*)(a & (~1));
32823 a_conv.is_owned = false;
32824 LDKMinFinalCltvExpiry b_conv;
32825 b_conv.inner = (void*)(b & (~1));
32826 b_conv.is_owned = false;
32827 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
32831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32832 if ((this_ptr & 1) != 0) return;
32833 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
32834 CHECK_ACCESS(this_ptr_ptr);
32835 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
32836 FREE((void*)this_ptr);
32837 Fallback_free(this_ptr_conv);
32840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32841 LDKFallback* orig_conv = (LDKFallback*)orig;
32842 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
32843 *ret_copy = Fallback_clone(orig_conv);
32844 uint64_t ret_ref = (uint64_t)ret_copy;
32848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
32850 LDKCVec_u8Z program_ref;
32851 program_ref.datalen = (*env)->GetArrayLength(env, program);
32852 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
32853 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
32854 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
32855 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
32856 uint64_t ret_ref = (uint64_t)ret_copy;
32860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
32861 LDKTwentyBytes a_ref;
32862 CHECK((*env)->GetArrayLength(env, a) == 20);
32863 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
32864 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
32865 *ret_copy = Fallback_pub_key_hash(a_ref);
32866 uint64_t ret_ref = (uint64_t)ret_copy;
32870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
32871 LDKTwentyBytes a_ref;
32872 CHECK((*env)->GetArrayLength(env, a) == 20);
32873 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
32874 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
32875 *ret_copy = Fallback_script_hash(a_ref);
32876 uint64_t ret_ref = (uint64_t)ret_copy;
32880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
32881 LDKFallback* o_conv = (LDKFallback*)o;
32882 int64_t ret_val = Fallback_hash(o_conv);
32886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32887 LDKFallback* a_conv = (LDKFallback*)a;
32888 LDKFallback* b_conv = (LDKFallback*)b;
32889 jboolean ret_val = Fallback_eq(a_conv, b_conv);
32893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32894 LDKInvoiceSignature this_obj_conv;
32895 this_obj_conv.inner = (void*)(this_obj & (~1));
32896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32897 InvoiceSignature_free(this_obj_conv);
32900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32901 LDKInvoiceSignature orig_conv;
32902 orig_conv.inner = (void*)(orig & (~1));
32903 orig_conv.is_owned = false;
32904 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
32905 uint64_t ret_ref = 0;
32906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32908 ret_ref = (uint64_t)ret_var.inner;
32909 if (ret_var.is_owned) {
32915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32916 LDKInvoiceSignature a_conv;
32917 a_conv.inner = (void*)(a & (~1));
32918 a_conv.is_owned = false;
32919 LDKInvoiceSignature b_conv;
32920 b_conv.inner = (void*)(b & (~1));
32921 b_conv.is_owned = false;
32922 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
32926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32927 LDKPrivateRoute this_obj_conv;
32928 this_obj_conv.inner = (void*)(this_obj & (~1));
32929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32930 PrivateRoute_free(this_obj_conv);
32933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32934 LDKPrivateRoute orig_conv;
32935 orig_conv.inner = (void*)(orig & (~1));
32936 orig_conv.is_owned = false;
32937 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
32938 uint64_t ret_ref = 0;
32939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32941 ret_ref = (uint64_t)ret_var.inner;
32942 if (ret_var.is_owned) {
32948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
32949 LDKPrivateRoute o_conv;
32950 o_conv.inner = (void*)(o & (~1));
32951 o_conv.is_owned = false;
32952 int64_t ret_val = PrivateRoute_hash(&o_conv);
32956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32957 LDKPrivateRoute a_conv;
32958 a_conv.inner = (void*)(a & (~1));
32959 a_conv.is_owned = false;
32960 LDKPrivateRoute b_conv;
32961 b_conv.inner = (void*)(b & (~1));
32962 b_conv.is_owned = false;
32963 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
32967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
32968 LDKSignedRawInvoice this_arg_conv;
32969 this_arg_conv.inner = (void*)(this_arg & (~1));
32970 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
32971 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
32972 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
32973 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
32974 return ((uint64_t)ret_conv);
32977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
32978 LDKSignedRawInvoice this_arg_conv;
32979 this_arg_conv.inner = (void*)(this_arg & (~1));
32980 this_arg_conv.is_owned = false;
32981 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
32982 uint64_t ret_ref = 0;
32983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32985 ret_ref = (uint64_t)ret_var.inner;
32986 if (ret_var.is_owned) {
32992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
32993 LDKSignedRawInvoice this_arg_conv;
32994 this_arg_conv.inner = (void*)(this_arg & (~1));
32995 this_arg_conv.is_owned = false;
32996 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32997 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
33001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
33002 LDKSignedRawInvoice this_arg_conv;
33003 this_arg_conv.inner = (void*)(this_arg & (~1));
33004 this_arg_conv.is_owned = false;
33005 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
33006 uint64_t ret_ref = 0;
33007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33009 ret_ref = (uint64_t)ret_var.inner;
33010 if (ret_var.is_owned) {
33016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
33017 LDKSignedRawInvoice this_arg_conv;
33018 this_arg_conv.inner = (void*)(this_arg & (~1));
33019 this_arg_conv.is_owned = false;
33020 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
33021 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
33022 return (uint64_t)ret_conv;
33025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
33026 LDKSignedRawInvoice this_arg_conv;
33027 this_arg_conv.inner = (void*)(this_arg & (~1));
33028 this_arg_conv.is_owned = false;
33029 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
33033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
33034 LDKRawInvoice this_arg_conv;
33035 this_arg_conv.inner = (void*)(this_arg & (~1));
33036 this_arg_conv.is_owned = false;
33037 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33038 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
33042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
33043 LDKRawInvoice this_arg_conv;
33044 this_arg_conv.inner = (void*)(this_arg & (~1));
33045 this_arg_conv.is_owned = false;
33046 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
33047 uint64_t ret_ref = 0;
33048 if ((uint64_t)ret_var.inner > 4096) {
33049 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33050 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33051 ret_ref = (uint64_t)ret_var.inner;
33052 if (ret_var.is_owned) {
33059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
33060 LDKRawInvoice this_arg_conv;
33061 this_arg_conv.inner = (void*)(this_arg & (~1));
33062 this_arg_conv.is_owned = false;
33063 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
33064 uint64_t ret_ref = 0;
33065 if ((uint64_t)ret_var.inner > 4096) {
33066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33068 ret_ref = (uint64_t)ret_var.inner;
33069 if (ret_var.is_owned) {
33076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
33077 LDKRawInvoice this_arg_conv;
33078 this_arg_conv.inner = (void*)(this_arg & (~1));
33079 this_arg_conv.is_owned = false;
33080 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
33081 uint64_t ret_ref = 0;
33082 if ((uint64_t)ret_var.inner > 4096) {
33083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33085 ret_ref = (uint64_t)ret_var.inner;
33086 if (ret_var.is_owned) {
33093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
33094 LDKRawInvoice this_arg_conv;
33095 this_arg_conv.inner = (void*)(this_arg & (~1));
33096 this_arg_conv.is_owned = false;
33097 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
33098 uint64_t ret_ref = 0;
33099 if ((uint64_t)ret_var.inner > 4096) {
33100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33102 ret_ref = (uint64_t)ret_var.inner;
33103 if (ret_var.is_owned) {
33110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
33111 LDKRawInvoice this_arg_conv;
33112 this_arg_conv.inner = (void*)(this_arg & (~1));
33113 this_arg_conv.is_owned = false;
33114 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
33115 uint64_t ret_ref = 0;
33116 if ((uint64_t)ret_var.inner > 4096) {
33117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33119 ret_ref = (uint64_t)ret_var.inner;
33120 if (ret_var.is_owned) {
33127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
33128 LDKRawInvoice this_arg_conv;
33129 this_arg_conv.inner = (void*)(this_arg & (~1));
33130 this_arg_conv.is_owned = false;
33131 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
33132 uint64_t ret_ref = 0;
33133 if ((uint64_t)ret_var.inner > 4096) {
33134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33136 ret_ref = (uint64_t)ret_var.inner;
33137 if (ret_var.is_owned) {
33144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
33145 LDKRawInvoice this_arg_conv;
33146 this_arg_conv.inner = (void*)(this_arg & (~1));
33147 this_arg_conv.is_owned = false;
33148 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33149 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
33153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33154 LDKRawInvoice this_arg_conv;
33155 this_arg_conv.inner = (void*)(this_arg & (~1));
33156 this_arg_conv.is_owned = false;
33157 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
33158 uint64_t ret_ref = 0;
33159 if ((uint64_t)ret_var.inner > 4096) {
33160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33162 ret_ref = (uint64_t)ret_var.inner;
33163 if (ret_var.is_owned) {
33170 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
33171 LDKRawInvoice this_arg_conv;
33172 this_arg_conv.inner = (void*)(this_arg & (~1));
33173 this_arg_conv.is_owned = false;
33174 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
33175 int64_tArray ret_arr = NULL;
33176 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33177 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33178 for (size_t o = 0; o < ret_var.datalen; o++) {
33179 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
33180 uint64_t ret_conv_14_ref = 0;
33181 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33182 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33183 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33184 if (ret_conv_14_var.is_owned) {
33185 ret_conv_14_ref |= 1;
33187 ret_arr_ptr[o] = ret_conv_14_ref;
33189 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33190 FREE(ret_var.data);
33194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
33195 LDKRawInvoice this_arg_conv;
33196 this_arg_conv.inner = (void*)(this_arg & (~1));
33197 this_arg_conv.is_owned = false;
33198 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33199 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
33200 uint64_t ret_ref = (uint64_t)ret_copy;
33204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
33205 LDKRawInvoice this_arg_conv;
33206 this_arg_conv.inner = (void*)(this_arg & (~1));
33207 this_arg_conv.is_owned = false;
33208 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
33212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
33213 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33214 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
33215 return (uint64_t)ret_conv;
33218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
33219 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33220 *ret_conv = PositiveTimestamp_from_system_time(time);
33221 return (uint64_t)ret_conv;
33224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
33225 LDKPositiveTimestamp this_arg_conv;
33226 this_arg_conv.inner = (void*)(this_arg & (~1));
33227 this_arg_conv.is_owned = false;
33228 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
33232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
33233 LDKPositiveTimestamp this_arg_conv;
33234 this_arg_conv.inner = (void*)(this_arg & (~1));
33235 this_arg_conv.is_owned = false;
33236 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
33240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
33241 LDKInvoice this_arg_conv;
33242 this_arg_conv.inner = (void*)(this_arg & (~1));
33243 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
33244 this_arg_conv = Invoice_clone(&this_arg_conv);
33245 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
33246 uint64_t ret_ref = 0;
33247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33249 ret_ref = (uint64_t)ret_var.inner;
33250 if (ret_var.is_owned) {
33256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
33257 LDKInvoice this_arg_conv;
33258 this_arg_conv.inner = (void*)(this_arg & (~1));
33259 this_arg_conv.is_owned = false;
33260 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
33261 *ret_conv = Invoice_check_signature(&this_arg_conv);
33262 return (uint64_t)ret_conv;
33265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
33266 LDKSignedRawInvoice signed_invoice_conv;
33267 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
33268 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
33269 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
33270 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
33271 *ret_conv = Invoice_from_signed(signed_invoice_conv);
33272 return (uint64_t)ret_conv;
33275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
33276 LDKInvoice this_arg_conv;
33277 this_arg_conv.inner = (void*)(this_arg & (~1));
33278 this_arg_conv.is_owned = false;
33279 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
33283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
33284 LDKInvoice this_arg_conv;
33285 this_arg_conv.inner = (void*)(this_arg & (~1));
33286 this_arg_conv.is_owned = false;
33287 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
33292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
33293 LDKInvoice this_arg_conv;
33294 this_arg_conv.inner = (void*)(this_arg & (~1));
33295 this_arg_conv.is_owned = false;
33296 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33297 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
33301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
33302 LDKInvoice this_arg_conv;
33303 this_arg_conv.inner = (void*)(this_arg & (~1));
33304 this_arg_conv.is_owned = false;
33305 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33306 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
33310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
33311 LDKInvoice this_arg_conv;
33312 this_arg_conv.inner = (void*)(this_arg & (~1));
33313 this_arg_conv.is_owned = false;
33314 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
33315 uint64_t ret_ref = 0;
33316 if ((uint64_t)ret_var.inner > 4096) {
33317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33319 ret_ref = (uint64_t)ret_var.inner;
33320 if (ret_var.is_owned) {
33327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
33328 LDKInvoice this_arg_conv;
33329 this_arg_conv.inner = (void*)(this_arg & (~1));
33330 this_arg_conv.is_owned = false;
33331 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33332 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
33336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
33337 LDKInvoice this_arg_conv;
33338 this_arg_conv.inner = (void*)(this_arg & (~1));
33339 this_arg_conv.is_owned = false;
33340 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
33344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
33345 LDKInvoice this_arg_conv;
33346 this_arg_conv.inner = (void*)(this_arg & (~1));
33347 this_arg_conv.is_owned = false;
33348 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
33352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
33353 LDKInvoice this_arg_conv;
33354 this_arg_conv.inner = (void*)(this_arg & (~1));
33355 this_arg_conv.is_owned = false;
33356 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
33360 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
33361 LDKInvoice this_arg_conv;
33362 this_arg_conv.inner = (void*)(this_arg & (~1));
33363 this_arg_conv.is_owned = false;
33364 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
33365 int64_tArray ret_arr = NULL;
33366 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33367 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33368 for (size_t o = 0; o < ret_var.datalen; o++) {
33369 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
33370 uint64_t ret_conv_14_ref = 0;
33371 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33372 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33373 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33374 if (ret_conv_14_var.is_owned) {
33375 ret_conv_14_ref |= 1;
33377 ret_arr_ptr[o] = ret_conv_14_ref;
33379 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33380 FREE(ret_var.data);
33384 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
33385 LDKInvoice this_arg_conv;
33386 this_arg_conv.inner = (void*)(this_arg & (~1));
33387 this_arg_conv.is_owned = false;
33388 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
33389 int64_tArray ret_arr = NULL;
33390 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33391 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33392 for (size_t l = 0; l < ret_var.datalen; l++) {
33393 LDKRouteHint ret_conv_11_var = ret_var.data[l];
33394 uint64_t ret_conv_11_ref = 0;
33395 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33396 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33397 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
33398 if (ret_conv_11_var.is_owned) {
33399 ret_conv_11_ref |= 1;
33401 ret_arr_ptr[l] = ret_conv_11_ref;
33403 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33404 FREE(ret_var.data);
33408 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
33409 LDKInvoice this_arg_conv;
33410 this_arg_conv.inner = (void*)(this_arg & (~1));
33411 this_arg_conv.is_owned = false;
33412 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
33416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
33417 LDKInvoice this_arg_conv;
33418 this_arg_conv.inner = (void*)(this_arg & (~1));
33419 this_arg_conv.is_owned = false;
33420 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33421 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
33422 uint64_t ret_ref = (uint64_t)ret_copy;
33426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
33427 LDKStr description_conv = java_to_owned_str(env, description);
33428 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33429 *ret_conv = Description_new(description_conv);
33430 return (uint64_t)ret_conv;
33433 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
33434 LDKDescription this_arg_conv;
33435 this_arg_conv.inner = (void*)(this_arg & (~1));
33436 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
33437 this_arg_conv = Description_clone(&this_arg_conv);
33438 LDKStr ret_str = Description_into_inner(this_arg_conv);
33439 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
33445 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
33446 *ret_conv = ExpiryTime_from_seconds(seconds);
33447 return (uint64_t)ret_conv;
33450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
33451 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
33452 *ret_conv = ExpiryTime_from_duration(duration);
33453 return (uint64_t)ret_conv;
33456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
33457 LDKExpiryTime this_arg_conv;
33458 this_arg_conv.inner = (void*)(this_arg & (~1));
33459 this_arg_conv.is_owned = false;
33460 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
33464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
33465 LDKExpiryTime this_arg_conv;
33466 this_arg_conv.inner = (void*)(this_arg & (~1));
33467 this_arg_conv.is_owned = false;
33468 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
33472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
33473 LDKRouteHint hops_conv;
33474 hops_conv.inner = (void*)(hops & (~1));
33475 hops_conv.is_owned = (hops & 1) || (hops == 0);
33476 hops_conv = RouteHint_clone(&hops_conv);
33477 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33478 *ret_conv = PrivateRoute_new(hops_conv);
33479 return (uint64_t)ret_conv;
33482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
33483 LDKPrivateRoute this_arg_conv;
33484 this_arg_conv.inner = (void*)(this_arg & (~1));
33485 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
33486 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
33487 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
33488 uint64_t ret_ref = 0;
33489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33491 ret_ref = (uint64_t)ret_var.inner;
33492 if (ret_var.is_owned) {
33498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33499 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
33500 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
33504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
33505 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
33509 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
33510 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
33514 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
33515 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
33519 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
33520 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
33524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33525 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
33526 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
33527 jboolean ret_val = CreationError_eq(a_conv, b_conv);
33531 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33532 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
33533 LDKStr ret_str = CreationError_to_str(o_conv);
33534 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33539 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33540 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
33541 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
33545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
33546 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
33550 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
33551 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
33555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
33556 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
33560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
33561 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
33565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
33566 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
33570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
33571 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
33575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
33576 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
33580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
33581 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
33585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
33586 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
33590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
33591 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
33595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33596 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
33597 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
33598 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
33602 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33603 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
33604 LDKStr ret_str = SemanticError_to_str(o_conv);
33605 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33611 if ((this_ptr & 1) != 0) return;
33612 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
33613 CHECK_ACCESS(this_ptr_ptr);
33614 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
33615 FREE((void*)this_ptr);
33616 SignOrCreationError_free(this_ptr_conv);
33619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33620 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
33621 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
33622 *ret_copy = SignOrCreationError_clone(orig_conv);
33623 uint64_t ret_ref = (uint64_t)ret_copy;
33627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
33628 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
33629 *ret_copy = SignOrCreationError_sign_error();
33630 uint64_t ret_ref = (uint64_t)ret_copy;
33634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
33635 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
33636 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
33637 *ret_copy = SignOrCreationError_creation_error(a_conv);
33638 uint64_t ret_ref = (uint64_t)ret_copy;
33642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33643 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
33644 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
33645 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
33649 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33650 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
33651 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
33652 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33658 LDKInvoicePayer this_obj_conv;
33659 this_obj_conv.inner = (void*)(this_obj & (~1));
33660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33661 InvoicePayer_free(this_obj_conv);
33664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33665 if ((this_ptr & 1) != 0) return;
33666 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
33667 CHECK_ACCESS(this_ptr_ptr);
33668 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
33669 FREE((void*)this_ptr);
33670 Payer_free(this_ptr_conv);
33673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33674 if ((this_ptr & 1) != 0) return;
33675 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
33676 CHECK_ACCESS(this_ptr_ptr);
33677 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
33678 FREE((void*)this_ptr);
33679 Router_free(this_ptr_conv);
33682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33683 LDKRetryAttempts this_obj_conv;
33684 this_obj_conv.inner = (void*)(this_obj & (~1));
33685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33686 RetryAttempts_free(this_obj_conv);
33689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
33690 LDKRetryAttempts this_ptr_conv;
33691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33692 this_ptr_conv.is_owned = false;
33693 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
33697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33698 LDKRetryAttempts this_ptr_conv;
33699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33700 this_ptr_conv.is_owned = false;
33701 RetryAttempts_set_a(&this_ptr_conv, val);
33704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
33705 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
33706 uint64_t ret_ref = 0;
33707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33709 ret_ref = (uint64_t)ret_var.inner;
33710 if (ret_var.is_owned) {
33716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33717 LDKRetryAttempts orig_conv;
33718 orig_conv.inner = (void*)(orig & (~1));
33719 orig_conv.is_owned = false;
33720 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
33721 uint64_t ret_ref = 0;
33722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33724 ret_ref = (uint64_t)ret_var.inner;
33725 if (ret_var.is_owned) {
33731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33732 LDKRetryAttempts a_conv;
33733 a_conv.inner = (void*)(a & (~1));
33734 a_conv.is_owned = false;
33735 LDKRetryAttempts b_conv;
33736 b_conv.inner = (void*)(b & (~1));
33737 b_conv.is_owned = false;
33738 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
33742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
33743 LDKRetryAttempts o_conv;
33744 o_conv.inner = (void*)(o & (~1));
33745 o_conv.is_owned = false;
33746 int64_t ret_val = RetryAttempts_hash(&o_conv);
33750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33751 if ((this_ptr & 1) != 0) return;
33752 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
33753 CHECK_ACCESS(this_ptr_ptr);
33754 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
33755 FREE((void*)this_ptr);
33756 PaymentError_free(this_ptr_conv);
33759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33760 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
33761 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
33762 *ret_copy = PaymentError_clone(orig_conv);
33763 uint64_t ret_ref = (uint64_t)ret_copy;
33767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
33768 LDKStr a_conv = java_to_owned_str(env, a);
33769 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
33770 *ret_copy = PaymentError_invoice(a_conv);
33771 uint64_t ret_ref = (uint64_t)ret_copy;
33775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
33776 LDKLightningError a_conv;
33777 a_conv.inner = (void*)(a & (~1));
33778 a_conv.is_owned = (a & 1) || (a == 0);
33779 a_conv = LightningError_clone(&a_conv);
33780 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
33781 *ret_copy = PaymentError_routing(a_conv);
33782 uint64_t ret_ref = (uint64_t)ret_copy;
33786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
33787 void* a_ptr = (void*)(((uint64_t)a) & ~1);
33788 CHECK_ACCESS(a_ptr);
33789 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
33790 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)a) & ~1));
33791 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
33792 *ret_copy = PaymentError_sending(a_conv);
33793 uint64_t ret_ref = (uint64_t)ret_copy;
33797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry_attempts) {
33798 void* payer_ptr = (void*)(((uint64_t)payer) & ~1);
33799 CHECK_ACCESS(payer_ptr);
33800 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
33801 if (payer_conv.free == LDKPayer_JCalls_free) {
33802 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33803 LDKPayer_JCalls_cloned(&payer_conv);
33805 void* router_ptr = (void*)(((uint64_t)router) & ~1);
33806 CHECK_ACCESS(router_ptr);
33807 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
33808 if (router_conv.free == LDKRouter_JCalls_free) {
33809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33810 LDKRouter_JCalls_cloned(&router_conv);
33812 LDKLockableScore scorer_conv;
33813 scorer_conv.inner = (void*)(scorer & (~1));
33814 scorer_conv.is_owned = false;
33815 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
33816 CHECK_ACCESS(logger_ptr);
33817 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33818 if (logger_conv.free == LDKLogger_JCalls_free) {
33819 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33820 LDKLogger_JCalls_cloned(&logger_conv);
33822 void* event_handler_ptr = (void*)(((uint64_t)event_handler) & ~1);
33823 CHECK_ACCESS(event_handler_ptr);
33824 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
33825 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
33826 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33827 LDKEventHandler_JCalls_cloned(&event_handler_conv);
33829 LDKRetryAttempts retry_attempts_conv;
33830 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
33831 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
33832 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
33833 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
33834 uint64_t ret_ref = 0;
33835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33837 ret_ref = (uint64_t)ret_var.inner;
33838 if (ret_var.is_owned) {
33844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
33845 LDKInvoicePayer this_arg_conv;
33846 this_arg_conv.inner = (void*)(this_arg & (~1));
33847 this_arg_conv.is_owned = false;
33848 LDKInvoice invoice_conv;
33849 invoice_conv.inner = (void*)(invoice & (~1));
33850 invoice_conv.is_owned = false;
33851 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
33852 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
33853 return (uint64_t)ret_conv;
33856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) {
33857 LDKInvoicePayer this_arg_conv;
33858 this_arg_conv.inner = (void*)(this_arg & (~1));
33859 this_arg_conv.is_owned = false;
33860 LDKInvoice invoice_conv;
33861 invoice_conv.inner = (void*)(invoice & (~1));
33862 invoice_conv.is_owned = false;
33863 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
33864 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
33865 return (uint64_t)ret_conv;
33868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
33869 LDKInvoicePayer this_arg_conv;
33870 this_arg_conv.inner = (void*)(this_arg & (~1));
33871 this_arg_conv.is_owned = false;
33872 unsigned char payment_hash_arr[32];
33873 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
33874 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
33875 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
33876 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
33879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
33880 LDKInvoicePayer this_arg_conv;
33881 this_arg_conv.inner = (void*)(this_arg & (~1));
33882 this_arg_conv.is_owned = false;
33883 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
33884 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
33885 return (uint64_t)ret_ret;
33888 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) {
33889 LDKChannelManager channelmanager_conv;
33890 channelmanager_conv.inner = (void*)(channelmanager & (~1));
33891 channelmanager_conv.is_owned = false;
33892 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
33893 CHECK_ACCESS(keys_manager_ptr);
33894 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
33895 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
33896 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33897 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
33899 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
33900 void* amt_msat_ptr = (void*)(((uint64_t)amt_msat) & ~1);
33901 CHECK_ACCESS(amt_msat_ptr);
33902 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
33903 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
33904 LDKStr description_conv = java_to_owned_str(env, description);
33905 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
33906 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
33907 return (uint64_t)ret_conv;
33910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33911 LDKDefaultRouter this_obj_conv;
33912 this_obj_conv.inner = (void*)(this_obj & (~1));
33913 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33914 DefaultRouter_free(this_obj_conv);
33917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
33918 LDKNetworkGraph network_graph_conv;
33919 network_graph_conv.inner = (void*)(network_graph & (~1));
33920 network_graph_conv.is_owned = false;
33921 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
33922 CHECK_ACCESS(logger_ptr);
33923 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33924 if (logger_conv.free == LDKLogger_JCalls_free) {
33925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33926 LDKLogger_JCalls_cloned(&logger_conv);
33928 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
33929 uint64_t ret_ref = 0;
33930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33932 ret_ref = (uint64_t)ret_var.inner;
33933 if (ret_var.is_owned) {
33939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
33940 LDKDefaultRouter this_arg_conv;
33941 this_arg_conv.inner = (void*)(this_arg & (~1));
33942 this_arg_conv.is_owned = false;
33943 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
33944 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
33945 return (uint64_t)ret_ret;
33948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
33949 LDKChannelManager this_arg_conv;
33950 this_arg_conv.inner = (void*)(this_arg & (~1));
33951 this_arg_conv.is_owned = false;
33952 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
33953 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
33954 return (uint64_t)ret_ret;
33957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
33958 LDKStr s_conv = java_to_owned_str(env, s);
33959 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
33960 *ret_conv = SiPrefix_from_str(s_conv);
33961 return (uint64_t)ret_conv;
33964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
33965 LDKStr s_conv = java_to_owned_str(env, s);
33966 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
33967 *ret_conv = Invoice_from_str(s_conv);
33968 return (uint64_t)ret_conv;
33971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
33972 LDKStr s_conv = java_to_owned_str(env, s);
33973 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
33974 *ret_conv = SignedRawInvoice_from_str(s_conv);
33975 return (uint64_t)ret_conv;
33978 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33980 o_conv.inner = (void*)(o & (~1));
33981 o_conv.is_owned = false;
33982 LDKStr ret_str = Invoice_to_str(&o_conv);
33983 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33988 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33989 LDKSignedRawInvoice o_conv;
33990 o_conv.inner = (void*)(o & (~1));
33991 o_conv.is_owned = false;
33992 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
33993 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33998 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
33999 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
34000 LDKStr ret_str = Currency_to_str(o_conv);
34001 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34006 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
34007 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
34008 LDKStr ret_str = SiPrefix_to_str(o_conv);
34009 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);