2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
11 #define MALLOC(a, _) malloc(a)
12 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
13 #define DO_ASSERT(a) (void)(a)
16 static jmethodID ordinal_meth = NULL;
17 static jmethodID slicedef_meth = NULL;
18 static jclass slicedef_cls = NULL;
19 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
20 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
21 CHECK(ordinal_meth != NULL);
22 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
23 CHECK(slicedef_meth != NULL);
24 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
25 CHECK(slicedef_cls != NULL);
28 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
37 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
38 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
39 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
43 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
44 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
45 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
48 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
49 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
50 vec->datalen = (*env)->GetArrayLength(env, bytes);
51 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
52 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
55 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
56 LDKTransaction *txdata = (LDKTransaction*)ptr;
58 slice.data = txdata->data;
59 slice.datalen = txdata->datalen;
60 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
62 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
63 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
64 txdata->datalen = (*env)->GetArrayLength(env, bytes);
65 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
66 txdata->data_is_owned = false;
67 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
68 return (uint64_t)txdata;
70 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
71 LDKTransaction *tx = (LDKTransaction*)ptr;
72 tx->data_is_owned = true;
73 Transaction_free(*tx);
76 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
77 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
82 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
83 return (uint64_t)vec->datalen;
85 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
86 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
91 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
97 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
98 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
100 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
103 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
104 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
106 typedef jlongArray int64_tArray;
107 typedef jbyteArray int8_tArray;
109 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
110 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
111 char* conv_buf = MALLOC(len + 1, "str conv buf");
112 memcpy(conv_buf, chars, len);
114 jstring ret = (*env)->NewStringUTF(env, conv_buf);
118 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
119 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
120 char* newchars = MALLOC(str_len + 1, "String chars");
121 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
122 memcpy(newchars, jchars, str_len);
123 newchars[str_len] = 0;
124 (*env)->ReleaseStringUTFChars(env, str, jchars);
128 .chars_is_owned = true
133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, "v0.0.98.4", strlen("v0.0.98.4"));
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()));
142 static jclass arr_of_B_clz = NULL;
143 static jclass arr_of_J_clz = NULL;
144 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
145 arr_of_B_clz = (*env)->FindClass(env, "[B");
146 CHECK(arr_of_B_clz != NULL);
147 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
148 arr_of_J_clz = (*env)->FindClass(env, "[J");
149 CHECK(arr_of_J_clz != NULL);
150 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
152 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
153 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
154 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
155 case 0: return LDKAccessError_UnknownChain;
156 case 1: return LDKAccessError_UnknownTx;
160 static jclass AccessError_class = NULL;
161 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
162 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
163 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
164 AccessError_class = (*env)->NewGlobalRef(env, clz);
165 CHECK(AccessError_class != NULL);
166 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
167 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
168 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
169 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
171 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
173 case LDKAccessError_UnknownChain:
174 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
175 case LDKAccessError_UnknownTx:
176 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
181 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
182 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
183 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
184 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
188 static jclass ChannelMonitorUpdateErr_class = NULL;
189 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
190 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
191 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
192 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
193 CHECK(ChannelMonitorUpdateErr_class != NULL);
194 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
195 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
196 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
197 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
199 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
201 case LDKChannelMonitorUpdateErr_TemporaryFailure:
202 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
203 case LDKChannelMonitorUpdateErr_PermanentFailure:
204 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
209 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
210 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
211 case 0: return LDKConfirmationTarget_Background;
212 case 1: return LDKConfirmationTarget_Normal;
213 case 2: return LDKConfirmationTarget_HighPriority;
217 static jclass ConfirmationTarget_class = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
219 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
220 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
221 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
222 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
223 CHECK(ConfirmationTarget_class != NULL);
224 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
225 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
228 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
229 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
231 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
233 case LDKConfirmationTarget_Background:
234 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
235 case LDKConfirmationTarget_Normal:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
237 case LDKConfirmationTarget_HighPriority:
238 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
243 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
244 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
245 case 0: return LDKCreationError_DescriptionTooLong;
246 case 1: return LDKCreationError_RouteTooLong;
247 case 2: return LDKCreationError_TimestampOutOfBounds;
248 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
252 static jclass CreationError_class = NULL;
253 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
254 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
255 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
256 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
257 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
258 CreationError_class = (*env)->NewGlobalRef(env, clz);
259 CHECK(CreationError_class != NULL);
260 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
261 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
262 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
264 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
266 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
267 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
269 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
271 case LDKCreationError_DescriptionTooLong:
272 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
273 case LDKCreationError_RouteTooLong:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
275 case LDKCreationError_TimestampOutOfBounds:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
277 case LDKCreationError_ExpiryTimeOutOfBounds:
278 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
283 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
284 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
285 case 0: return LDKCurrency_Bitcoin;
286 case 1: return LDKCurrency_BitcoinTestnet;
287 case 2: return LDKCurrency_Regtest;
288 case 3: return LDKCurrency_Simnet;
289 case 4: return LDKCurrency_Signet;
293 static jclass Currency_class = NULL;
294 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
295 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
296 static jfieldID Currency_LDKCurrency_Regtest = NULL;
297 static jfieldID Currency_LDKCurrency_Simnet = NULL;
298 static jfieldID Currency_LDKCurrency_Signet = NULL;
299 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
300 Currency_class = (*env)->NewGlobalRef(env, clz);
301 CHECK(Currency_class != NULL);
302 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
303 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
304 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
306 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_Regtest != NULL);
308 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Simnet != NULL);
310 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
311 CHECK(Currency_LDKCurrency_Signet != NULL);
313 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
315 case LDKCurrency_Bitcoin:
316 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
317 case LDKCurrency_BitcoinTestnet:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
319 case LDKCurrency_Regtest:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
321 case LDKCurrency_Simnet:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
323 case LDKCurrency_Signet:
324 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
329 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
330 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
331 case 0: return LDKIOError_NotFound;
332 case 1: return LDKIOError_PermissionDenied;
333 case 2: return LDKIOError_ConnectionRefused;
334 case 3: return LDKIOError_ConnectionReset;
335 case 4: return LDKIOError_ConnectionAborted;
336 case 5: return LDKIOError_NotConnected;
337 case 6: return LDKIOError_AddrInUse;
338 case 7: return LDKIOError_AddrNotAvailable;
339 case 8: return LDKIOError_BrokenPipe;
340 case 9: return LDKIOError_AlreadyExists;
341 case 10: return LDKIOError_WouldBlock;
342 case 11: return LDKIOError_InvalidInput;
343 case 12: return LDKIOError_InvalidData;
344 case 13: return LDKIOError_TimedOut;
345 case 14: return LDKIOError_WriteZero;
346 case 15: return LDKIOError_Interrupted;
347 case 16: return LDKIOError_Other;
348 case 17: return LDKIOError_UnexpectedEof;
352 static jclass IOError_class = NULL;
353 static jfieldID IOError_LDKIOError_NotFound = NULL;
354 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
356 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
357 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
358 static jfieldID IOError_LDKIOError_NotConnected = NULL;
359 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
360 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
361 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
362 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
363 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
364 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
365 static jfieldID IOError_LDKIOError_InvalidData = NULL;
366 static jfieldID IOError_LDKIOError_TimedOut = NULL;
367 static jfieldID IOError_LDKIOError_WriteZero = NULL;
368 static jfieldID IOError_LDKIOError_Interrupted = NULL;
369 static jfieldID IOError_LDKIOError_Other = NULL;
370 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
371 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
372 IOError_class = (*env)->NewGlobalRef(env, clz);
373 CHECK(IOError_class != NULL);
374 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
375 CHECK(IOError_LDKIOError_NotFound != NULL);
376 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
378 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
380 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
382 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
384 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_NotConnected != NULL);
386 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_AddrInUse != NULL);
388 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
390 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
392 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
394 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_WouldBlock != NULL);
396 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_InvalidInput != NULL);
398 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_InvalidData != NULL);
400 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_TimedOut != NULL);
402 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_WriteZero != NULL);
404 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_Interrupted != NULL);
406 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_Other != NULL);
408 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
409 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
411 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
413 case LDKIOError_NotFound:
414 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
415 case LDKIOError_PermissionDenied:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
417 case LDKIOError_ConnectionRefused:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
419 case LDKIOError_ConnectionReset:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
421 case LDKIOError_ConnectionAborted:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
423 case LDKIOError_NotConnected:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
425 case LDKIOError_AddrInUse:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
427 case LDKIOError_AddrNotAvailable:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
429 case LDKIOError_BrokenPipe:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
431 case LDKIOError_AlreadyExists:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
433 case LDKIOError_WouldBlock:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
435 case LDKIOError_InvalidInput:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
437 case LDKIOError_InvalidData:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
439 case LDKIOError_TimedOut:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
441 case LDKIOError_WriteZero:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
443 case LDKIOError_Interrupted:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
445 case LDKIOError_Other:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
447 case LDKIOError_UnexpectedEof:
448 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
453 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
454 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
455 case 0: return LDKLevel_Off;
456 case 1: return LDKLevel_Error;
457 case 2: return LDKLevel_Warn;
458 case 3: return LDKLevel_Info;
459 case 4: return LDKLevel_Debug;
460 case 5: return LDKLevel_Trace;
464 static jclass Level_class = NULL;
465 static jfieldID Level_LDKLevel_Off = NULL;
466 static jfieldID Level_LDKLevel_Error = NULL;
467 static jfieldID Level_LDKLevel_Warn = NULL;
468 static jfieldID Level_LDKLevel_Info = NULL;
469 static jfieldID Level_LDKLevel_Debug = NULL;
470 static jfieldID Level_LDKLevel_Trace = NULL;
471 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
472 Level_class = (*env)->NewGlobalRef(env, clz);
473 CHECK(Level_class != NULL);
474 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Off != NULL);
476 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Error != NULL);
478 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Warn != NULL);
480 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Info != NULL);
482 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
483 CHECK(Level_LDKLevel_Debug != NULL);
484 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
485 CHECK(Level_LDKLevel_Trace != NULL);
487 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
496 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
498 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
500 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
505 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
506 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
507 case 0: return LDKNetwork_Bitcoin;
508 case 1: return LDKNetwork_Testnet;
509 case 2: return LDKNetwork_Regtest;
510 case 3: return LDKNetwork_Signet;
514 static jclass Network_class = NULL;
515 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
516 static jfieldID Network_LDKNetwork_Testnet = NULL;
517 static jfieldID Network_LDKNetwork_Regtest = NULL;
518 static jfieldID Network_LDKNetwork_Signet = NULL;
519 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
520 Network_class = (*env)->NewGlobalRef(env, clz);
521 CHECK(Network_class != NULL);
522 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
523 CHECK(Network_LDKNetwork_Bitcoin != NULL);
524 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
525 CHECK(Network_LDKNetwork_Testnet != NULL);
526 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
527 CHECK(Network_LDKNetwork_Regtest != NULL);
528 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
529 CHECK(Network_LDKNetwork_Signet != NULL);
531 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
533 case LDKNetwork_Bitcoin:
534 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
535 case LDKNetwork_Testnet:
536 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
537 case LDKNetwork_Regtest:
538 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
539 case LDKNetwork_Signet:
540 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
545 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
546 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
547 case 0: return LDKSecp256k1Error_IncorrectSignature;
548 case 1: return LDKSecp256k1Error_InvalidMessage;
549 case 2: return LDKSecp256k1Error_InvalidPublicKey;
550 case 3: return LDKSecp256k1Error_InvalidSignature;
551 case 4: return LDKSecp256k1Error_InvalidSecretKey;
552 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
553 case 6: return LDKSecp256k1Error_InvalidTweak;
554 case 7: return LDKSecp256k1Error_TweakCheckFailed;
555 case 8: return LDKSecp256k1Error_NotEnoughMemory;
559 static jclass Secp256k1Error_class = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
566 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
567 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
568 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
569 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
570 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
571 CHECK(Secp256k1Error_class != NULL);
572 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
580 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
582 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
584 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
585 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
586 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
587 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
588 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
589 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
591 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
593 case LDKSecp256k1Error_IncorrectSignature:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
595 case LDKSecp256k1Error_InvalidMessage:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
597 case LDKSecp256k1Error_InvalidPublicKey:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
599 case LDKSecp256k1Error_InvalidSignature:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
601 case LDKSecp256k1Error_InvalidSecretKey:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
603 case LDKSecp256k1Error_InvalidRecoveryId:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
605 case LDKSecp256k1Error_InvalidTweak:
606 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
607 case LDKSecp256k1Error_TweakCheckFailed:
608 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
609 case LDKSecp256k1Error_NotEnoughMemory:
610 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
615 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
616 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
617 case 0: return LDKSemanticError_NoPaymentHash;
618 case 1: return LDKSemanticError_MultiplePaymentHashes;
619 case 2: return LDKSemanticError_NoDescription;
620 case 3: return LDKSemanticError_MultipleDescriptions;
621 case 4: return LDKSemanticError_MultiplePaymentSecrets;
622 case 5: return LDKSemanticError_InvalidFeatures;
623 case 6: return LDKSemanticError_InvalidRecoveryId;
624 case 7: return LDKSemanticError_InvalidSignature;
628 static jclass SemanticError_class = NULL;
629 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
630 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
631 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
633 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
634 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
635 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
636 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
637 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
638 SemanticError_class = (*env)->NewGlobalRef(env, clz);
639 CHECK(SemanticError_class != NULL);
640 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
642 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
644 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
646 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
648 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
650 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
652 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
654 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
657 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
659 case LDKSemanticError_NoPaymentHash:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
661 case LDKSemanticError_MultiplePaymentHashes:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
663 case LDKSemanticError_NoDescription:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
665 case LDKSemanticError_MultipleDescriptions:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
667 case LDKSemanticError_MultiplePaymentSecrets:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
669 case LDKSemanticError_InvalidFeatures:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
671 case LDKSemanticError_InvalidRecoveryId:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
673 case LDKSemanticError_InvalidSignature:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
679 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
680 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
681 case 0: return LDKSiPrefix_Milli;
682 case 1: return LDKSiPrefix_Micro;
683 case 2: return LDKSiPrefix_Nano;
684 case 3: return LDKSiPrefix_Pico;
688 static jclass SiPrefix_class = NULL;
689 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
690 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
691 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
692 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
693 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
694 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
695 CHECK(SiPrefix_class != NULL);
696 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
697 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
698 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
699 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
700 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
702 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
705 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
707 case LDKSiPrefix_Milli:
708 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
709 case LDKSiPrefix_Micro:
710 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
711 case LDKSiPrefix_Nano:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
713 case LDKSiPrefix_Pico:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
720 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
721 ret->datalen = (*env)->GetArrayLength(env, elems);
722 if (ret->datalen == 0) {
725 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
726 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
727 for (size_t i = 0; i < ret->datalen; i++) {
728 ret->data[i] = java_elems[i];
730 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
732 return (uint64_t)ret;
734 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
735 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
736 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
740 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
743 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
744 CHECK(val->result_ok);
745 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
746 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
750 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
751 CHECK(!val->result_ok);
752 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
756 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
759 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
760 CHECK(val->result_ok);
761 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
762 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
766 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
767 CHECK(!val->result_ok);
768 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
772 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
775 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
776 CHECK(val->result_ok);
777 LDKTxCreationKeys res_var = (*val->contents.result);
778 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
780 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
784 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
785 CHECK(!val->result_ok);
786 LDKDecodeError err_var = (*val->contents.err);
787 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
788 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
789 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
793 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
796 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
797 CHECK(val->result_ok);
798 LDKChannelPublicKeys res_var = (*val->contents.result);
799 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
800 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
801 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
805 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
806 CHECK(!val->result_ok);
807 LDKDecodeError err_var = (*val->contents.err);
808 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
809 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
810 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
814 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
817 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
818 CHECK(val->result_ok);
819 LDKTxCreationKeys res_var = (*val->contents.result);
820 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
821 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
822 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
825 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
826 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
827 CHECK(!val->result_ok);
828 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
831 static jclass LDKCOption_u32Z_Some_class = NULL;
832 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
833 static jclass LDKCOption_u32Z_None_class = NULL;
834 static jmethodID LDKCOption_u32Z_None_meth = NULL;
835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
836 LDKCOption_u32Z_Some_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
838 CHECK(LDKCOption_u32Z_Some_class != NULL);
839 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
840 CHECK(LDKCOption_u32Z_Some_meth != NULL);
841 LDKCOption_u32Z_None_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
843 CHECK(LDKCOption_u32Z_None_class != NULL);
844 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
845 CHECK(LDKCOption_u32Z_None_meth != NULL);
847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
848 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
850 case LDKCOption_u32Z_Some: {
851 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
853 case LDKCOption_u32Z_None: {
854 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
860 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
863 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
864 CHECK(val->result_ok);
865 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
866 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
867 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
868 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
872 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
873 CHECK(!val->result_ok);
874 LDKDecodeError err_var = (*val->contents.err);
875 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
876 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
877 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
881 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
884 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
885 CHECK(val->result_ok);
886 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
887 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
888 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
889 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
893 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
894 CHECK(!val->result_ok);
895 LDKDecodeError err_var = (*val->contents.err);
896 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
897 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
898 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
902 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
905 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
906 CHECK(val->result_ok);
907 LDKChannelTransactionParameters res_var = (*val->contents.result);
908 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
909 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
910 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
914 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
915 CHECK(!val->result_ok);
916 LDKDecodeError err_var = (*val->contents.err);
917 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
918 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
919 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
923 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
926 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
927 CHECK(val->result_ok);
928 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
929 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
930 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
931 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
935 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
936 CHECK(!val->result_ok);
937 LDKDecodeError err_var = (*val->contents.err);
938 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
944 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
947 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
948 CHECK(val->result_ok);
949 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
950 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
951 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
952 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
956 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
957 CHECK(!val->result_ok);
958 LDKDecodeError err_var = (*val->contents.err);
959 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
965 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
968 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
969 CHECK(val->result_ok);
970 LDKCommitmentTransaction res_var = (*val->contents.result);
971 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
972 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
973 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
977 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
978 CHECK(!val->result_ok);
979 LDKDecodeError err_var = (*val->contents.err);
980 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
986 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
989 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
990 CHECK(val->result_ok);
991 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
992 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
993 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
994 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
998 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
999 CHECK(!val->result_ok);
1000 return *val->contents.err;
1002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1003 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1005 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1006 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1007 CHECK(val->result_ok);
1008 LDKCVec_SignatureZ res_var = (*val->contents.result);
1009 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1011 for (size_t i = 0; i < res_var.datalen; i++) {
1012 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1013 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1014 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1019 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1020 CHECK(!val->result_ok);
1021 return *val->contents.err;
1023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1024 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1027 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1028 CHECK(val->result_ok);
1029 return *val->contents.result;
1031 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1032 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1033 CHECK(!val->result_ok);
1034 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1038 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1041 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1042 CHECK(val->result_ok);
1043 LDKRouteHop res_var = (*val->contents.result);
1044 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1045 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1046 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1050 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1051 CHECK(!val->result_ok);
1052 LDKDecodeError err_var = (*val->contents.err);
1053 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1054 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1055 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1059 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1060 ret->datalen = (*env)->GetArrayLength(env, elems);
1061 if (ret->datalen == 0) {
1064 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1065 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1066 for (size_t i = 0; i < ret->datalen; i++) {
1067 int64_t arr_elem = java_elems[i];
1068 LDKRouteHop arr_elem_conv;
1069 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1070 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1071 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1072 ret->data[i] = arr_elem_conv;
1074 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1076 return (uint64_t)ret;
1078 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1079 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1080 for (size_t i = 0; i < ret.datalen; i++) {
1081 ret.data[i] = RouteHop_clone(&orig->data[i]);
1085 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1086 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1087 for (size_t i = 0; i < ret.datalen; i++) {
1088 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1093 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1096 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1097 CHECK(val->result_ok);
1098 LDKRoute res_var = (*val->contents.result);
1099 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1100 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1101 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1105 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1106 CHECK(!val->result_ok);
1107 LDKDecodeError err_var = (*val->contents.err);
1108 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1109 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1110 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1113 static jclass LDKCOption_u64Z_Some_class = NULL;
1114 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1115 static jclass LDKCOption_u64Z_None_class = NULL;
1116 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1118 LDKCOption_u64Z_Some_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1120 CHECK(LDKCOption_u64Z_Some_class != NULL);
1121 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1122 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1123 LDKCOption_u64Z_None_class =
1124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1125 CHECK(LDKCOption_u64Z_None_class != NULL);
1126 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1127 CHECK(LDKCOption_u64Z_None_meth != NULL);
1129 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1130 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1132 case LDKCOption_u64Z_Some: {
1133 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1135 case LDKCOption_u64Z_None: {
1136 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1142 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1143 ret->datalen = (*env)->GetArrayLength(env, elems);
1144 if (ret->datalen == 0) {
1147 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1148 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1149 for (size_t i = 0; i < ret->datalen; i++) {
1150 int64_t arr_elem = java_elems[i];
1151 LDKChannelDetails arr_elem_conv;
1152 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1153 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1154 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1155 ret->data[i] = arr_elem_conv;
1157 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1159 return (uint64_t)ret;
1161 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1162 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1163 for (size_t i = 0; i < ret.datalen; i++) {
1164 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1169 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1170 ret->datalen = (*env)->GetArrayLength(env, elems);
1171 if (ret->datalen == 0) {
1174 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1175 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1176 for (size_t i = 0; i < ret->datalen; i++) {
1177 int64_t arr_elem = java_elems[i];
1178 LDKRouteHint arr_elem_conv;
1179 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1180 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1181 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1182 ret->data[i] = arr_elem_conv;
1184 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1186 return (uint64_t)ret;
1188 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1189 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1190 for (size_t i = 0; i < ret.datalen; i++) {
1191 ret.data[i] = RouteHint_clone(&orig->data[i]);
1195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1196 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1199 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1200 CHECK(val->result_ok);
1201 LDKRoute res_var = (*val->contents.result);
1202 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1203 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1204 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1208 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1209 CHECK(!val->result_ok);
1210 LDKLightningError err_var = (*val->contents.err);
1211 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1212 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1217 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1220 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1221 CHECK(val->result_ok);
1222 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1223 return (uint64_t)res_ref;
1225 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1226 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1227 CHECK(!val->result_ok);
1228 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1232 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1234 LDKTransaction b_ref;
1235 b_ref.datalen = (*env)->GetArrayLength(env, b);
1236 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1237 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1238 b_ref.data_is_owned = false;
1240 return (uint64_t)ret;
1242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1243 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1247 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1248 LDKTransaction b_var = tuple->b;
1249 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1250 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1254 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1255 ret->datalen = (*env)->GetArrayLength(env, elems);
1256 if (ret->datalen == 0) {
1259 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1260 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1261 for (size_t i = 0; i < ret->datalen; i++) {
1262 int64_t arr_elem = java_elems[i];
1263 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1264 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1265 ret->data[i] = arr_elem_conv;
1267 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1269 return (uint64_t)ret;
1271 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1272 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1273 for (size_t i = 0; i < ret.datalen; i++) {
1274 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1278 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1279 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1280 for (size_t i = 0; i < ret.datalen; i++) {
1281 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1286 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1289 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1290 CHECK(val->result_ok);
1291 return *val->contents.result;
1293 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1294 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1295 CHECK(!val->result_ok);
1296 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1299 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1300 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1301 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1302 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1304 LDKMonitorEvent_HTLCEvent_class =
1305 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1306 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1307 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1308 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1309 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1310 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1311 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1312 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1313 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1315 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1316 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1318 case LDKMonitorEvent_HTLCEvent: {
1319 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1320 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1321 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1322 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1323 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1325 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1326 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1327 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1328 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1329 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1330 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1336 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1337 ret->datalen = (*env)->GetArrayLength(env, elems);
1338 if (ret->datalen == 0) {
1341 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1342 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1343 for (size_t i = 0; i < ret->datalen; i++) {
1344 int64_t arr_elem = java_elems[i];
1345 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1346 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1347 ret->data[i] = arr_elem_conv;
1349 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1351 return (uint64_t)ret;
1353 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1354 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1355 for (size_t i = 0; i < ret.datalen; i++) {
1356 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1360 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1361 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1362 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1363 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1365 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1366 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1367 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1368 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1369 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1370 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1371 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1372 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1373 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1374 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1377 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1379 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1380 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1381 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1383 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1384 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1389 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1390 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1391 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1392 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1393 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1394 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1396 LDKSpendableOutputDescriptor_StaticOutput_class =
1397 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1398 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1399 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1400 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1401 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1402 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1403 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1404 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1405 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1406 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1407 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1408 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1409 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1410 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1413 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1415 case LDKSpendableOutputDescriptor_StaticOutput: {
1416 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1417 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1420 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1421 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1423 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1424 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1425 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1426 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1427 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1428 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1430 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1431 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1432 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1433 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1434 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1435 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1441 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1442 ret->datalen = (*env)->GetArrayLength(env, elems);
1443 if (ret->datalen == 0) {
1446 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1447 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1448 for (size_t i = 0; i < ret->datalen; i++) {
1449 int64_t arr_elem = java_elems[i];
1450 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1451 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1452 ret->data[i] = arr_elem_conv;
1454 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1456 return (uint64_t)ret;
1458 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1459 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1460 for (size_t i = 0; i < ret.datalen; i++) {
1461 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1465 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1466 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1467 static jclass LDKErrorAction_IgnoreError_class = NULL;
1468 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1469 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1470 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1472 LDKErrorAction_DisconnectPeer_class =
1473 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1474 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1475 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1476 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1477 LDKErrorAction_IgnoreError_class =
1478 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1479 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1480 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1481 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1482 LDKErrorAction_SendErrorMessage_class =
1483 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1484 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1485 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1486 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1488 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1489 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1491 case LDKErrorAction_DisconnectPeer: {
1492 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1493 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1494 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1495 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1496 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1498 case LDKErrorAction_IgnoreError: {
1499 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1501 case LDKErrorAction_SendErrorMessage: {
1502 LDKErrorMessage msg_var = obj->send_error_message.msg;
1503 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1504 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1505 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1506 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1511 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1512 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1513 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1514 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1515 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1516 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1518 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1519 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1520 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1521 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1522 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1523 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1524 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1525 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1526 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1527 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1528 LDKHTLCFailChannelUpdate_NodeFailure_class =
1529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1530 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1531 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1532 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1534 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1535 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1537 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1538 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1539 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1540 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1541 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1542 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1544 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1545 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1547 case LDKHTLCFailChannelUpdate_NodeFailure: {
1548 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1549 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1550 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1555 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1556 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1557 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1558 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1559 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1560 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1561 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1562 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1563 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1564 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1565 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1566 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1567 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1568 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1569 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1570 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1571 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1572 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1573 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1574 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1575 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1576 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1577 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1578 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1579 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1580 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1581 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1582 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1583 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1584 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1585 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1586 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1587 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1588 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1589 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1590 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1591 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1592 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1594 LDKMessageSendEvent_SendAcceptChannel_class =
1595 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1596 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1597 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1598 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1599 LDKMessageSendEvent_SendOpenChannel_class =
1600 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1601 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1602 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1603 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1604 LDKMessageSendEvent_SendFundingCreated_class =
1605 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1606 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1607 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1608 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1609 LDKMessageSendEvent_SendFundingSigned_class =
1610 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1611 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1612 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1613 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1614 LDKMessageSendEvent_SendFundingLocked_class =
1615 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1616 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1617 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1618 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1619 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1620 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1621 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1622 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1623 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1624 LDKMessageSendEvent_UpdateHTLCs_class =
1625 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1626 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1627 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1628 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1629 LDKMessageSendEvent_SendRevokeAndACK_class =
1630 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1631 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1632 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1633 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1634 LDKMessageSendEvent_SendClosingSigned_class =
1635 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1636 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1637 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1638 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1639 LDKMessageSendEvent_SendShutdown_class =
1640 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1641 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1642 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1643 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1644 LDKMessageSendEvent_SendChannelReestablish_class =
1645 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1646 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1647 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1648 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1649 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1651 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1652 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1653 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1654 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1655 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1656 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1657 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1658 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1659 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1660 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1661 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1662 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1663 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1664 LDKMessageSendEvent_HandleError_class =
1665 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1666 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1667 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1668 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1669 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1670 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1671 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1672 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1673 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1674 LDKMessageSendEvent_SendChannelRangeQuery_class =
1675 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1676 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1677 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1678 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1679 LDKMessageSendEvent_SendShortIdsQuery_class =
1680 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1681 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1682 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1683 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1684 LDKMessageSendEvent_SendReplyChannelRange_class =
1685 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1686 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1687 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1688 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1690 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1691 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1693 case LDKMessageSendEvent_SendAcceptChannel: {
1694 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1695 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1696 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1697 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1698 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1699 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1700 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1702 case LDKMessageSendEvent_SendOpenChannel: {
1703 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1704 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1705 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1706 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1707 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1708 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1709 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1711 case LDKMessageSendEvent_SendFundingCreated: {
1712 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1713 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1714 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1715 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1716 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1717 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1718 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1720 case LDKMessageSendEvent_SendFundingSigned: {
1721 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1722 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1723 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1724 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1725 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1726 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1727 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1729 case LDKMessageSendEvent_SendFundingLocked: {
1730 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1731 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1732 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1733 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1734 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1735 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1736 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1738 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1739 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1740 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1741 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1742 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1743 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1744 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1745 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1747 case LDKMessageSendEvent_UpdateHTLCs: {
1748 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1749 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1750 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1751 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1752 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1753 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1754 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1756 case LDKMessageSendEvent_SendRevokeAndACK: {
1757 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1758 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1759 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1760 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1761 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1762 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1763 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1765 case LDKMessageSendEvent_SendClosingSigned: {
1766 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1767 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1768 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1769 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1770 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1771 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1772 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1774 case LDKMessageSendEvent_SendShutdown: {
1775 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1776 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1777 LDKShutdown msg_var = obj->send_shutdown.msg;
1778 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1779 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1780 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1781 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1783 case LDKMessageSendEvent_SendChannelReestablish: {
1784 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1785 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1786 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1787 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1788 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1789 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1790 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1792 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1793 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1794 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1795 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1796 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1797 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1798 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1799 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1800 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1801 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1803 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1804 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1805 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1806 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1807 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1808 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1810 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1811 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1812 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1813 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1814 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1815 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1817 case LDKMessageSendEvent_HandleError: {
1818 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1819 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1820 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1821 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1823 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1824 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1825 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1827 case LDKMessageSendEvent_SendChannelRangeQuery: {
1828 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1829 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1830 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1833 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1834 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1836 case LDKMessageSendEvent_SendShortIdsQuery: {
1837 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1838 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1839 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1840 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1843 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1845 case LDKMessageSendEvent_SendReplyChannelRange: {
1846 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1847 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1848 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
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 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1852 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1858 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1859 ret->datalen = (*env)->GetArrayLength(env, elems);
1860 if (ret->datalen == 0) {
1863 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1864 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1865 for (size_t i = 0; i < ret->datalen; i++) {
1866 int64_t arr_elem = java_elems[i];
1867 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1868 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1869 ret->data[i] = arr_elem_conv;
1871 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1873 return (uint64_t)ret;
1875 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1876 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1877 for (size_t i = 0; i < ret.datalen; i++) {
1878 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1883 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1886 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1887 CHECK(val->result_ok);
1888 LDKInitFeatures res_var = (*val->contents.result);
1889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1895 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1896 CHECK(!val->result_ok);
1897 LDKDecodeError err_var = (*val->contents.err);
1898 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1899 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1900 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1904 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1907 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1908 CHECK(val->result_ok);
1909 LDKNodeFeatures res_var = (*val->contents.result);
1910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1916 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1917 CHECK(!val->result_ok);
1918 LDKDecodeError err_var = (*val->contents.err);
1919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1925 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1928 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1929 CHECK(val->result_ok);
1930 LDKChannelFeatures res_var = (*val->contents.result);
1931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1937 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1938 CHECK(!val->result_ok);
1939 LDKDecodeError err_var = (*val->contents.err);
1940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1946 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1949 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1950 CHECK(val->result_ok);
1951 LDKInvoiceFeatures res_var = (*val->contents.result);
1952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1958 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1959 CHECK(!val->result_ok);
1960 LDKDecodeError err_var = (*val->contents.err);
1961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1967 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1970 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1971 CHECK(val->result_ok);
1972 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1979 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1980 CHECK(!val->result_ok);
1981 LDKDecodeError err_var = (*val->contents.err);
1982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1988 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1991 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1992 CHECK(val->result_ok);
1993 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1994 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1995 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1996 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2000 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2001 CHECK(!val->result_ok);
2002 LDKDecodeError err_var = (*val->contents.err);
2003 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2004 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2005 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2009 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2012 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2013 CHECK(val->result_ok);
2014 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2018 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2019 CHECK(!val->result_ok);
2020 LDKDecodeError err_var = (*val->contents.err);
2021 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2022 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2023 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2027 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2029 CHECK((*env)->GetArrayLength(env, a) == 64);
2030 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2032 LDKCVec_SignatureZ b_constr;
2033 b_constr.datalen = (*env)->GetArrayLength(env, b);
2034 if (b_constr.datalen > 0)
2035 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2037 b_constr.data = NULL;
2038 for (size_t i = 0; i < b_constr.datalen; i++) {
2039 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2040 LDKSignature b_conv_8_ref;
2041 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2042 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2043 b_constr.data[i] = b_conv_8_ref;
2046 return (uint64_t)ret;
2048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2049 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2050 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2051 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2054 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2055 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2056 LDKCVec_SignatureZ b_var = tuple->b;
2057 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2059 for (size_t i = 0; i < b_var.datalen; i++) {
2060 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2061 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2062 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2067 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2070 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2071 CHECK(val->result_ok);
2072 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2076 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2077 CHECK(!val->result_ok);
2078 return *val->contents.err;
2080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2081 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2084 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2085 CHECK(val->result_ok);
2086 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2087 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2091 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2092 CHECK(!val->result_ok);
2093 return *val->contents.err;
2095 typedef struct LDKBaseSign_JCalls {
2096 atomic_size_t refcnt;
2099 jmethodID get_per_commitment_point_meth;
2100 jmethodID release_commitment_secret_meth;
2101 jmethodID channel_keys_id_meth;
2102 jmethodID sign_counterparty_commitment_meth;
2103 jmethodID sign_holder_commitment_and_htlcs_meth;
2104 jmethodID sign_justice_revoked_output_meth;
2105 jmethodID sign_justice_revoked_htlc_meth;
2106 jmethodID sign_counterparty_htlc_transaction_meth;
2107 jmethodID sign_closing_transaction_meth;
2108 jmethodID sign_channel_announcement_meth;
2109 jmethodID ready_channel_meth;
2110 } LDKBaseSign_JCalls;
2111 static void LDKBaseSign_JCalls_free(void* this_arg) {
2112 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2113 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2116 if (get_jenv_res == JNI_EDETACHED) {
2117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2119 DO_ASSERT(get_jenv_res == JNI_OK);
2121 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2122 if (get_jenv_res == JNI_EDETACHED) {
2123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2128 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2129 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2131 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2132 if (get_jenv_res == JNI_EDETACHED) {
2133 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2135 DO_ASSERT(get_jenv_res == JNI_OK);
2137 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2139 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2140 if ((*env)->ExceptionCheck(env)) {
2141 (*env)->ExceptionDescribe(env);
2142 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2144 LDKPublicKey ret_ref;
2145 CHECK((*env)->GetArrayLength(env, ret) == 33);
2146 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2147 if (get_jenv_res == JNI_EDETACHED) {
2148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2152 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2153 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2155 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2156 if (get_jenv_res == JNI_EDETACHED) {
2157 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2159 DO_ASSERT(get_jenv_res == JNI_OK);
2161 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2163 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2164 if ((*env)->ExceptionCheck(env)) {
2165 (*env)->ExceptionDescribe(env);
2166 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2168 LDKThirtyTwoBytes ret_ref;
2169 CHECK((*env)->GetArrayLength(env, ret) == 32);
2170 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2171 if (get_jenv_res == JNI_EDETACHED) {
2172 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2176 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2177 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2179 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2180 if (get_jenv_res == JNI_EDETACHED) {
2181 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2183 DO_ASSERT(get_jenv_res == JNI_OK);
2185 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2187 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2188 if ((*env)->ExceptionCheck(env)) {
2189 (*env)->ExceptionDescribe(env);
2190 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2192 LDKThirtyTwoBytes ret_ref;
2193 CHECK((*env)->GetArrayLength(env, ret) == 32);
2194 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2195 if (get_jenv_res == JNI_EDETACHED) {
2196 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2200 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2201 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2203 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2204 if (get_jenv_res == JNI_EDETACHED) {
2205 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2207 DO_ASSERT(get_jenv_res == JNI_OK);
2209 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2210 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2211 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2212 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2213 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2214 if (commitment_tx_var.is_owned) {
2215 commitment_tx_ref |= 1;
2217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2219 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2220 if ((*env)->ExceptionCheck(env)) {
2221 (*env)->ExceptionDescribe(env);
2222 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2224 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2225 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2226 if (get_jenv_res == JNI_EDETACHED) {
2227 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2231 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2232 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2234 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2235 if (get_jenv_res == JNI_EDETACHED) {
2236 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2238 DO_ASSERT(get_jenv_res == JNI_OK);
2240 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2241 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2242 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2243 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2244 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2245 if (commitment_tx_var.is_owned) {
2246 commitment_tx_ref |= 1;
2248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2250 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2251 if ((*env)->ExceptionCheck(env)) {
2252 (*env)->ExceptionDescribe(env);
2253 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2255 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2256 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2257 if (get_jenv_res == JNI_EDETACHED) {
2258 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2262 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]) {
2263 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2265 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2266 if (get_jenv_res == JNI_EDETACHED) {
2267 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2269 DO_ASSERT(get_jenv_res == JNI_OK);
2271 LDKTransaction justice_tx_var = justice_tx;
2272 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2273 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2274 Transaction_free(justice_tx_var);
2275 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2276 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2279 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2280 if ((*env)->ExceptionCheck(env)) {
2281 (*env)->ExceptionDescribe(env);
2282 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2284 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2285 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2286 if (get_jenv_res == JNI_EDETACHED) {
2287 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2291 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) {
2292 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2294 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2295 if (get_jenv_res == JNI_EDETACHED) {
2296 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2298 DO_ASSERT(get_jenv_res == JNI_OK);
2300 LDKTransaction justice_tx_var = justice_tx;
2301 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2302 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2303 Transaction_free(justice_tx_var);
2304 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2305 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2306 LDKHTLCOutputInCommitment htlc_var = *htlc;
2307 htlc_var = HTLCOutputInCommitment_clone(htlc);
2308 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2309 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2310 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2311 if (htlc_var.is_owned) {
2314 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2316 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2317 if ((*env)->ExceptionCheck(env)) {
2318 (*env)->ExceptionDescribe(env);
2319 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2321 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2322 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2323 if (get_jenv_res == JNI_EDETACHED) {
2324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2328 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) {
2329 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2331 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2332 if (get_jenv_res == JNI_EDETACHED) {
2333 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2335 DO_ASSERT(get_jenv_res == JNI_OK);
2337 LDKTransaction htlc_tx_var = htlc_tx;
2338 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2339 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2340 Transaction_free(htlc_tx_var);
2341 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2342 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2343 LDKHTLCOutputInCommitment htlc_var = *htlc;
2344 htlc_var = HTLCOutputInCommitment_clone(htlc);
2345 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2346 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2347 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2348 if (htlc_var.is_owned) {
2351 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2353 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2354 if ((*env)->ExceptionCheck(env)) {
2355 (*env)->ExceptionDescribe(env);
2356 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2358 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2359 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2360 if (get_jenv_res == JNI_EDETACHED) {
2361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2365 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2366 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2368 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2369 if (get_jenv_res == JNI_EDETACHED) {
2370 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2372 DO_ASSERT(get_jenv_res == JNI_OK);
2374 LDKTransaction closing_tx_var = closing_tx;
2375 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2376 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2377 Transaction_free(closing_tx_var);
2378 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2380 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2381 if ((*env)->ExceptionCheck(env)) {
2382 (*env)->ExceptionDescribe(env);
2383 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2385 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2386 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2387 if (get_jenv_res == JNI_EDETACHED) {
2388 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2392 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2393 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2396 if (get_jenv_res == JNI_EDETACHED) {
2397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2399 DO_ASSERT(get_jenv_res == JNI_OK);
2401 LDKUnsignedChannelAnnouncement msg_var = *msg;
2402 msg_var = UnsignedChannelAnnouncement_clone(msg);
2403 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2404 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2405 uint64_t msg_ref = (uint64_t)msg_var.inner;
2406 if (msg_var.is_owned) {
2409 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2411 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2412 if ((*env)->ExceptionCheck(env)) {
2413 (*env)->ExceptionDescribe(env);
2414 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2416 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2417 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2418 if (get_jenv_res == JNI_EDETACHED) {
2419 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2423 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2424 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2426 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2427 if (get_jenv_res == JNI_EDETACHED) {
2428 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2430 DO_ASSERT(get_jenv_res == JNI_OK);
2432 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2433 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2434 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2435 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2436 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2437 if (channel_parameters_var.is_owned) {
2438 channel_parameters_ref |= 1;
2440 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2442 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2443 if ((*env)->ExceptionCheck(env)) {
2444 (*env)->ExceptionDescribe(env);
2445 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2447 if (get_jenv_res == JNI_EDETACHED) {
2448 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2451 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2452 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2453 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2454 return (void*) this_arg;
2456 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2457 jclass c = (*env)->GetObjectClass(env, o);
2459 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2460 atomic_init(&calls->refcnt, 1);
2461 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2462 calls->o = (*env)->NewWeakGlobalRef(env, o);
2463 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2464 CHECK(calls->get_per_commitment_point_meth != NULL);
2465 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2466 CHECK(calls->release_commitment_secret_meth != NULL);
2467 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2468 CHECK(calls->channel_keys_id_meth != NULL);
2469 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2470 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2471 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2472 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2473 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2474 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2475 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2476 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2477 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2478 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2479 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2480 CHECK(calls->sign_closing_transaction_meth != NULL);
2481 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2482 CHECK(calls->sign_channel_announcement_meth != NULL);
2483 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2484 CHECK(calls->ready_channel_meth != NULL);
2486 LDKChannelPublicKeys pubkeys_conv;
2487 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2488 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2489 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2492 .this_arg = (void*) calls,
2493 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2494 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2495 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2496 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2497 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2498 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2499 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2500 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2501 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2502 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2503 .ready_channel = ready_channel_LDKBaseSign_jcall,
2504 .free = LDKBaseSign_JCalls_free,
2505 .pubkeys = pubkeys_conv,
2506 .set_pubkeys = NULL,
2510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2511 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2512 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2513 return (uint64_t)res_ptr;
2515 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) {
2516 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2517 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2518 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2523 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2524 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2530 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2531 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2532 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2536 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) {
2537 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2538 LDKCommitmentTransaction commitment_tx_conv;
2539 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2540 commitment_tx_conv.is_owned = false;
2541 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2542 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2543 return (uint64_t)ret_conv;
2546 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) {
2547 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2548 LDKHolderCommitmentTransaction commitment_tx_conv;
2549 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2550 commitment_tx_conv.is_owned = false;
2551 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2552 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2553 return (uint64_t)ret_conv;
2556 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) {
2557 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2558 LDKTransaction justice_tx_ref;
2559 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2560 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2561 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2562 justice_tx_ref.data_is_owned = true;
2563 unsigned char per_commitment_key_arr[32];
2564 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2565 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2566 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2567 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2568 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2569 return (uint64_t)ret_conv;
2572 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) {
2573 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2574 LDKTransaction justice_tx_ref;
2575 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2576 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2577 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2578 justice_tx_ref.data_is_owned = true;
2579 unsigned char per_commitment_key_arr[32];
2580 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2581 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2582 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2583 LDKHTLCOutputInCommitment htlc_conv;
2584 htlc_conv.inner = (void*)(htlc & (~1));
2585 htlc_conv.is_owned = false;
2586 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2587 *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);
2588 return (uint64_t)ret_conv;
2591 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) {
2592 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2593 LDKTransaction htlc_tx_ref;
2594 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2595 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2596 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2597 htlc_tx_ref.data_is_owned = true;
2598 LDKPublicKey per_commitment_point_ref;
2599 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2600 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2601 LDKHTLCOutputInCommitment htlc_conv;
2602 htlc_conv.inner = (void*)(htlc & (~1));
2603 htlc_conv.is_owned = false;
2604 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2605 *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);
2606 return (uint64_t)ret_conv;
2609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2610 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2611 LDKTransaction closing_tx_ref;
2612 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2613 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2614 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2615 closing_tx_ref.data_is_owned = true;
2616 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2617 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2618 return (uint64_t)ret_conv;
2621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2622 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2623 LDKUnsignedChannelAnnouncement msg_conv;
2624 msg_conv.inner = (void*)(msg & (~1));
2625 msg_conv.is_owned = false;
2626 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2627 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2628 return (uint64_t)ret_conv;
2631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2632 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2633 LDKChannelTransactionParameters channel_parameters_conv;
2634 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2635 channel_parameters_conv.is_owned = false;
2636 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2639 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2640 if (this_arg->set_pubkeys != NULL)
2641 this_arg->set_pubkeys(this_arg);
2642 return this_arg->pubkeys;
2644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2645 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2646 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2647 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2648 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2649 uint64_t ret_ref = (uint64_t)ret_var.inner;
2650 if (ret_var.is_owned) {
2656 typedef struct LDKSign_JCalls {
2657 atomic_size_t refcnt;
2660 LDKBaseSign_JCalls* BaseSign;
2661 jmethodID write_meth;
2663 static void LDKSign_JCalls_free(void* this_arg) {
2664 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2665 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2667 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2668 if (get_jenv_res == JNI_EDETACHED) {
2669 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2671 DO_ASSERT(get_jenv_res == JNI_OK);
2673 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2674 if (get_jenv_res == JNI_EDETACHED) {
2675 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2680 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2681 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2683 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2684 if (get_jenv_res == JNI_EDETACHED) {
2685 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2687 DO_ASSERT(get_jenv_res == JNI_OK);
2689 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2691 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2692 if ((*env)->ExceptionCheck(env)) {
2693 (*env)->ExceptionDescribe(env);
2694 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
2696 LDKCVec_u8Z ret_ref;
2697 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2698 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2699 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2700 if (get_jenv_res == JNI_EDETACHED) {
2701 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2705 static void* LDKSign_JCalls_clone(const void* this_arg) {
2706 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2707 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2708 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2709 return (void*) this_arg;
2711 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2712 jclass c = (*env)->GetObjectClass(env, o);
2714 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2715 atomic_init(&calls->refcnt, 1);
2716 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2717 calls->o = (*env)->NewWeakGlobalRef(env, o);
2718 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2719 CHECK(calls->write_meth != NULL);
2721 LDKChannelPublicKeys pubkeys_conv;
2722 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2723 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2724 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2727 .this_arg = (void*) calls,
2728 .write = write_LDKSign_jcall,
2729 .clone = LDKSign_JCalls_clone,
2730 .free = LDKSign_JCalls_free,
2731 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2733 calls->BaseSign = ret.BaseSign.this_arg;
2736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2737 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2738 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2739 return (uint64_t)res_ptr;
2741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2742 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2743 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2744 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2745 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2746 CVec_u8Z_free(ret_var);
2750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2751 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2754 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2755 CHECK(val->result_ok);
2756 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2757 *ret = Sign_clone(&(*val->contents.result));
2758 return (uint64_t)ret;
2760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2761 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2762 CHECK(!val->result_ok);
2763 LDKDecodeError err_var = (*val->contents.err);
2764 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2765 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2766 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2770 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2773 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2774 CHECK(val->result_ok);
2775 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2776 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2780 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2781 CHECK(!val->result_ok);
2782 return *val->contents.err;
2784 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2785 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2786 for (size_t i = 0; i < ret.datalen; i++) {
2787 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2792 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2794 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2795 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2796 CHECK(val->result_ok);
2797 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2798 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2800 for (size_t i = 0; i < res_var.datalen; i++) {
2801 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2802 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2803 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2804 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2809 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2810 CHECK(!val->result_ok);
2811 return *val->contents.err;
2813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2814 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2817 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2818 CHECK(val->result_ok);
2819 LDKInMemorySigner res_var = (*val->contents.result);
2820 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2821 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2822 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2826 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2827 CHECK(!val->result_ok);
2828 LDKDecodeError err_var = (*val->contents.err);
2829 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2830 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2831 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2835 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2836 ret->datalen = (*env)->GetArrayLength(env, elems);
2837 if (ret->datalen == 0) {
2840 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2841 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2842 for (size_t i = 0; i < ret->datalen; i++) {
2843 int64_t arr_elem = java_elems[i];
2844 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2845 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2846 ret->data[i] = arr_elem_conv;
2848 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2850 return (uint64_t)ret;
2852 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2853 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2854 for (size_t i = 0; i < ret.datalen; i++) {
2855 ret.data[i] = TxOut_clone(&orig->data[i]);
2859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2860 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2863 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2864 CHECK(val->result_ok);
2865 LDKTransaction res_var = (*val->contents.result);
2866 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2867 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2871 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2872 CHECK(!val->result_ok);
2873 return *val->contents.err;
2875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2876 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2877 LDKThirtyTwoBytes a_ref;
2878 CHECK((*env)->GetArrayLength(env, a) == 32);
2879 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2881 LDKChannelMonitor b_conv;
2882 b_conv.inner = (void*)(b & (~1));
2883 b_conv.is_owned = (b & 1) || (b == 0);
2884 b_conv = ChannelMonitor_clone(&b_conv);
2886 return (uint64_t)ret;
2888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2889 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2890 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2891 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2895 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2896 LDKChannelMonitor b_var = tuple->b;
2897 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2898 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2899 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2903 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2904 ret->datalen = (*env)->GetArrayLength(env, elems);
2905 if (ret->datalen == 0) {
2908 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2909 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2910 for (size_t i = 0; i < ret->datalen; i++) {
2911 int64_t arr_elem = java_elems[i];
2912 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2913 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2914 ret->data[i] = arr_elem_conv;
2916 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2918 return (uint64_t)ret;
2920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2921 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2923 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2924 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2925 CHECK(val->result_ok);
2926 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2927 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2928 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2929 for (size_t i = 0; i < res_var.datalen; i++) {
2930 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2931 res_arr_ptr[i] = res_conv_34_ref;
2933 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2936 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2937 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2938 CHECK(!val->result_ok);
2939 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2942 static jclass LDKAPIError_APIMisuseError_class = NULL;
2943 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2944 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2945 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2946 static jclass LDKAPIError_RouteError_class = NULL;
2947 static jmethodID LDKAPIError_RouteError_meth = NULL;
2948 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2949 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2950 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2951 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2953 LDKAPIError_APIMisuseError_class =
2954 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2955 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2956 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2957 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2958 LDKAPIError_FeeRateTooHigh_class =
2959 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2960 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2961 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2962 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2963 LDKAPIError_RouteError_class =
2964 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2965 CHECK(LDKAPIError_RouteError_class != NULL);
2966 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2967 CHECK(LDKAPIError_RouteError_meth != NULL);
2968 LDKAPIError_ChannelUnavailable_class =
2969 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2970 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2971 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2972 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2973 LDKAPIError_MonitorUpdateFailed_class =
2974 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2975 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2976 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2977 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2979 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2980 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2982 case LDKAPIError_APIMisuseError: {
2983 LDKStr err_str = obj->api_misuse_error.err;
2984 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2985 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2987 case LDKAPIError_FeeRateTooHigh: {
2988 LDKStr err_str = obj->fee_rate_too_high.err;
2989 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2990 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2992 case LDKAPIError_RouteError: {
2993 LDKStr err_str = obj->route_error.err;
2994 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2995 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2997 case LDKAPIError_ChannelUnavailable: {
2998 LDKStr err_str = obj->channel_unavailable.err;
2999 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3000 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3002 case LDKAPIError_MonitorUpdateFailed: {
3003 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3009 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3012 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3013 CHECK(val->result_ok);
3014 return *val->contents.result;
3016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3017 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3018 CHECK(!val->result_ok);
3019 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3023 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3024 ret->datalen = (*env)->GetArrayLength(env, elems);
3025 if (ret->datalen == 0) {
3028 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3029 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3030 for (size_t i = 0; i < ret->datalen; i++) {
3031 int64_t arr_elem = java_elems[i];
3032 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3033 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3034 ret->data[i] = arr_elem_conv;
3036 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3038 return (uint64_t)ret;
3040 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3041 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3042 for (size_t i = 0; i < ret.datalen; i++) {
3043 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3048 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3049 ret->datalen = (*env)->GetArrayLength(env, elems);
3050 if (ret->datalen == 0) {
3053 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3054 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3055 for (size_t i = 0; i < ret->datalen; i++) {
3056 int64_t arr_elem = java_elems[i];
3057 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3058 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3059 ret->data[i] = arr_elem_conv;
3061 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3063 return (uint64_t)ret;
3065 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3066 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3067 for (size_t i = 0; i < ret.datalen; i++) {
3068 ret.data[i] = APIError_clone(&orig->data[i]);
3072 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3073 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3074 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3075 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3076 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3077 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3078 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3079 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3081 LDKPaymentSendFailure_ParameterError_class =
3082 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3083 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3084 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3085 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3086 LDKPaymentSendFailure_PathParameterError_class =
3087 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3088 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3089 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3090 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3091 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3092 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3093 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3094 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3095 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3096 LDKPaymentSendFailure_PartialFailure_class =
3097 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3098 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3099 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3100 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3102 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3103 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3105 case LDKPaymentSendFailure_ParameterError: {
3106 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3107 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3109 case LDKPaymentSendFailure_PathParameterError: {
3110 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3111 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3112 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3113 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3114 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3115 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3116 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3117 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3119 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3120 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3122 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3123 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3124 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3125 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3126 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3127 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3128 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3130 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3131 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3133 case LDKPaymentSendFailure_PartialFailure: {
3134 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3135 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3136 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3137 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3138 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3139 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3140 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3141 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3143 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3144 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3150 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3153 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3154 CHECK(val->result_ok);
3155 return *val->contents.result;
3157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3158 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3159 CHECK(!val->result_ok);
3160 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3163 static jclass LDKNetAddress_IPv4_class = NULL;
3164 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3165 static jclass LDKNetAddress_IPv6_class = NULL;
3166 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3167 static jclass LDKNetAddress_OnionV2_class = NULL;
3168 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3169 static jclass LDKNetAddress_OnionV3_class = NULL;
3170 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3172 LDKNetAddress_IPv4_class =
3173 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3174 CHECK(LDKNetAddress_IPv4_class != NULL);
3175 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3176 CHECK(LDKNetAddress_IPv4_meth != NULL);
3177 LDKNetAddress_IPv6_class =
3178 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3179 CHECK(LDKNetAddress_IPv6_class != NULL);
3180 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3181 CHECK(LDKNetAddress_IPv6_meth != NULL);
3182 LDKNetAddress_OnionV2_class =
3183 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3184 CHECK(LDKNetAddress_OnionV2_class != NULL);
3185 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3186 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3187 LDKNetAddress_OnionV3_class =
3188 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3189 CHECK(LDKNetAddress_OnionV3_class != NULL);
3190 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3191 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3193 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3194 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3196 case LDKNetAddress_IPv4: {
3197 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3198 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3199 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3201 case LDKNetAddress_IPv6: {
3202 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3203 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3204 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3206 case LDKNetAddress_OnionV2: {
3207 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3208 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3209 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3211 case LDKNetAddress_OnionV3: {
3212 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3213 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3214 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);
3219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3220 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3221 ret->datalen = (*env)->GetArrayLength(env, elems);
3222 if (ret->datalen == 0) {
3225 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3226 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3227 for (size_t i = 0; i < ret->datalen; i++) {
3228 int64_t arr_elem = java_elems[i];
3229 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3230 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3231 ret->data[i] = arr_elem_conv;
3233 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3235 return (uint64_t)ret;
3237 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3238 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3239 for (size_t i = 0; i < ret.datalen; i++) {
3240 ret.data[i] = NetAddress_clone(&orig->data[i]);
3244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3245 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3246 LDKThirtyTwoBytes a_ref;
3247 CHECK((*env)->GetArrayLength(env, a) == 32);
3248 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3250 LDKThirtyTwoBytes b_ref;
3251 CHECK((*env)->GetArrayLength(env, b) == 32);
3252 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3254 return (uint64_t)ret;
3256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3257 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3258 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3259 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3263 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3264 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3265 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3269 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3272 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3273 CHECK(val->result_ok);
3274 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3275 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3279 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3280 CHECK(!val->result_ok);
3281 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3285 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3286 ret->datalen = (*env)->GetArrayLength(env, elems);
3287 if (ret->datalen == 0) {
3290 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3291 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3292 for (size_t i = 0; i < ret->datalen; i++) {
3293 int64_t arr_elem = java_elems[i];
3294 LDKChannelMonitor arr_elem_conv;
3295 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3296 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3297 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3298 ret->data[i] = arr_elem_conv;
3300 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3302 return (uint64_t)ret;
3304 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3305 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3306 for (size_t i = 0; i < ret.datalen; i++) {
3307 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3311 typedef struct LDKWatch_JCalls {
3312 atomic_size_t refcnt;
3315 jmethodID watch_channel_meth;
3316 jmethodID update_channel_meth;
3317 jmethodID release_pending_monitor_events_meth;
3319 static void LDKWatch_JCalls_free(void* this_arg) {
3320 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3321 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3323 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3324 if (get_jenv_res == JNI_EDETACHED) {
3325 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3327 DO_ASSERT(get_jenv_res == JNI_OK);
3329 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3330 if (get_jenv_res == JNI_EDETACHED) {
3331 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3336 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3337 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3339 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3340 if (get_jenv_res == JNI_EDETACHED) {
3341 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3343 DO_ASSERT(get_jenv_res == JNI_OK);
3345 LDKOutPoint funding_txo_var = funding_txo;
3346 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3347 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3348 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3349 if (funding_txo_var.is_owned) {
3350 funding_txo_ref |= 1;
3352 LDKChannelMonitor monitor_var = monitor;
3353 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3354 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3355 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3356 if (monitor_var.is_owned) {
3359 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3361 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3362 if ((*env)->ExceptionCheck(env)) {
3363 (*env)->ExceptionDescribe(env);
3364 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3366 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3367 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3368 if (get_jenv_res == JNI_EDETACHED) {
3369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3373 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3374 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3376 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3377 if (get_jenv_res == JNI_EDETACHED) {
3378 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3380 DO_ASSERT(get_jenv_res == JNI_OK);
3382 LDKOutPoint funding_txo_var = funding_txo;
3383 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3384 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3385 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3386 if (funding_txo_var.is_owned) {
3387 funding_txo_ref |= 1;
3389 LDKChannelMonitorUpdate update_var = update;
3390 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3391 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3392 uint64_t update_ref = (uint64_t)update_var.inner;
3393 if (update_var.is_owned) {
3396 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3398 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3399 if ((*env)->ExceptionCheck(env)) {
3400 (*env)->ExceptionDescribe(env);
3401 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3403 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3404 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3405 if (get_jenv_res == JNI_EDETACHED) {
3406 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3410 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3411 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3413 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3414 if (get_jenv_res == JNI_EDETACHED) {
3415 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3417 DO_ASSERT(get_jenv_res == JNI_OK);
3419 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3421 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3422 if ((*env)->ExceptionCheck(env)) {
3423 (*env)->ExceptionDescribe(env);
3424 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3426 LDKCVec_MonitorEventZ ret_constr;
3427 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3428 if (ret_constr.datalen > 0)
3429 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3431 ret_constr.data = NULL;
3432 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3433 for (size_t o = 0; o < ret_constr.datalen; o++) {
3434 int64_t ret_conv_14 = ret_vals[o];
3435 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3436 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3437 ret_constr.data[o] = ret_conv_14_conv;
3439 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3440 if (get_jenv_res == JNI_EDETACHED) {
3441 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3445 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3446 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3447 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3448 return (void*) this_arg;
3450 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3451 jclass c = (*env)->GetObjectClass(env, o);
3453 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3454 atomic_init(&calls->refcnt, 1);
3455 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3456 calls->o = (*env)->NewWeakGlobalRef(env, o);
3457 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3458 CHECK(calls->watch_channel_meth != NULL);
3459 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3460 CHECK(calls->update_channel_meth != NULL);
3461 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3462 CHECK(calls->release_pending_monitor_events_meth != NULL);
3465 .this_arg = (void*) calls,
3466 .watch_channel = watch_channel_LDKWatch_jcall,
3467 .update_channel = update_channel_LDKWatch_jcall,
3468 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3469 .free = LDKWatch_JCalls_free,
3473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3474 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3475 *res_ptr = LDKWatch_init(env, clz, o);
3476 return (uint64_t)res_ptr;
3478 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) {
3479 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3480 LDKOutPoint funding_txo_conv;
3481 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3482 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3483 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3484 LDKChannelMonitor monitor_conv;
3485 monitor_conv.inner = (void*)(monitor & (~1));
3486 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3487 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3488 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3489 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3490 return (uint64_t)ret_conv;
3493 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) {
3494 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3495 LDKOutPoint funding_txo_conv;
3496 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3497 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3498 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3499 LDKChannelMonitorUpdate update_conv;
3500 update_conv.inner = (void*)(update & (~1));
3501 update_conv.is_owned = (update & 1) || (update == 0);
3502 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3503 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3504 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3505 return (uint64_t)ret_conv;
3508 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3509 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3510 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3511 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3512 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3513 for (size_t o = 0; o < ret_var.datalen; o++) {
3514 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3515 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3516 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3517 ret_arr_ptr[o] = ret_conv_14_ref;
3519 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3524 typedef struct LDKBroadcasterInterface_JCalls {
3525 atomic_size_t refcnt;
3528 jmethodID broadcast_transaction_meth;
3529 } LDKBroadcasterInterface_JCalls;
3530 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3531 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3532 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3534 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3535 if (get_jenv_res == JNI_EDETACHED) {
3536 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3538 DO_ASSERT(get_jenv_res == JNI_OK);
3540 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3541 if (get_jenv_res == JNI_EDETACHED) {
3542 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3547 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3548 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3550 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3551 if (get_jenv_res == JNI_EDETACHED) {
3552 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3554 DO_ASSERT(get_jenv_res == JNI_OK);
3556 LDKTransaction tx_var = tx;
3557 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3558 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3559 Transaction_free(tx_var);
3560 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3562 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3563 if ((*env)->ExceptionCheck(env)) {
3564 (*env)->ExceptionDescribe(env);
3565 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3567 if (get_jenv_res == JNI_EDETACHED) {
3568 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3571 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3572 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3573 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3574 return (void*) this_arg;
3576 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3577 jclass c = (*env)->GetObjectClass(env, o);
3579 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3580 atomic_init(&calls->refcnt, 1);
3581 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3582 calls->o = (*env)->NewWeakGlobalRef(env, o);
3583 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3584 CHECK(calls->broadcast_transaction_meth != NULL);
3586 LDKBroadcasterInterface ret = {
3587 .this_arg = (void*) calls,
3588 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3589 .free = LDKBroadcasterInterface_JCalls_free,
3593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3594 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3595 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3596 return (uint64_t)res_ptr;
3598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3599 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3600 LDKTransaction tx_ref;
3601 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3602 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3603 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3604 tx_ref.data_is_owned = true;
3605 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3608 typedef struct LDKKeysInterface_JCalls {
3609 atomic_size_t refcnt;
3612 jmethodID get_node_secret_meth;
3613 jmethodID get_destination_script_meth;
3614 jmethodID get_shutdown_pubkey_meth;
3615 jmethodID get_channel_signer_meth;
3616 jmethodID get_secure_random_bytes_meth;
3617 jmethodID read_chan_signer_meth;
3618 jmethodID sign_invoice_meth;
3619 } LDKKeysInterface_JCalls;
3620 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3621 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3622 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3624 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3625 if (get_jenv_res == JNI_EDETACHED) {
3626 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3628 DO_ASSERT(get_jenv_res == JNI_OK);
3630 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3631 if (get_jenv_res == JNI_EDETACHED) {
3632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3637 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3638 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3640 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3641 if (get_jenv_res == JNI_EDETACHED) {
3642 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3644 DO_ASSERT(get_jenv_res == JNI_OK);
3646 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3648 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3649 if ((*env)->ExceptionCheck(env)) {
3650 (*env)->ExceptionDescribe(env);
3651 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3653 LDKSecretKey ret_ref;
3654 CHECK((*env)->GetArrayLength(env, ret) == 32);
3655 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3656 if (get_jenv_res == JNI_EDETACHED) {
3657 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3661 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3662 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3664 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3665 if (get_jenv_res == JNI_EDETACHED) {
3666 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3668 DO_ASSERT(get_jenv_res == JNI_OK);
3670 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3672 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3673 if ((*env)->ExceptionCheck(env)) {
3674 (*env)->ExceptionDescribe(env);
3675 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3677 LDKCVec_u8Z ret_ref;
3678 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3679 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3680 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3681 if (get_jenv_res == JNI_EDETACHED) {
3682 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3686 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3687 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3689 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3690 if (get_jenv_res == JNI_EDETACHED) {
3691 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3693 DO_ASSERT(get_jenv_res == JNI_OK);
3695 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3697 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3698 if ((*env)->ExceptionCheck(env)) {
3699 (*env)->ExceptionDescribe(env);
3700 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3702 LDKPublicKey ret_ref;
3703 CHECK((*env)->GetArrayLength(env, ret) == 33);
3704 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3705 if (get_jenv_res == JNI_EDETACHED) {
3706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3710 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3711 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3713 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3714 if (get_jenv_res == JNI_EDETACHED) {
3715 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3717 DO_ASSERT(get_jenv_res == JNI_OK);
3719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3721 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3722 if ((*env)->ExceptionCheck(env)) {
3723 (*env)->ExceptionDescribe(env);
3724 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3726 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3727 ret_conv = Sign_clone(ret);
3728 if (get_jenv_res == JNI_EDETACHED) {
3729 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3733 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3734 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3736 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3737 if (get_jenv_res == JNI_EDETACHED) {
3738 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3740 DO_ASSERT(get_jenv_res == JNI_OK);
3742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3744 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3745 if ((*env)->ExceptionCheck(env)) {
3746 (*env)->ExceptionDescribe(env);
3747 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3749 LDKThirtyTwoBytes ret_ref;
3750 CHECK((*env)->GetArrayLength(env, ret) == 32);
3751 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3752 if (get_jenv_res == JNI_EDETACHED) {
3753 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3757 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3758 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3760 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3761 if (get_jenv_res == JNI_EDETACHED) {
3762 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3764 DO_ASSERT(get_jenv_res == JNI_OK);
3766 LDKu8slice reader_var = reader;
3767 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3768 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3769 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3771 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3772 if ((*env)->ExceptionCheck(env)) {
3773 (*env)->ExceptionDescribe(env);
3774 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3776 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3777 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3778 if (get_jenv_res == JNI_EDETACHED) {
3779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3783 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3784 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3786 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3787 if (get_jenv_res == JNI_EDETACHED) {
3788 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3790 DO_ASSERT(get_jenv_res == JNI_OK);
3792 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3793 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3794 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3795 CVec_u8Z_free(invoice_preimage_var);
3796 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3798 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3799 if ((*env)->ExceptionCheck(env)) {
3800 (*env)->ExceptionDescribe(env);
3801 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3803 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3804 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3805 if (get_jenv_res == JNI_EDETACHED) {
3806 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3810 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3811 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3812 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3813 return (void*) this_arg;
3815 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3816 jclass c = (*env)->GetObjectClass(env, o);
3818 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3819 atomic_init(&calls->refcnt, 1);
3820 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3821 calls->o = (*env)->NewWeakGlobalRef(env, o);
3822 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3823 CHECK(calls->get_node_secret_meth != NULL);
3824 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3825 CHECK(calls->get_destination_script_meth != NULL);
3826 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3827 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3828 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3829 CHECK(calls->get_channel_signer_meth != NULL);
3830 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3831 CHECK(calls->get_secure_random_bytes_meth != NULL);
3832 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3833 CHECK(calls->read_chan_signer_meth != NULL);
3834 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3835 CHECK(calls->sign_invoice_meth != NULL);
3837 LDKKeysInterface ret = {
3838 .this_arg = (void*) calls,
3839 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3840 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3841 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3842 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3843 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3844 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3845 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3846 .free = LDKKeysInterface_JCalls_free,
3850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3851 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3852 *res_ptr = LDKKeysInterface_init(env, clz, o);
3853 return (uint64_t)res_ptr;
3855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3856 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3857 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3858 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3863 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3864 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3865 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3866 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3867 CVec_u8Z_free(ret_var);
3871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3872 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3873 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3878 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) {
3879 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3880 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3881 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3882 return (uint64_t)ret;
3885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3886 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3887 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3893 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3894 LDKu8slice reader_ref;
3895 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3896 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3897 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3898 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3899 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3900 return (uint64_t)ret_conv;
3903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3904 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3905 LDKCVec_u8Z invoice_preimage_ref;
3906 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3907 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3908 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3909 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3910 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3911 return (uint64_t)ret_conv;
3914 typedef struct LDKFeeEstimator_JCalls {
3915 atomic_size_t refcnt;
3918 jmethodID get_est_sat_per_1000_weight_meth;
3919 } LDKFeeEstimator_JCalls;
3920 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3921 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3922 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3924 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3925 if (get_jenv_res == JNI_EDETACHED) {
3926 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3928 DO_ASSERT(get_jenv_res == JNI_OK);
3930 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3931 if (get_jenv_res == JNI_EDETACHED) {
3932 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3937 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3938 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3940 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3941 if (get_jenv_res == JNI_EDETACHED) {
3942 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3944 DO_ASSERT(get_jenv_res == JNI_OK);
3946 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3949 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3950 if ((*env)->ExceptionCheck(env)) {
3951 (*env)->ExceptionDescribe(env);
3952 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
3954 if (get_jenv_res == JNI_EDETACHED) {
3955 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3959 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3960 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3961 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3962 return (void*) this_arg;
3964 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3965 jclass c = (*env)->GetObjectClass(env, o);
3967 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3968 atomic_init(&calls->refcnt, 1);
3969 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3970 calls->o = (*env)->NewWeakGlobalRef(env, o);
3971 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3972 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3974 LDKFeeEstimator ret = {
3975 .this_arg = (void*) calls,
3976 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3977 .free = LDKFeeEstimator_JCalls_free,
3981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3982 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3983 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3984 return (uint64_t)res_ptr;
3986 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) {
3987 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3988 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3989 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3993 typedef struct LDKLogger_JCalls {
3994 atomic_size_t refcnt;
3999 static void LDKLogger_JCalls_free(void* this_arg) {
4000 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4001 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4004 if (get_jenv_res == JNI_EDETACHED) {
4005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4007 DO_ASSERT(get_jenv_res == JNI_OK);
4009 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4010 if (get_jenv_res == JNI_EDETACHED) {
4011 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4016 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4017 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4020 if (get_jenv_res == JNI_EDETACHED) {
4021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4023 DO_ASSERT(get_jenv_res == JNI_OK);
4025 const char* record_str = record;
4026 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4027 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4029 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4030 if ((*env)->ExceptionCheck(env)) {
4031 (*env)->ExceptionDescribe(env);
4032 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
4034 if (get_jenv_res == JNI_EDETACHED) {
4035 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4038 static void* LDKLogger_JCalls_clone(const void* this_arg) {
4039 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4040 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4041 return (void*) this_arg;
4043 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4044 jclass c = (*env)->GetObjectClass(env, o);
4046 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4047 atomic_init(&calls->refcnt, 1);
4048 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4049 calls->o = (*env)->NewWeakGlobalRef(env, o);
4050 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4051 CHECK(calls->log_meth != NULL);
4054 .this_arg = (void*) calls,
4055 .log = log_LDKLogger_jcall,
4056 .free = LDKLogger_JCalls_free,
4060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4061 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4062 *res_ptr = LDKLogger_init(env, clz, o);
4063 return (uint64_t)res_ptr;
4065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4066 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4067 LDKThirtyTwoBytes a_ref;
4068 CHECK((*env)->GetArrayLength(env, a) == 32);
4069 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4071 LDKChannelManager b_conv;
4072 b_conv.inner = (void*)(b & (~1));
4073 b_conv.is_owned = (b & 1) || (b == 0);
4074 // Warning: we need a move here but no clone is available for LDKChannelManager
4076 return (uint64_t)ret;
4078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4079 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4080 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4081 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4085 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4086 LDKChannelManager b_var = tuple->b;
4087 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4088 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4089 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4093 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4096 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4097 CHECK(val->result_ok);
4098 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4102 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4103 CHECK(!val->result_ok);
4104 LDKDecodeError err_var = (*val->contents.err);
4105 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4106 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4107 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4111 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4114 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4115 CHECK(val->result_ok);
4116 LDKChannelConfig res_var = (*val->contents.result);
4117 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4118 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4119 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4123 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4124 CHECK(!val->result_ok);
4125 LDKDecodeError err_var = (*val->contents.err);
4126 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4127 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4128 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4132 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4135 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4136 CHECK(val->result_ok);
4137 LDKOutPoint res_var = (*val->contents.result);
4138 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4139 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4140 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4144 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4145 CHECK(!val->result_ok);
4146 LDKDecodeError err_var = (*val->contents.err);
4147 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4148 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4149 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4153 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4155 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4156 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4157 CHECK(val->result_ok);
4158 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4162 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4163 CHECK(!val->result_ok);
4164 return *val->contents.err;
4166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4167 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4170 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4171 CHECK(val->result_ok);
4172 LDKInvoice res_var = (*val->contents.result);
4173 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4174 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4175 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4179 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4180 CHECK(!val->result_ok);
4181 return *val->contents.err;
4183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4184 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4187 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4188 CHECK(val->result_ok);
4189 LDKSignedRawInvoice res_var = (*val->contents.result);
4190 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4191 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4192 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4196 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4197 CHECK(!val->result_ok);
4198 return *val->contents.err;
4200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
4201 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4202 LDKRawInvoice a_conv;
4203 a_conv.inner = (void*)(a & (~1));
4204 a_conv.is_owned = (a & 1) || (a == 0);
4205 a_conv = RawInvoice_clone(&a_conv);
4207 LDKThirtyTwoBytes b_ref;
4208 CHECK((*env)->GetArrayLength(env, b) == 32);
4209 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4211 LDKInvoiceSignature c_conv;
4212 c_conv.inner = (void*)(c & (~1));
4213 c_conv.is_owned = (c & 1) || (c == 0);
4214 c_conv = InvoiceSignature_clone(&c_conv);
4216 return (uint64_t)ret;
4218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4219 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4220 LDKRawInvoice a_var = tuple->a;
4221 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4222 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4223 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4227 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4228 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4229 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4233 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4234 LDKInvoiceSignature c_var = tuple->c;
4235 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4236 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4237 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4241 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4244 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4245 CHECK(val->result_ok);
4246 LDKPayeePubKey res_var = (*val->contents.result);
4247 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4248 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4249 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4252 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4253 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4254 CHECK(!val->result_ok);
4255 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4259 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4260 ret->datalen = (*env)->GetArrayLength(env, elems);
4261 if (ret->datalen == 0) {
4264 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4265 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4266 for (size_t i = 0; i < ret->datalen; i++) {
4267 int64_t arr_elem = java_elems[i];
4268 LDKPrivateRoute arr_elem_conv;
4269 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4270 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4271 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4272 ret->data[i] = arr_elem_conv;
4274 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4276 return (uint64_t)ret;
4278 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4279 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4280 for (size_t i = 0; i < ret.datalen; i++) {
4281 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4286 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4289 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4290 CHECK(val->result_ok);
4291 LDKPositiveTimestamp res_var = (*val->contents.result);
4292 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4293 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4294 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4297 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4298 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4299 CHECK(!val->result_ok);
4300 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4304 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4307 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4308 CHECK(val->result_ok);
4309 return *val->contents.result;
4311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4312 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4313 CHECK(!val->result_ok);
4314 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4318 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4321 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4322 CHECK(val->result_ok);
4323 LDKInvoice res_var = (*val->contents.result);
4324 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4325 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4326 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4329 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4330 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4331 CHECK(!val->result_ok);
4332 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4336 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4339 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4340 CHECK(val->result_ok);
4341 LDKDescription res_var = (*val->contents.result);
4342 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4343 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4344 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4347 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4348 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4349 CHECK(!val->result_ok);
4350 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4354 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4357 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4358 CHECK(val->result_ok);
4359 LDKExpiryTime res_var = (*val->contents.result);
4360 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4361 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4362 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4365 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4366 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4367 CHECK(!val->result_ok);
4368 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4372 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4375 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4376 CHECK(val->result_ok);
4377 LDKPrivateRoute res_var = (*val->contents.result);
4378 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4379 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4380 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4383 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4384 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4385 CHECK(!val->result_ok);
4386 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4390 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4392 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4393 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4394 CHECK(val->result_ok);
4395 LDKStr res_str = (*val->contents.result);
4396 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4399 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4400 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4401 CHECK(!val->result_ok);
4402 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4406 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4409 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4410 CHECK(val->result_ok);
4411 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4412 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4418 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4419 CHECK(!val->result_ok);
4420 LDKDecodeError err_var = (*val->contents.err);
4421 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4427 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4430 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4431 CHECK(val->result_ok);
4432 LDKHTLCUpdate res_var = (*val->contents.result);
4433 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4439 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4440 CHECK(!val->result_ok);
4441 LDKDecodeError err_var = (*val->contents.err);
4442 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4443 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4444 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4448 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4451 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4452 CHECK(val->result_ok);
4453 return *val->contents.result;
4455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4456 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4457 CHECK(!val->result_ok);
4458 LDKMonitorUpdateError err_var = (*val->contents.err);
4459 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4460 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4461 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4465 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4467 a_conv.inner = (void*)(a & (~1));
4468 a_conv.is_owned = (a & 1) || (a == 0);
4469 a_conv = OutPoint_clone(&a_conv);
4472 b_ref.datalen = (*env)->GetArrayLength(env, b);
4473 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4474 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4476 return (uint64_t)ret;
4478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4479 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4480 LDKOutPoint a_var = tuple->a;
4481 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4487 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4488 LDKCVec_u8Z b_var = tuple->b;
4489 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4490 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4494 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4497 b_ref.datalen = (*env)->GetArrayLength(env, b);
4498 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4499 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4501 return (uint64_t)ret;
4503 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4504 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4508 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4509 LDKCVec_u8Z b_var = tuple->b;
4510 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4511 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4515 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4516 ret->datalen = (*env)->GetArrayLength(env, elems);
4517 if (ret->datalen == 0) {
4520 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4521 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4522 for (size_t i = 0; i < ret->datalen; i++) {
4523 int64_t arr_elem = java_elems[i];
4524 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4525 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4526 ret->data[i] = arr_elem_conv;
4528 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4530 return (uint64_t)ret;
4532 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4533 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4534 for (size_t i = 0; i < ret.datalen; i++) {
4535 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4540 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4541 LDKThirtyTwoBytes a_ref;
4542 CHECK((*env)->GetArrayLength(env, a) == 32);
4543 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4545 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4546 b_constr.datalen = (*env)->GetArrayLength(env, b);
4547 if (b_constr.datalen > 0)
4548 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4550 b_constr.data = NULL;
4551 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4552 for (size_t b = 0; b < b_constr.datalen; b++) {
4553 int64_t b_conv_27 = b_vals[b];
4554 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4555 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4556 b_constr.data[b] = b_conv_27_conv;
4558 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4560 return (uint64_t)ret;
4562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4563 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4564 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4565 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4568 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4569 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4570 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4571 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4572 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4573 for (size_t b = 0; b < b_var.datalen; b++) {
4574 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4575 b_arr_ptr[b] = b_conv_27_ref;
4577 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4581 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4582 ret->datalen = (*env)->GetArrayLength(env, elems);
4583 if (ret->datalen == 0) {
4586 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4587 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4588 for (size_t i = 0; i < ret->datalen; i++) {
4589 int64_t arr_elem = java_elems[i];
4590 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4591 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4592 ret->data[i] = arr_elem_conv;
4594 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4596 return (uint64_t)ret;
4598 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4599 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 };
4600 for (size_t i = 0; i < ret.datalen; i++) {
4601 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4605 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4606 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4607 static jclass LDKEvent_PaymentReceived_class = NULL;
4608 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4609 static jclass LDKEvent_PaymentSent_class = NULL;
4610 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4611 static jclass LDKEvent_PaymentFailed_class = NULL;
4612 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4613 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4614 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4615 static jclass LDKEvent_SpendableOutputs_class = NULL;
4616 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4618 LDKEvent_FundingGenerationReady_class =
4619 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4620 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4621 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4622 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4623 LDKEvent_PaymentReceived_class =
4624 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4625 CHECK(LDKEvent_PaymentReceived_class != NULL);
4626 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4627 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4628 LDKEvent_PaymentSent_class =
4629 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4630 CHECK(LDKEvent_PaymentSent_class != NULL);
4631 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4632 CHECK(LDKEvent_PaymentSent_meth != NULL);
4633 LDKEvent_PaymentFailed_class =
4634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4635 CHECK(LDKEvent_PaymentFailed_class != NULL);
4636 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4637 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4638 LDKEvent_PendingHTLCsForwardable_class =
4639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4640 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4641 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4642 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4643 LDKEvent_SpendableOutputs_class =
4644 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4645 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4646 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4647 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4649 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4650 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4652 case LDKEvent_FundingGenerationReady: {
4653 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4654 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4655 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4656 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4657 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4658 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);
4660 case LDKEvent_PaymentReceived: {
4661 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4662 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4663 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4664 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4665 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4666 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4667 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
4669 case LDKEvent_PaymentSent: {
4670 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4671 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4672 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4674 case LDKEvent_PaymentFailed: {
4675 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4676 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4677 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4679 case LDKEvent_PendingHTLCsForwardable: {
4680 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4682 case LDKEvent_SpendableOutputs: {
4683 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4684 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4685 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4686 for (size_t b = 0; b < outputs_var.datalen; b++) {
4687 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4688 outputs_arr_ptr[b] = outputs_conv_27_ref;
4690 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4691 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4697 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4698 ret->datalen = (*env)->GetArrayLength(env, elems);
4699 if (ret->datalen == 0) {
4702 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4703 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4704 for (size_t i = 0; i < ret->datalen; i++) {
4705 int64_t arr_elem = java_elems[i];
4706 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4707 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4708 ret->data[i] = arr_elem_conv;
4710 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4712 return (uint64_t)ret;
4714 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4715 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4716 for (size_t i = 0; i < ret.datalen; i++) {
4717 ret.data[i] = Event_clone(&orig->data[i]);
4721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4722 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4724 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4725 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4727 return (uint64_t)ret;
4729 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4730 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4734 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4735 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4736 return (uint64_t)b_ref;
4738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4739 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4740 ret->datalen = (*env)->GetArrayLength(env, elems);
4741 if (ret->datalen == 0) {
4744 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4745 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4746 for (size_t i = 0; i < ret->datalen; i++) {
4747 int64_t arr_elem = java_elems[i];
4748 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4749 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4750 ret->data[i] = arr_elem_conv;
4752 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4754 return (uint64_t)ret;
4756 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4757 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4758 for (size_t i = 0; i < ret.datalen; i++) {
4759 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4764 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4765 LDKThirtyTwoBytes a_ref;
4766 CHECK((*env)->GetArrayLength(env, a) == 32);
4767 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4769 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4770 b_constr.datalen = (*env)->GetArrayLength(env, b);
4771 if (b_constr.datalen > 0)
4772 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4774 b_constr.data = NULL;
4775 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4776 for (size_t a = 0; a < b_constr.datalen; a++) {
4777 int64_t b_conv_26 = b_vals[a];
4778 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4779 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4780 b_constr.data[a] = b_conv_26_conv;
4782 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4784 return (uint64_t)ret;
4786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4787 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4788 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4789 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4792 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4793 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4794 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4795 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4796 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4797 for (size_t a = 0; a < b_var.datalen; a++) {
4798 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4799 b_arr_ptr[a] = b_conv_26_ref;
4801 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4805 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4806 ret->datalen = (*env)->GetArrayLength(env, elems);
4807 if (ret->datalen == 0) {
4810 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4811 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4812 for (size_t i = 0; i < ret->datalen; i++) {
4813 int64_t arr_elem = java_elems[i];
4814 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4815 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4816 ret->data[i] = arr_elem_conv;
4818 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4820 return (uint64_t)ret;
4822 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4823 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 };
4824 for (size_t i = 0; i < ret.datalen; i++) {
4825 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4830 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4833 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4834 CHECK(val->result_ok);
4835 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4839 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4840 CHECK(!val->result_ok);
4841 LDKDecodeError err_var = (*val->contents.err);
4842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4848 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4851 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4852 CHECK(val->result_ok);
4853 return *val->contents.result;
4855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4856 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4857 CHECK(!val->result_ok);
4858 LDKLightningError err_var = (*val->contents.err);
4859 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4860 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4861 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
4865 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4866 LDKChannelAnnouncement a_conv;
4867 a_conv.inner = (void*)(a & (~1));
4868 a_conv.is_owned = (a & 1) || (a == 0);
4869 a_conv = ChannelAnnouncement_clone(&a_conv);
4871 LDKChannelUpdate b_conv;
4872 b_conv.inner = (void*)(b & (~1));
4873 b_conv.is_owned = (b & 1) || (b == 0);
4874 b_conv = ChannelUpdate_clone(&b_conv);
4876 LDKChannelUpdate c_conv;
4877 c_conv.inner = (void*)(c & (~1));
4878 c_conv.is_owned = (c & 1) || (c == 0);
4879 c_conv = ChannelUpdate_clone(&c_conv);
4881 return (uint64_t)ret;
4883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4884 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4885 LDKChannelAnnouncement a_var = tuple->a;
4886 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4887 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4888 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4892 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4893 LDKChannelUpdate b_var = tuple->b;
4894 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4895 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4896 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4900 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4901 LDKChannelUpdate c_var = tuple->c;
4902 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4903 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4904 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4908 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4909 ret->datalen = (*env)->GetArrayLength(env, elems);
4910 if (ret->datalen == 0) {
4913 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4914 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4915 for (size_t i = 0; i < ret->datalen; i++) {
4916 int64_t arr_elem = java_elems[i];
4917 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4918 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4919 ret->data[i] = arr_elem_conv;
4921 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4923 return (uint64_t)ret;
4925 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4926 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4927 for (size_t i = 0; i < ret.datalen; i++) {
4928 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4933 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4934 ret->datalen = (*env)->GetArrayLength(env, elems);
4935 if (ret->datalen == 0) {
4938 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4939 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4940 for (size_t i = 0; i < ret->datalen; i++) {
4941 int64_t arr_elem = java_elems[i];
4942 LDKNodeAnnouncement arr_elem_conv;
4943 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4944 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4945 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4946 ret->data[i] = arr_elem_conv;
4948 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4950 return (uint64_t)ret;
4952 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4953 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4954 for (size_t i = 0; i < ret.datalen; i++) {
4955 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4960 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4963 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4964 CHECK(val->result_ok);
4965 return *val->contents.result;
4967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4968 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4969 CHECK(!val->result_ok);
4970 LDKLightningError err_var = (*val->contents.err);
4971 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4972 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4973 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4977 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4980 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4981 CHECK(val->result_ok);
4982 LDKCVec_u8Z res_var = (*val->contents.result);
4983 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4984 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4988 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4989 CHECK(!val->result_ok);
4990 LDKPeerHandleError err_var = (*val->contents.err);
4991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4993 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4997 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5000 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5001 CHECK(val->result_ok);
5002 return *val->contents.result;
5004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5005 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5006 CHECK(!val->result_ok);
5007 LDKPeerHandleError err_var = (*val->contents.err);
5008 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5009 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5010 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5014 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5017 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5018 CHECK(val->result_ok);
5019 return *val->contents.result;
5021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5022 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5023 CHECK(!val->result_ok);
5024 LDKPeerHandleError err_var = (*val->contents.err);
5025 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5026 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5027 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5031 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5034 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5035 CHECK(val->result_ok);
5036 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5037 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5038 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5039 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5043 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5044 CHECK(!val->result_ok);
5045 LDKDecodeError err_var = (*val->contents.err);
5046 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5047 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5048 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5052 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5055 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5056 CHECK(val->result_ok);
5057 LDKChannelInfo res_var = (*val->contents.result);
5058 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5059 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5060 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5064 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5065 CHECK(!val->result_ok);
5066 LDKDecodeError err_var = (*val->contents.err);
5067 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5068 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5069 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5073 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5076 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5077 CHECK(val->result_ok);
5078 LDKRoutingFees res_var = (*val->contents.result);
5079 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5080 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5081 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5085 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5086 CHECK(!val->result_ok);
5087 LDKDecodeError err_var = (*val->contents.err);
5088 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5089 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5090 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5094 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5097 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5098 CHECK(val->result_ok);
5099 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5100 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5101 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5102 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5106 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5107 CHECK(!val->result_ok);
5108 LDKDecodeError err_var = (*val->contents.err);
5109 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5110 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5111 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5115 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5116 ret->datalen = (*env)->GetArrayLength(env, elems);
5117 if (ret->datalen == 0) {
5120 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5121 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5122 for (size_t i = 0; i < ret->datalen; i++) {
5123 ret->data[i] = java_elems[i];
5125 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5127 return (uint64_t)ret;
5129 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5130 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5131 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5135 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5138 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5139 CHECK(val->result_ok);
5140 LDKNodeInfo res_var = (*val->contents.result);
5141 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5142 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5143 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5147 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5148 CHECK(!val->result_ok);
5149 LDKDecodeError err_var = (*val->contents.err);
5150 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5151 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5152 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5156 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5159 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5160 CHECK(val->result_ok);
5161 LDKNetworkGraph res_var = (*val->contents.result);
5162 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5163 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5164 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5168 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5169 CHECK(!val->result_ok);
5170 LDKDecodeError err_var = (*val->contents.err);
5171 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5172 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5173 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5177 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5180 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5181 CHECK(val->result_ok);
5182 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5185 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5186 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5187 CHECK(!val->result_ok);
5188 return *val->contents.err;
5190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5191 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5194 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5195 CHECK(val->result_ok);
5196 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5197 *res_conv = (*val->contents.result);
5198 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5199 return (uint64_t)res_conv;
5201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5202 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5203 CHECK(!val->result_ok);
5204 LDKDecodeError err_var = (*val->contents.err);
5205 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5206 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5207 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5211 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5214 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5215 CHECK(val->result_ok);
5216 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5220 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5221 CHECK(!val->result_ok);
5222 LDKDecodeError err_var = (*val->contents.err);
5223 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5224 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5225 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5229 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5230 ret->datalen = (*env)->GetArrayLength(env, elems);
5231 if (ret->datalen == 0) {
5234 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5235 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5236 for (size_t i = 0; i < ret->datalen; i++) {
5237 int64_t arr_elem = java_elems[i];
5238 LDKUpdateAddHTLC arr_elem_conv;
5239 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5240 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5241 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5242 ret->data[i] = arr_elem_conv;
5244 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5246 return (uint64_t)ret;
5248 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5249 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5250 for (size_t i = 0; i < ret.datalen; i++) {
5251 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5256 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5257 ret->datalen = (*env)->GetArrayLength(env, elems);
5258 if (ret->datalen == 0) {
5261 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5262 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5263 for (size_t i = 0; i < ret->datalen; i++) {
5264 int64_t arr_elem = java_elems[i];
5265 LDKUpdateFulfillHTLC arr_elem_conv;
5266 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5267 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5268 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5269 ret->data[i] = arr_elem_conv;
5271 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5273 return (uint64_t)ret;
5275 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5276 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5277 for (size_t i = 0; i < ret.datalen; i++) {
5278 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5283 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5284 ret->datalen = (*env)->GetArrayLength(env, elems);
5285 if (ret->datalen == 0) {
5288 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5289 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5290 for (size_t i = 0; i < ret->datalen; i++) {
5291 int64_t arr_elem = java_elems[i];
5292 LDKUpdateFailHTLC arr_elem_conv;
5293 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5294 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5295 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5296 ret->data[i] = arr_elem_conv;
5298 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5300 return (uint64_t)ret;
5302 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5303 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5304 for (size_t i = 0; i < ret.datalen; i++) {
5305 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5310 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5311 ret->datalen = (*env)->GetArrayLength(env, elems);
5312 if (ret->datalen == 0) {
5315 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5316 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5317 for (size_t i = 0; i < ret->datalen; i++) {
5318 int64_t arr_elem = java_elems[i];
5319 LDKUpdateFailMalformedHTLC arr_elem_conv;
5320 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5321 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5322 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5323 ret->data[i] = arr_elem_conv;
5325 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5327 return (uint64_t)ret;
5329 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5330 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5331 for (size_t i = 0; i < ret.datalen; i++) {
5332 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5337 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5340 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5341 CHECK(val->result_ok);
5342 LDKAcceptChannel res_var = (*val->contents.result);
5343 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5344 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5345 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5349 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5350 CHECK(!val->result_ok);
5351 LDKDecodeError err_var = (*val->contents.err);
5352 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5353 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5354 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5358 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5361 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5362 CHECK(val->result_ok);
5363 LDKAnnouncementSignatures res_var = (*val->contents.result);
5364 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5365 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5366 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5370 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5371 CHECK(!val->result_ok);
5372 LDKDecodeError err_var = (*val->contents.err);
5373 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5374 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5375 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5379 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5382 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5383 CHECK(val->result_ok);
5384 LDKChannelReestablish res_var = (*val->contents.result);
5385 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5386 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5387 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5391 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5392 CHECK(!val->result_ok);
5393 LDKDecodeError err_var = (*val->contents.err);
5394 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5395 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5396 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5399 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5400 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5403 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5404 CHECK(val->result_ok);
5405 LDKClosingSigned res_var = (*val->contents.result);
5406 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5407 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5408 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5412 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5413 CHECK(!val->result_ok);
5414 LDKDecodeError err_var = (*val->contents.err);
5415 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5416 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5417 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5421 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5424 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5425 CHECK(val->result_ok);
5426 LDKCommitmentSigned res_var = (*val->contents.result);
5427 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5428 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5429 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5433 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5434 CHECK(!val->result_ok);
5435 LDKDecodeError err_var = (*val->contents.err);
5436 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5437 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5438 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5442 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5445 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5446 CHECK(val->result_ok);
5447 LDKFundingCreated res_var = (*val->contents.result);
5448 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5449 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5450 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5454 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5455 CHECK(!val->result_ok);
5456 LDKDecodeError err_var = (*val->contents.err);
5457 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5458 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5459 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5463 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5466 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5467 CHECK(val->result_ok);
5468 LDKFundingSigned res_var = (*val->contents.result);
5469 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5470 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5471 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5475 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5476 CHECK(!val->result_ok);
5477 LDKDecodeError err_var = (*val->contents.err);
5478 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5479 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5480 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5484 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5487 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5488 CHECK(val->result_ok);
5489 LDKFundingLocked res_var = (*val->contents.result);
5490 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5491 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5492 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5496 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5497 CHECK(!val->result_ok);
5498 LDKDecodeError err_var = (*val->contents.err);
5499 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5500 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5501 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5505 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5508 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5509 CHECK(val->result_ok);
5510 LDKInit res_var = (*val->contents.result);
5511 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5512 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5513 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5517 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5518 CHECK(!val->result_ok);
5519 LDKDecodeError err_var = (*val->contents.err);
5520 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5521 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5522 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5526 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5529 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5530 CHECK(val->result_ok);
5531 LDKOpenChannel res_var = (*val->contents.result);
5532 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5533 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5534 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5538 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5539 CHECK(!val->result_ok);
5540 LDKDecodeError err_var = (*val->contents.err);
5541 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5542 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5543 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5547 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5550 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5551 CHECK(val->result_ok);
5552 LDKRevokeAndACK res_var = (*val->contents.result);
5553 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5554 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5555 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5559 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5560 CHECK(!val->result_ok);
5561 LDKDecodeError err_var = (*val->contents.err);
5562 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5563 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5564 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5568 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5571 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5572 CHECK(val->result_ok);
5573 LDKShutdown res_var = (*val->contents.result);
5574 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5575 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5576 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5580 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5581 CHECK(!val->result_ok);
5582 LDKDecodeError err_var = (*val->contents.err);
5583 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5584 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5585 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5589 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5592 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5593 CHECK(val->result_ok);
5594 LDKUpdateFailHTLC res_var = (*val->contents.result);
5595 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5596 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5597 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5601 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5602 CHECK(!val->result_ok);
5603 LDKDecodeError err_var = (*val->contents.err);
5604 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5605 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5606 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5610 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5613 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5614 CHECK(val->result_ok);
5615 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5616 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5617 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5618 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5622 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5623 CHECK(!val->result_ok);
5624 LDKDecodeError err_var = (*val->contents.err);
5625 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5626 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5627 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5631 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5634 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5635 CHECK(val->result_ok);
5636 LDKUpdateFee res_var = (*val->contents.result);
5637 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5638 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5639 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5643 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5644 CHECK(!val->result_ok);
5645 LDKDecodeError err_var = (*val->contents.err);
5646 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5647 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5648 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5652 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5655 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5656 CHECK(val->result_ok);
5657 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5658 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5659 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5660 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5664 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5665 CHECK(!val->result_ok);
5666 LDKDecodeError err_var = (*val->contents.err);
5667 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5668 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5669 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5673 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5676 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5677 CHECK(val->result_ok);
5678 LDKUpdateAddHTLC res_var = (*val->contents.result);
5679 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5680 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5681 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5685 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5686 CHECK(!val->result_ok);
5687 LDKDecodeError err_var = (*val->contents.err);
5688 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5689 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5690 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5694 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5697 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5698 CHECK(val->result_ok);
5699 LDKPing res_var = (*val->contents.result);
5700 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5701 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5702 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5706 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5707 CHECK(!val->result_ok);
5708 LDKDecodeError err_var = (*val->contents.err);
5709 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5710 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5711 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5715 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5718 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5719 CHECK(val->result_ok);
5720 LDKPong res_var = (*val->contents.result);
5721 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5722 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5723 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5727 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5728 CHECK(!val->result_ok);
5729 LDKDecodeError err_var = (*val->contents.err);
5730 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5731 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5732 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5736 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5739 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5740 CHECK(val->result_ok);
5741 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5742 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5743 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5744 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5748 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5749 CHECK(!val->result_ok);
5750 LDKDecodeError err_var = (*val->contents.err);
5751 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5752 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5753 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5757 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5760 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5761 CHECK(val->result_ok);
5762 LDKChannelAnnouncement res_var = (*val->contents.result);
5763 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5764 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5765 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5769 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5770 CHECK(!val->result_ok);
5771 LDKDecodeError err_var = (*val->contents.err);
5772 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5773 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5774 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5778 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5781 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5782 CHECK(val->result_ok);
5783 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5784 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5785 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5786 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5790 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5791 CHECK(!val->result_ok);
5792 LDKDecodeError err_var = (*val->contents.err);
5793 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5794 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5795 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5799 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5802 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5803 CHECK(val->result_ok);
5804 LDKChannelUpdate res_var = (*val->contents.result);
5805 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5806 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5807 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5811 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5812 CHECK(!val->result_ok);
5813 LDKDecodeError err_var = (*val->contents.err);
5814 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5815 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5816 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5820 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5823 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5824 CHECK(val->result_ok);
5825 LDKErrorMessage res_var = (*val->contents.result);
5826 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5827 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5828 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5832 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5833 CHECK(!val->result_ok);
5834 LDKDecodeError err_var = (*val->contents.err);
5835 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5836 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5837 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5841 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5844 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5845 CHECK(val->result_ok);
5846 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5847 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5848 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5849 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5853 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5854 CHECK(!val->result_ok);
5855 LDKDecodeError err_var = (*val->contents.err);
5856 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5857 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5858 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5862 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5865 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5866 CHECK(val->result_ok);
5867 LDKNodeAnnouncement res_var = (*val->contents.result);
5868 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5869 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5870 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5874 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5875 CHECK(!val->result_ok);
5876 LDKDecodeError err_var = (*val->contents.err);
5877 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5878 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5879 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5883 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5886 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5887 CHECK(val->result_ok);
5888 LDKQueryShortChannelIds res_var = (*val->contents.result);
5889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5895 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5896 CHECK(!val->result_ok);
5897 LDKDecodeError err_var = (*val->contents.err);
5898 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5899 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5900 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5904 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5907 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5908 CHECK(val->result_ok);
5909 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5916 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5917 CHECK(!val->result_ok);
5918 LDKDecodeError err_var = (*val->contents.err);
5919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5925 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5928 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5929 CHECK(val->result_ok);
5930 LDKQueryChannelRange res_var = (*val->contents.result);
5931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5937 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5938 CHECK(!val->result_ok);
5939 LDKDecodeError err_var = (*val->contents.err);
5940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5946 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5949 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5950 CHECK(val->result_ok);
5951 LDKReplyChannelRange res_var = (*val->contents.result);
5952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5958 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5959 CHECK(!val->result_ok);
5960 LDKDecodeError err_var = (*val->contents.err);
5961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5967 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5970 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5971 CHECK(val->result_ok);
5972 LDKGossipTimestampFilter res_var = (*val->contents.result);
5973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5979 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5980 CHECK(!val->result_ok);
5981 LDKDecodeError err_var = (*val->contents.err);
5982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5987 static jclass LDKSignOrCreationError_SignError_class = NULL;
5988 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5989 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5990 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5992 LDKSignOrCreationError_SignError_class =
5993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5994 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5995 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5996 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5997 LDKSignOrCreationError_CreationError_class =
5998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
5999 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6000 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6001 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6003 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6004 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6006 case LDKSignOrCreationError_SignError: {
6007 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6009 case LDKSignOrCreationError_CreationError: {
6010 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6011 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6017 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6020 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6021 CHECK(val->result_ok);
6022 LDKInvoice res_var = (*val->contents.result);
6023 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6029 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6030 CHECK(!val->result_ok);
6031 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6034 typedef struct LDKMessageSendEventsProvider_JCalls {
6035 atomic_size_t refcnt;
6038 jmethodID get_and_clear_pending_msg_events_meth;
6039 } LDKMessageSendEventsProvider_JCalls;
6040 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6041 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6042 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6045 if (get_jenv_res == JNI_EDETACHED) {
6046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6048 DO_ASSERT(get_jenv_res == JNI_OK);
6050 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6051 if (get_jenv_res == JNI_EDETACHED) {
6052 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6057 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6058 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6060 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6061 if (get_jenv_res == JNI_EDETACHED) {
6062 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6064 DO_ASSERT(get_jenv_res == JNI_OK);
6066 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6068 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
6069 if ((*env)->ExceptionCheck(env)) {
6070 (*env)->ExceptionDescribe(env);
6071 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6073 LDKCVec_MessageSendEventZ ret_constr;
6074 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6075 if (ret_constr.datalen > 0)
6076 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6078 ret_constr.data = NULL;
6079 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6080 for (size_t s = 0; s < ret_constr.datalen; s++) {
6081 int64_t ret_conv_18 = ret_vals[s];
6082 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
6083 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
6084 ret_constr.data[s] = ret_conv_18_conv;
6086 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6087 if (get_jenv_res == JNI_EDETACHED) {
6088 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6092 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
6093 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6094 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6095 return (void*) this_arg;
6097 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6098 jclass c = (*env)->GetObjectClass(env, o);
6100 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6101 atomic_init(&calls->refcnt, 1);
6102 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6103 calls->o = (*env)->NewWeakGlobalRef(env, o);
6104 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6105 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6107 LDKMessageSendEventsProvider ret = {
6108 .this_arg = (void*) calls,
6109 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6110 .free = LDKMessageSendEventsProvider_JCalls_free,
6114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6115 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6116 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6117 return (uint64_t)res_ptr;
6119 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6120 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6121 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6122 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6123 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6124 for (size_t s = 0; s < ret_var.datalen; s++) {
6125 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6126 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6127 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6128 ret_arr_ptr[s] = ret_conv_18_ref;
6130 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6135 typedef struct LDKEventHandler_JCalls {
6136 atomic_size_t refcnt;
6139 jmethodID handle_event_meth;
6140 } LDKEventHandler_JCalls;
6141 static void LDKEventHandler_JCalls_free(void* this_arg) {
6142 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6143 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6145 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6146 if (get_jenv_res == JNI_EDETACHED) {
6147 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6149 DO_ASSERT(get_jenv_res == JNI_OK);
6151 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6152 if (get_jenv_res == JNI_EDETACHED) {
6153 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6158 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6159 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6161 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6162 if (get_jenv_res == JNI_EDETACHED) {
6163 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6165 DO_ASSERT(get_jenv_res == JNI_OK);
6167 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6168 *event_copy = event;
6169 uint64_t event_ref = (uint64_t)event_copy;
6170 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6172 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6173 if ((*env)->ExceptionCheck(env)) {
6174 (*env)->ExceptionDescribe(env);
6175 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6177 if (get_jenv_res == JNI_EDETACHED) {
6178 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6181 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6182 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6183 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6184 return (void*) this_arg;
6186 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6187 jclass c = (*env)->GetObjectClass(env, o);
6189 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6190 atomic_init(&calls->refcnt, 1);
6191 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6192 calls->o = (*env)->NewWeakGlobalRef(env, o);
6193 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6194 CHECK(calls->handle_event_meth != NULL);
6196 LDKEventHandler ret = {
6197 .this_arg = (void*) calls,
6198 .handle_event = handle_event_LDKEventHandler_jcall,
6199 .free = LDKEventHandler_JCalls_free,
6203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6204 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6205 *res_ptr = LDKEventHandler_init(env, clz, o);
6206 return (uint64_t)res_ptr;
6208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6209 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6210 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6211 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6214 typedef struct LDKEventsProvider_JCalls {
6215 atomic_size_t refcnt;
6218 jmethodID process_pending_events_meth;
6219 } LDKEventsProvider_JCalls;
6220 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6221 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6222 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6224 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6225 if (get_jenv_res == JNI_EDETACHED) {
6226 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6228 DO_ASSERT(get_jenv_res == JNI_OK);
6230 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6231 if (get_jenv_res == JNI_EDETACHED) {
6232 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6237 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6238 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6240 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6241 if (get_jenv_res == JNI_EDETACHED) {
6242 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6244 DO_ASSERT(get_jenv_res == JNI_OK);
6246 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6250 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6251 if ((*env)->ExceptionCheck(env)) {
6252 (*env)->ExceptionDescribe(env);
6253 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6255 if (get_jenv_res == JNI_EDETACHED) {
6256 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6259 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6260 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6261 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6262 return (void*) this_arg;
6264 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6265 jclass c = (*env)->GetObjectClass(env, o);
6267 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6268 atomic_init(&calls->refcnt, 1);
6269 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6270 calls->o = (*env)->NewWeakGlobalRef(env, o);
6271 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6272 CHECK(calls->process_pending_events_meth != NULL);
6274 LDKEventsProvider ret = {
6275 .this_arg = (void*) calls,
6276 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6277 .free = LDKEventsProvider_JCalls_free,
6281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6282 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6283 *res_ptr = LDKEventsProvider_init(env, clz, o);
6284 return (uint64_t)res_ptr;
6286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6287 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6288 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6289 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6291 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6293 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6296 typedef struct LDKAccess_JCalls {
6297 atomic_size_t refcnt;
6300 jmethodID get_utxo_meth;
6302 static void LDKAccess_JCalls_free(void* this_arg) {
6303 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6304 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6306 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6307 if (get_jenv_res == JNI_EDETACHED) {
6308 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6310 DO_ASSERT(get_jenv_res == JNI_OK);
6312 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6313 if (get_jenv_res == JNI_EDETACHED) {
6314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6319 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6320 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6322 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6323 if (get_jenv_res == JNI_EDETACHED) {
6324 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6326 DO_ASSERT(get_jenv_res == JNI_OK);
6328 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6329 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6330 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6332 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6333 if ((*env)->ExceptionCheck(env)) {
6334 (*env)->ExceptionDescribe(env);
6335 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6337 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6338 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6339 if (get_jenv_res == JNI_EDETACHED) {
6340 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6344 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6345 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6346 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6347 return (void*) this_arg;
6349 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6350 jclass c = (*env)->GetObjectClass(env, o);
6352 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6353 atomic_init(&calls->refcnt, 1);
6354 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6355 calls->o = (*env)->NewWeakGlobalRef(env, o);
6356 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6357 CHECK(calls->get_utxo_meth != NULL);
6360 .this_arg = (void*) calls,
6361 .get_utxo = get_utxo_LDKAccess_jcall,
6362 .free = LDKAccess_JCalls_free,
6366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6367 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6368 *res_ptr = LDKAccess_init(env, clz, o);
6369 return (uint64_t)res_ptr;
6371 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) {
6372 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6373 unsigned char genesis_hash_arr[32];
6374 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6375 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6376 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6377 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6378 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6379 return (uint64_t)ret_conv;
6382 typedef struct LDKListen_JCalls {
6383 atomic_size_t refcnt;
6386 jmethodID block_connected_meth;
6387 jmethodID block_disconnected_meth;
6389 static void LDKListen_JCalls_free(void* this_arg) {
6390 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6391 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6393 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6394 if (get_jenv_res == JNI_EDETACHED) {
6395 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6397 DO_ASSERT(get_jenv_res == JNI_OK);
6399 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6400 if (get_jenv_res == JNI_EDETACHED) {
6401 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6406 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6407 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6409 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6410 if (get_jenv_res == JNI_EDETACHED) {
6411 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6413 DO_ASSERT(get_jenv_res == JNI_OK);
6415 LDKu8slice block_var = block;
6416 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6417 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6418 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6420 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6421 if ((*env)->ExceptionCheck(env)) {
6422 (*env)->ExceptionDescribe(env);
6423 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6425 if (get_jenv_res == JNI_EDETACHED) {
6426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6429 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6430 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6432 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6433 if (get_jenv_res == JNI_EDETACHED) {
6434 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6436 DO_ASSERT(get_jenv_res == JNI_OK);
6438 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6439 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6440 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6442 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6443 if ((*env)->ExceptionCheck(env)) {
6444 (*env)->ExceptionDescribe(env);
6445 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6447 if (get_jenv_res == JNI_EDETACHED) {
6448 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6451 static void* LDKListen_JCalls_clone(const void* this_arg) {
6452 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6453 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6454 return (void*) this_arg;
6456 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6457 jclass c = (*env)->GetObjectClass(env, o);
6459 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6460 atomic_init(&calls->refcnt, 1);
6461 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6462 calls->o = (*env)->NewWeakGlobalRef(env, o);
6463 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6464 CHECK(calls->block_connected_meth != NULL);
6465 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6466 CHECK(calls->block_disconnected_meth != NULL);
6469 .this_arg = (void*) calls,
6470 .block_connected = block_connected_LDKListen_jcall,
6471 .block_disconnected = block_disconnected_LDKListen_jcall,
6472 .free = LDKListen_JCalls_free,
6476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6477 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6478 *res_ptr = LDKListen_init(env, clz, o);
6479 return (uint64_t)res_ptr;
6481 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) {
6482 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6483 LDKu8slice block_ref;
6484 block_ref.datalen = (*env)->GetArrayLength(env, block);
6485 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6486 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6487 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6490 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) {
6491 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6492 unsigned char header_arr[80];
6493 CHECK((*env)->GetArrayLength(env, header) == 80);
6494 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6495 unsigned char (*header_ref)[80] = &header_arr;
6496 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6499 typedef struct LDKConfirm_JCalls {
6500 atomic_size_t refcnt;
6503 jmethodID transactions_confirmed_meth;
6504 jmethodID transaction_unconfirmed_meth;
6505 jmethodID best_block_updated_meth;
6506 jmethodID get_relevant_txids_meth;
6507 } LDKConfirm_JCalls;
6508 static void LDKConfirm_JCalls_free(void* this_arg) {
6509 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6510 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6512 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6513 if (get_jenv_res == JNI_EDETACHED) {
6514 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6516 DO_ASSERT(get_jenv_res == JNI_OK);
6518 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6519 if (get_jenv_res == JNI_EDETACHED) {
6520 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6525 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6526 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6528 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6529 if (get_jenv_res == JNI_EDETACHED) {
6530 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6532 DO_ASSERT(get_jenv_res == JNI_OK);
6534 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6535 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6536 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6537 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6538 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6539 for (size_t y = 0; y < txdata_var.datalen; y++) {
6540 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6541 *txdata_conv_24_ref = txdata_var.data[y];
6542 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6544 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6545 FREE(txdata_var.data);
6546 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6548 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6549 if ((*env)->ExceptionCheck(env)) {
6550 (*env)->ExceptionDescribe(env);
6551 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6553 if (get_jenv_res == JNI_EDETACHED) {
6554 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6557 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6558 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6560 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6561 if (get_jenv_res == JNI_EDETACHED) {
6562 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6564 DO_ASSERT(get_jenv_res == JNI_OK);
6566 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6567 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6568 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6570 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6571 if ((*env)->ExceptionCheck(env)) {
6572 (*env)->ExceptionDescribe(env);
6573 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6575 if (get_jenv_res == JNI_EDETACHED) {
6576 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6579 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6580 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6582 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6583 if (get_jenv_res == JNI_EDETACHED) {
6584 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6586 DO_ASSERT(get_jenv_res == JNI_OK);
6588 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6589 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6590 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6592 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6593 if ((*env)->ExceptionCheck(env)) {
6594 (*env)->ExceptionDescribe(env);
6595 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6597 if (get_jenv_res == JNI_EDETACHED) {
6598 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6601 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6602 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6604 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6605 if (get_jenv_res == JNI_EDETACHED) {
6606 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6608 DO_ASSERT(get_jenv_res == JNI_OK);
6610 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6612 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6613 if ((*env)->ExceptionCheck(env)) {
6614 (*env)->ExceptionDescribe(env);
6615 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6617 LDKCVec_TxidZ ret_constr;
6618 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6619 if (ret_constr.datalen > 0)
6620 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6622 ret_constr.data = NULL;
6623 for (size_t i = 0; i < ret_constr.datalen; i++) {
6624 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6625 LDKThirtyTwoBytes ret_conv_8_ref;
6626 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6627 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6628 ret_constr.data[i] = ret_conv_8_ref;
6630 if (get_jenv_res == JNI_EDETACHED) {
6631 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6635 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6636 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6637 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6638 return (void*) this_arg;
6640 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6641 jclass c = (*env)->GetObjectClass(env, o);
6643 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6644 atomic_init(&calls->refcnt, 1);
6645 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6646 calls->o = (*env)->NewWeakGlobalRef(env, o);
6647 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6648 CHECK(calls->transactions_confirmed_meth != NULL);
6649 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6650 CHECK(calls->transaction_unconfirmed_meth != NULL);
6651 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6652 CHECK(calls->best_block_updated_meth != NULL);
6653 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6654 CHECK(calls->get_relevant_txids_meth != NULL);
6657 .this_arg = (void*) calls,
6658 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6659 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6660 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6661 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6662 .free = LDKConfirm_JCalls_free,
6666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6667 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6668 *res_ptr = LDKConfirm_init(env, clz, o);
6669 return (uint64_t)res_ptr;
6671 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) {
6672 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6673 unsigned char header_arr[80];
6674 CHECK((*env)->GetArrayLength(env, header) == 80);
6675 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6676 unsigned char (*header_ref)[80] = &header_arr;
6677 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6678 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6679 if (txdata_constr.datalen > 0)
6680 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6682 txdata_constr.data = NULL;
6683 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6684 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6685 int64_t txdata_conv_24 = txdata_vals[y];
6686 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6687 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6688 txdata_constr.data[y] = txdata_conv_24_conv;
6690 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6691 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6695 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6696 unsigned char txid_arr[32];
6697 CHECK((*env)->GetArrayLength(env, txid) == 32);
6698 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6699 unsigned char (*txid_ref)[32] = &txid_arr;
6700 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6703 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) {
6704 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6705 unsigned char header_arr[80];
6706 CHECK((*env)->GetArrayLength(env, header) == 80);
6707 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6708 unsigned char (*header_ref)[80] = &header_arr;
6709 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6712 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6713 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6714 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6715 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6717 for (size_t i = 0; i < ret_var.datalen; i++) {
6718 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6719 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6720 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6726 typedef struct LDKFilter_JCalls {
6727 atomic_size_t refcnt;
6730 jmethodID register_tx_meth;
6731 jmethodID register_output_meth;
6733 static void LDKFilter_JCalls_free(void* this_arg) {
6734 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6735 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6737 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6738 if (get_jenv_res == JNI_EDETACHED) {
6739 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6741 DO_ASSERT(get_jenv_res == JNI_OK);
6743 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6744 if (get_jenv_res == JNI_EDETACHED) {
6745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6750 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6751 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6753 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6754 if (get_jenv_res == JNI_EDETACHED) {
6755 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6757 DO_ASSERT(get_jenv_res == JNI_OK);
6759 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6760 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6761 LDKu8slice script_pubkey_var = script_pubkey;
6762 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6763 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6764 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6766 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6767 if ((*env)->ExceptionCheck(env)) {
6768 (*env)->ExceptionDescribe(env);
6769 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6771 if (get_jenv_res == JNI_EDETACHED) {
6772 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6775 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6776 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6778 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6779 if (get_jenv_res == JNI_EDETACHED) {
6780 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6782 DO_ASSERT(get_jenv_res == JNI_OK);
6784 LDKWatchedOutput output_var = output;
6785 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6786 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6787 uint64_t output_ref = (uint64_t)output_var.inner;
6788 if (output_var.is_owned) {
6791 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6793 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6794 if ((*env)->ExceptionCheck(env)) {
6795 (*env)->ExceptionDescribe(env);
6796 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6798 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6799 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6800 if (get_jenv_res == JNI_EDETACHED) {
6801 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6805 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6806 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6807 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6808 return (void*) this_arg;
6810 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6811 jclass c = (*env)->GetObjectClass(env, o);
6813 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6814 atomic_init(&calls->refcnt, 1);
6815 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6816 calls->o = (*env)->NewWeakGlobalRef(env, o);
6817 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6818 CHECK(calls->register_tx_meth != NULL);
6819 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6820 CHECK(calls->register_output_meth != NULL);
6823 .this_arg = (void*) calls,
6824 .register_tx = register_tx_LDKFilter_jcall,
6825 .register_output = register_output_LDKFilter_jcall,
6826 .free = LDKFilter_JCalls_free,
6830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6831 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6832 *res_ptr = LDKFilter_init(env, clz, o);
6833 return (uint64_t)res_ptr;
6835 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) {
6836 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6837 unsigned char txid_arr[32];
6838 CHECK((*env)->GetArrayLength(env, txid) == 32);
6839 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6840 unsigned char (*txid_ref)[32] = &txid_arr;
6841 LDKu8slice script_pubkey_ref;
6842 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6843 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6844 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6845 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6849 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6850 LDKWatchedOutput output_conv;
6851 output_conv.inner = (void*)(output & (~1));
6852 output_conv.is_owned = (output & 1) || (output == 0);
6853 output_conv = WatchedOutput_clone(&output_conv);
6854 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6855 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6856 uint64_t ret_ref = (uint64_t)ret_copy;
6860 typedef struct LDKPersist_JCalls {
6861 atomic_size_t refcnt;
6864 jmethodID persist_new_channel_meth;
6865 jmethodID update_persisted_channel_meth;
6866 } LDKPersist_JCalls;
6867 static void LDKPersist_JCalls_free(void* this_arg) {
6868 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6869 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6871 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6872 if (get_jenv_res == JNI_EDETACHED) {
6873 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6875 DO_ASSERT(get_jenv_res == JNI_OK);
6877 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6878 if (get_jenv_res == JNI_EDETACHED) {
6879 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6884 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6885 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6887 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6888 if (get_jenv_res == JNI_EDETACHED) {
6889 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6891 DO_ASSERT(get_jenv_res == JNI_OK);
6893 LDKOutPoint id_var = id;
6894 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6895 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6896 uint64_t id_ref = (uint64_t)id_var.inner;
6897 if (id_var.is_owned) {
6900 LDKChannelMonitor data_var = *data;
6901 data_var = ChannelMonitor_clone(data);
6902 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6903 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6904 uint64_t data_ref = (uint64_t)data_var.inner;
6905 if (data_var.is_owned) {
6908 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6910 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6911 if ((*env)->ExceptionCheck(env)) {
6912 (*env)->ExceptionDescribe(env);
6913 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6915 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6916 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6917 if (get_jenv_res == JNI_EDETACHED) {
6918 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6922 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6923 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6925 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6926 if (get_jenv_res == JNI_EDETACHED) {
6927 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6929 DO_ASSERT(get_jenv_res == JNI_OK);
6931 LDKOutPoint id_var = id;
6932 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6933 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6934 uint64_t id_ref = (uint64_t)id_var.inner;
6935 if (id_var.is_owned) {
6938 LDKChannelMonitorUpdate update_var = *update;
6939 update_var = ChannelMonitorUpdate_clone(update);
6940 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6941 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6942 uint64_t update_ref = (uint64_t)update_var.inner;
6943 if (update_var.is_owned) {
6946 LDKChannelMonitor data_var = *data;
6947 data_var = ChannelMonitor_clone(data);
6948 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6949 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6950 uint64_t data_ref = (uint64_t)data_var.inner;
6951 if (data_var.is_owned) {
6954 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6956 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6957 if ((*env)->ExceptionCheck(env)) {
6958 (*env)->ExceptionDescribe(env);
6959 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
6961 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6962 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6963 if (get_jenv_res == JNI_EDETACHED) {
6964 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6968 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6969 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6970 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6971 return (void*) this_arg;
6973 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6974 jclass c = (*env)->GetObjectClass(env, o);
6976 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6977 atomic_init(&calls->refcnt, 1);
6978 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6979 calls->o = (*env)->NewWeakGlobalRef(env, o);
6980 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6981 CHECK(calls->persist_new_channel_meth != NULL);
6982 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6983 CHECK(calls->update_persisted_channel_meth != NULL);
6986 .this_arg = (void*) calls,
6987 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6988 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6989 .free = LDKPersist_JCalls_free,
6993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6994 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6995 *res_ptr = LDKPersist_init(env, clz, o);
6996 return (uint64_t)res_ptr;
6998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
6999 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7000 LDKOutPoint id_conv;
7001 id_conv.inner = (void*)(id & (~1));
7002 id_conv.is_owned = (id & 1) || (id == 0);
7003 id_conv = OutPoint_clone(&id_conv);
7004 LDKChannelMonitor data_conv;
7005 data_conv.inner = (void*)(data & (~1));
7006 data_conv.is_owned = false;
7007 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7008 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7009 return (uint64_t)ret_conv;
7012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
7013 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7014 LDKOutPoint id_conv;
7015 id_conv.inner = (void*)(id & (~1));
7016 id_conv.is_owned = (id & 1) || (id == 0);
7017 id_conv = OutPoint_clone(&id_conv);
7018 LDKChannelMonitorUpdate update_conv;
7019 update_conv.inner = (void*)(update & (~1));
7020 update_conv.is_owned = false;
7021 LDKChannelMonitor data_conv;
7022 data_conv.inner = (void*)(data & (~1));
7023 data_conv.is_owned = false;
7024 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7025 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7026 return (uint64_t)ret_conv;
7029 typedef struct LDKChannelMessageHandler_JCalls {
7030 atomic_size_t refcnt;
7033 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7034 jmethodID handle_open_channel_meth;
7035 jmethodID handle_accept_channel_meth;
7036 jmethodID handle_funding_created_meth;
7037 jmethodID handle_funding_signed_meth;
7038 jmethodID handle_funding_locked_meth;
7039 jmethodID handle_shutdown_meth;
7040 jmethodID handle_closing_signed_meth;
7041 jmethodID handle_update_add_htlc_meth;
7042 jmethodID handle_update_fulfill_htlc_meth;
7043 jmethodID handle_update_fail_htlc_meth;
7044 jmethodID handle_update_fail_malformed_htlc_meth;
7045 jmethodID handle_commitment_signed_meth;
7046 jmethodID handle_revoke_and_ack_meth;
7047 jmethodID handle_update_fee_meth;
7048 jmethodID handle_announcement_signatures_meth;
7049 jmethodID peer_disconnected_meth;
7050 jmethodID peer_connected_meth;
7051 jmethodID handle_channel_reestablish_meth;
7052 jmethodID handle_channel_update_meth;
7053 jmethodID handle_error_meth;
7054 } LDKChannelMessageHandler_JCalls;
7055 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7056 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7057 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7059 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7060 if (get_jenv_res == JNI_EDETACHED) {
7061 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7063 DO_ASSERT(get_jenv_res == JNI_OK);
7065 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7066 if (get_jenv_res == JNI_EDETACHED) {
7067 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7072 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7073 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7075 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7076 if (get_jenv_res == JNI_EDETACHED) {
7077 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7079 DO_ASSERT(get_jenv_res == JNI_OK);
7081 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7082 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7083 LDKInitFeatures their_features_var = their_features;
7084 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7085 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7086 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7087 if (their_features_var.is_owned) {
7088 their_features_ref |= 1;
7090 LDKOpenChannel msg_var = *msg;
7091 msg_var = OpenChannel_clone(msg);
7092 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7093 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7094 uint64_t msg_ref = (uint64_t)msg_var.inner;
7095 if (msg_var.is_owned) {
7098 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7100 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7101 if ((*env)->ExceptionCheck(env)) {
7102 (*env)->ExceptionDescribe(env);
7103 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7105 if (get_jenv_res == JNI_EDETACHED) {
7106 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7109 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7110 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7113 if (get_jenv_res == JNI_EDETACHED) {
7114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7116 DO_ASSERT(get_jenv_res == JNI_OK);
7118 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7119 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7120 LDKInitFeatures their_features_var = their_features;
7121 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7122 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7123 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7124 if (their_features_var.is_owned) {
7125 their_features_ref |= 1;
7127 LDKAcceptChannel msg_var = *msg;
7128 msg_var = AcceptChannel_clone(msg);
7129 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7130 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7131 uint64_t msg_ref = (uint64_t)msg_var.inner;
7132 if (msg_var.is_owned) {
7135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7137 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7138 if ((*env)->ExceptionCheck(env)) {
7139 (*env)->ExceptionDescribe(env);
7140 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7142 if (get_jenv_res == JNI_EDETACHED) {
7143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7146 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7147 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7149 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7150 if (get_jenv_res == JNI_EDETACHED) {
7151 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7153 DO_ASSERT(get_jenv_res == JNI_OK);
7155 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7156 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7157 LDKFundingCreated msg_var = *msg;
7158 msg_var = FundingCreated_clone(msg);
7159 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7160 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7161 uint64_t msg_ref = (uint64_t)msg_var.inner;
7162 if (msg_var.is_owned) {
7165 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7167 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7168 if ((*env)->ExceptionCheck(env)) {
7169 (*env)->ExceptionDescribe(env);
7170 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7172 if (get_jenv_res == JNI_EDETACHED) {
7173 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7176 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7177 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7179 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7180 if (get_jenv_res == JNI_EDETACHED) {
7181 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7183 DO_ASSERT(get_jenv_res == JNI_OK);
7185 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7186 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7187 LDKFundingSigned msg_var = *msg;
7188 msg_var = FundingSigned_clone(msg);
7189 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7190 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7191 uint64_t msg_ref = (uint64_t)msg_var.inner;
7192 if (msg_var.is_owned) {
7195 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7197 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7198 if ((*env)->ExceptionCheck(env)) {
7199 (*env)->ExceptionDescribe(env);
7200 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7202 if (get_jenv_res == JNI_EDETACHED) {
7203 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7206 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7207 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7209 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7210 if (get_jenv_res == JNI_EDETACHED) {
7211 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7213 DO_ASSERT(get_jenv_res == JNI_OK);
7215 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7216 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7217 LDKFundingLocked msg_var = *msg;
7218 msg_var = FundingLocked_clone(msg);
7219 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7220 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7221 uint64_t msg_ref = (uint64_t)msg_var.inner;
7222 if (msg_var.is_owned) {
7225 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7227 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7228 if ((*env)->ExceptionCheck(env)) {
7229 (*env)->ExceptionDescribe(env);
7230 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7232 if (get_jenv_res == JNI_EDETACHED) {
7233 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7236 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7237 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7239 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7240 if (get_jenv_res == JNI_EDETACHED) {
7241 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7243 DO_ASSERT(get_jenv_res == JNI_OK);
7245 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7246 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7247 LDKInitFeatures their_features_var = *their_features;
7248 their_features_var = InitFeatures_clone(their_features);
7249 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7250 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7251 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7252 if (their_features_var.is_owned) {
7253 their_features_ref |= 1;
7255 LDKShutdown msg_var = *msg;
7256 msg_var = Shutdown_clone(msg);
7257 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7258 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7259 uint64_t msg_ref = (uint64_t)msg_var.inner;
7260 if (msg_var.is_owned) {
7263 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7265 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7266 if ((*env)->ExceptionCheck(env)) {
7267 (*env)->ExceptionDescribe(env);
7268 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7270 if (get_jenv_res == JNI_EDETACHED) {
7271 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7274 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7275 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7277 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7278 if (get_jenv_res == JNI_EDETACHED) {
7279 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7281 DO_ASSERT(get_jenv_res == JNI_OK);
7283 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7284 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7285 LDKClosingSigned msg_var = *msg;
7286 msg_var = ClosingSigned_clone(msg);
7287 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7288 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7289 uint64_t msg_ref = (uint64_t)msg_var.inner;
7290 if (msg_var.is_owned) {
7293 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7295 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7296 if ((*env)->ExceptionCheck(env)) {
7297 (*env)->ExceptionDescribe(env);
7298 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7300 if (get_jenv_res == JNI_EDETACHED) {
7301 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7304 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7305 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7307 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7308 if (get_jenv_res == JNI_EDETACHED) {
7309 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7311 DO_ASSERT(get_jenv_res == JNI_OK);
7313 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7314 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7315 LDKUpdateAddHTLC msg_var = *msg;
7316 msg_var = UpdateAddHTLC_clone(msg);
7317 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7318 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7319 uint64_t msg_ref = (uint64_t)msg_var.inner;
7320 if (msg_var.is_owned) {
7323 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7325 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7326 if ((*env)->ExceptionCheck(env)) {
7327 (*env)->ExceptionDescribe(env);
7328 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7330 if (get_jenv_res == JNI_EDETACHED) {
7331 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7334 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7335 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7337 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7338 if (get_jenv_res == JNI_EDETACHED) {
7339 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7341 DO_ASSERT(get_jenv_res == JNI_OK);
7343 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7344 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7345 LDKUpdateFulfillHTLC msg_var = *msg;
7346 msg_var = UpdateFulfillHTLC_clone(msg);
7347 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7348 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7349 uint64_t msg_ref = (uint64_t)msg_var.inner;
7350 if (msg_var.is_owned) {
7353 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7355 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7356 if ((*env)->ExceptionCheck(env)) {
7357 (*env)->ExceptionDescribe(env);
7358 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7360 if (get_jenv_res == JNI_EDETACHED) {
7361 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7364 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7365 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7367 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7368 if (get_jenv_res == JNI_EDETACHED) {
7369 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7371 DO_ASSERT(get_jenv_res == JNI_OK);
7373 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7374 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7375 LDKUpdateFailHTLC msg_var = *msg;
7376 msg_var = UpdateFailHTLC_clone(msg);
7377 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7378 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7379 uint64_t msg_ref = (uint64_t)msg_var.inner;
7380 if (msg_var.is_owned) {
7383 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7385 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7386 if ((*env)->ExceptionCheck(env)) {
7387 (*env)->ExceptionDescribe(env);
7388 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7390 if (get_jenv_res == JNI_EDETACHED) {
7391 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7394 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7395 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7397 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7398 if (get_jenv_res == JNI_EDETACHED) {
7399 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7401 DO_ASSERT(get_jenv_res == JNI_OK);
7403 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7404 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7405 LDKUpdateFailMalformedHTLC msg_var = *msg;
7406 msg_var = UpdateFailMalformedHTLC_clone(msg);
7407 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7408 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7409 uint64_t msg_ref = (uint64_t)msg_var.inner;
7410 if (msg_var.is_owned) {
7413 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7415 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7416 if ((*env)->ExceptionCheck(env)) {
7417 (*env)->ExceptionDescribe(env);
7418 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7420 if (get_jenv_res == JNI_EDETACHED) {
7421 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7424 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7425 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7427 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7428 if (get_jenv_res == JNI_EDETACHED) {
7429 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7431 DO_ASSERT(get_jenv_res == JNI_OK);
7433 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7434 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7435 LDKCommitmentSigned msg_var = *msg;
7436 msg_var = CommitmentSigned_clone(msg);
7437 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7438 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7439 uint64_t msg_ref = (uint64_t)msg_var.inner;
7440 if (msg_var.is_owned) {
7443 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7445 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7446 if ((*env)->ExceptionCheck(env)) {
7447 (*env)->ExceptionDescribe(env);
7448 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7450 if (get_jenv_res == JNI_EDETACHED) {
7451 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7454 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7455 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7457 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7458 if (get_jenv_res == JNI_EDETACHED) {
7459 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7461 DO_ASSERT(get_jenv_res == JNI_OK);
7463 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7464 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7465 LDKRevokeAndACK msg_var = *msg;
7466 msg_var = RevokeAndACK_clone(msg);
7467 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7468 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7469 uint64_t msg_ref = (uint64_t)msg_var.inner;
7470 if (msg_var.is_owned) {
7473 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7475 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7476 if ((*env)->ExceptionCheck(env)) {
7477 (*env)->ExceptionDescribe(env);
7478 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7480 if (get_jenv_res == JNI_EDETACHED) {
7481 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7484 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7485 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7487 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7488 if (get_jenv_res == JNI_EDETACHED) {
7489 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7491 DO_ASSERT(get_jenv_res == JNI_OK);
7493 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7494 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7495 LDKUpdateFee msg_var = *msg;
7496 msg_var = UpdateFee_clone(msg);
7497 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7498 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7499 uint64_t msg_ref = (uint64_t)msg_var.inner;
7500 if (msg_var.is_owned) {
7503 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7505 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7506 if ((*env)->ExceptionCheck(env)) {
7507 (*env)->ExceptionDescribe(env);
7508 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7510 if (get_jenv_res == JNI_EDETACHED) {
7511 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7514 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7515 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7517 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7518 if (get_jenv_res == JNI_EDETACHED) {
7519 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7521 DO_ASSERT(get_jenv_res == JNI_OK);
7523 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7524 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7525 LDKAnnouncementSignatures msg_var = *msg;
7526 msg_var = AnnouncementSignatures_clone(msg);
7527 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7528 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7529 uint64_t msg_ref = (uint64_t)msg_var.inner;
7530 if (msg_var.is_owned) {
7533 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7535 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7536 if ((*env)->ExceptionCheck(env)) {
7537 (*env)->ExceptionDescribe(env);
7538 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7540 if (get_jenv_res == JNI_EDETACHED) {
7541 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7544 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7545 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7547 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7548 if (get_jenv_res == JNI_EDETACHED) {
7549 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7551 DO_ASSERT(get_jenv_res == JNI_OK);
7553 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7554 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7555 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7557 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7558 if ((*env)->ExceptionCheck(env)) {
7559 (*env)->ExceptionDescribe(env);
7560 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7562 if (get_jenv_res == JNI_EDETACHED) {
7563 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7566 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7567 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7569 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7570 if (get_jenv_res == JNI_EDETACHED) {
7571 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7573 DO_ASSERT(get_jenv_res == JNI_OK);
7575 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7576 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7577 LDKInit msg_var = *msg;
7578 msg_var = Init_clone(msg);
7579 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7580 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7581 uint64_t msg_ref = (uint64_t)msg_var.inner;
7582 if (msg_var.is_owned) {
7585 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7587 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7588 if ((*env)->ExceptionCheck(env)) {
7589 (*env)->ExceptionDescribe(env);
7590 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7592 if (get_jenv_res == JNI_EDETACHED) {
7593 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7596 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7597 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7599 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7600 if (get_jenv_res == JNI_EDETACHED) {
7601 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7603 DO_ASSERT(get_jenv_res == JNI_OK);
7605 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7606 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7607 LDKChannelReestablish msg_var = *msg;
7608 msg_var = ChannelReestablish_clone(msg);
7609 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7610 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7611 uint64_t msg_ref = (uint64_t)msg_var.inner;
7612 if (msg_var.is_owned) {
7615 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7617 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7618 if ((*env)->ExceptionCheck(env)) {
7619 (*env)->ExceptionDescribe(env);
7620 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7622 if (get_jenv_res == JNI_EDETACHED) {
7623 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7626 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7627 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7629 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7630 if (get_jenv_res == JNI_EDETACHED) {
7631 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7633 DO_ASSERT(get_jenv_res == JNI_OK);
7635 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7636 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7637 LDKChannelUpdate msg_var = *msg;
7638 msg_var = ChannelUpdate_clone(msg);
7639 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7640 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7641 uint64_t msg_ref = (uint64_t)msg_var.inner;
7642 if (msg_var.is_owned) {
7645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7647 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7648 if ((*env)->ExceptionCheck(env)) {
7649 (*env)->ExceptionDescribe(env);
7650 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7652 if (get_jenv_res == JNI_EDETACHED) {
7653 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7656 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7657 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7659 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7660 if (get_jenv_res == JNI_EDETACHED) {
7661 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7663 DO_ASSERT(get_jenv_res == JNI_OK);
7665 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7666 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7667 LDKErrorMessage msg_var = *msg;
7668 msg_var = ErrorMessage_clone(msg);
7669 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7670 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7671 uint64_t msg_ref = (uint64_t)msg_var.inner;
7672 if (msg_var.is_owned) {
7675 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7677 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7678 if ((*env)->ExceptionCheck(env)) {
7679 (*env)->ExceptionDescribe(env);
7680 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
7682 if (get_jenv_res == JNI_EDETACHED) {
7683 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7686 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7687 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7688 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7689 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7690 return (void*) this_arg;
7692 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7693 jclass c = (*env)->GetObjectClass(env, o);
7695 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7696 atomic_init(&calls->refcnt, 1);
7697 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7698 calls->o = (*env)->NewWeakGlobalRef(env, o);
7699 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7700 CHECK(calls->handle_open_channel_meth != NULL);
7701 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7702 CHECK(calls->handle_accept_channel_meth != NULL);
7703 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7704 CHECK(calls->handle_funding_created_meth != NULL);
7705 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7706 CHECK(calls->handle_funding_signed_meth != NULL);
7707 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7708 CHECK(calls->handle_funding_locked_meth != NULL);
7709 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7710 CHECK(calls->handle_shutdown_meth != NULL);
7711 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7712 CHECK(calls->handle_closing_signed_meth != NULL);
7713 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7714 CHECK(calls->handle_update_add_htlc_meth != NULL);
7715 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7716 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7717 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7718 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7719 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7720 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7721 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7722 CHECK(calls->handle_commitment_signed_meth != NULL);
7723 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7724 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7725 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7726 CHECK(calls->handle_update_fee_meth != NULL);
7727 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7728 CHECK(calls->handle_announcement_signatures_meth != NULL);
7729 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7730 CHECK(calls->peer_disconnected_meth != NULL);
7731 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7732 CHECK(calls->peer_connected_meth != NULL);
7733 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7734 CHECK(calls->handle_channel_reestablish_meth != NULL);
7735 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7736 CHECK(calls->handle_channel_update_meth != NULL);
7737 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7738 CHECK(calls->handle_error_meth != NULL);
7740 LDKChannelMessageHandler ret = {
7741 .this_arg = (void*) calls,
7742 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7743 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7744 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7745 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7746 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7747 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7748 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7749 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7750 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7751 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7752 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7753 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7754 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7755 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7756 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7757 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7758 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7759 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7760 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7761 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7762 .free = LDKChannelMessageHandler_JCalls_free,
7763 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7765 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7769 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7770 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7771 return (uint64_t)res_ptr;
7773 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) {
7774 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7775 LDKPublicKey their_node_id_ref;
7776 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7777 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7778 LDKInitFeatures their_features_conv;
7779 their_features_conv.inner = (void*)(their_features & (~1));
7780 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7781 their_features_conv = InitFeatures_clone(&their_features_conv);
7782 LDKOpenChannel msg_conv;
7783 msg_conv.inner = (void*)(msg & (~1));
7784 msg_conv.is_owned = false;
7785 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7788 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) {
7789 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7790 LDKPublicKey their_node_id_ref;
7791 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7792 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7793 LDKInitFeatures their_features_conv;
7794 their_features_conv.inner = (void*)(their_features & (~1));
7795 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7796 their_features_conv = InitFeatures_clone(&their_features_conv);
7797 LDKAcceptChannel msg_conv;
7798 msg_conv.inner = (void*)(msg & (~1));
7799 msg_conv.is_owned = false;
7800 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7803 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) {
7804 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7805 LDKPublicKey their_node_id_ref;
7806 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7807 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7808 LDKFundingCreated msg_conv;
7809 msg_conv.inner = (void*)(msg & (~1));
7810 msg_conv.is_owned = false;
7811 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7814 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) {
7815 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7816 LDKPublicKey their_node_id_ref;
7817 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7818 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7819 LDKFundingSigned msg_conv;
7820 msg_conv.inner = (void*)(msg & (~1));
7821 msg_conv.is_owned = false;
7822 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7825 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) {
7826 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7827 LDKPublicKey their_node_id_ref;
7828 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7829 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7830 LDKFundingLocked msg_conv;
7831 msg_conv.inner = (void*)(msg & (~1));
7832 msg_conv.is_owned = false;
7833 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7836 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) {
7837 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7838 LDKPublicKey their_node_id_ref;
7839 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7840 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7841 LDKInitFeatures their_features_conv;
7842 their_features_conv.inner = (void*)(their_features & (~1));
7843 their_features_conv.is_owned = false;
7844 LDKShutdown msg_conv;
7845 msg_conv.inner = (void*)(msg & (~1));
7846 msg_conv.is_owned = false;
7847 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7850 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) {
7851 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7852 LDKPublicKey their_node_id_ref;
7853 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7854 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7855 LDKClosingSigned msg_conv;
7856 msg_conv.inner = (void*)(msg & (~1));
7857 msg_conv.is_owned = false;
7858 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7861 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) {
7862 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7863 LDKPublicKey their_node_id_ref;
7864 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7865 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7866 LDKUpdateAddHTLC msg_conv;
7867 msg_conv.inner = (void*)(msg & (~1));
7868 msg_conv.is_owned = false;
7869 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7872 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) {
7873 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7874 LDKPublicKey their_node_id_ref;
7875 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7876 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7877 LDKUpdateFulfillHTLC msg_conv;
7878 msg_conv.inner = (void*)(msg & (~1));
7879 msg_conv.is_owned = false;
7880 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7883 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) {
7884 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7885 LDKPublicKey their_node_id_ref;
7886 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7887 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7888 LDKUpdateFailHTLC msg_conv;
7889 msg_conv.inner = (void*)(msg & (~1));
7890 msg_conv.is_owned = false;
7891 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7894 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) {
7895 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7896 LDKPublicKey their_node_id_ref;
7897 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7898 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7899 LDKUpdateFailMalformedHTLC msg_conv;
7900 msg_conv.inner = (void*)(msg & (~1));
7901 msg_conv.is_owned = false;
7902 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7905 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) {
7906 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7907 LDKPublicKey their_node_id_ref;
7908 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7909 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7910 LDKCommitmentSigned msg_conv;
7911 msg_conv.inner = (void*)(msg & (~1));
7912 msg_conv.is_owned = false;
7913 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7916 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) {
7917 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7918 LDKPublicKey their_node_id_ref;
7919 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7920 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7921 LDKRevokeAndACK msg_conv;
7922 msg_conv.inner = (void*)(msg & (~1));
7923 msg_conv.is_owned = false;
7924 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7927 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) {
7928 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7929 LDKPublicKey their_node_id_ref;
7930 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7931 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7932 LDKUpdateFee msg_conv;
7933 msg_conv.inner = (void*)(msg & (~1));
7934 msg_conv.is_owned = false;
7935 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7938 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) {
7939 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7940 LDKPublicKey their_node_id_ref;
7941 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7942 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7943 LDKAnnouncementSignatures msg_conv;
7944 msg_conv.inner = (void*)(msg & (~1));
7945 msg_conv.is_owned = false;
7946 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7949 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) {
7950 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7951 LDKPublicKey their_node_id_ref;
7952 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7953 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7954 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7957 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) {
7958 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7959 LDKPublicKey their_node_id_ref;
7960 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7961 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7963 msg_conv.inner = (void*)(msg & (~1));
7964 msg_conv.is_owned = false;
7965 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7968 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) {
7969 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7970 LDKPublicKey their_node_id_ref;
7971 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7972 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7973 LDKChannelReestablish msg_conv;
7974 msg_conv.inner = (void*)(msg & (~1));
7975 msg_conv.is_owned = false;
7976 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7979 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) {
7980 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7981 LDKPublicKey their_node_id_ref;
7982 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7983 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7984 LDKChannelUpdate msg_conv;
7985 msg_conv.inner = (void*)(msg & (~1));
7986 msg_conv.is_owned = false;
7987 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7990 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) {
7991 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7992 LDKPublicKey their_node_id_ref;
7993 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7994 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7995 LDKErrorMessage msg_conv;
7996 msg_conv.inner = (void*)(msg & (~1));
7997 msg_conv.is_owned = false;
7998 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8001 typedef struct LDKRoutingMessageHandler_JCalls {
8002 atomic_size_t refcnt;
8005 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8006 jmethodID handle_node_announcement_meth;
8007 jmethodID handle_channel_announcement_meth;
8008 jmethodID handle_channel_update_meth;
8009 jmethodID handle_htlc_fail_channel_update_meth;
8010 jmethodID get_next_channel_announcements_meth;
8011 jmethodID get_next_node_announcements_meth;
8012 jmethodID sync_routing_table_meth;
8013 jmethodID handle_reply_channel_range_meth;
8014 jmethodID handle_reply_short_channel_ids_end_meth;
8015 jmethodID handle_query_channel_range_meth;
8016 jmethodID handle_query_short_channel_ids_meth;
8017 } LDKRoutingMessageHandler_JCalls;
8018 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8019 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8020 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8022 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8023 if (get_jenv_res == JNI_EDETACHED) {
8024 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8026 DO_ASSERT(get_jenv_res == JNI_OK);
8028 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8029 if (get_jenv_res == JNI_EDETACHED) {
8030 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8035 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8036 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8038 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8039 if (get_jenv_res == JNI_EDETACHED) {
8040 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8042 DO_ASSERT(get_jenv_res == JNI_OK);
8044 LDKNodeAnnouncement msg_var = *msg;
8045 msg_var = NodeAnnouncement_clone(msg);
8046 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8047 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8048 uint64_t msg_ref = (uint64_t)msg_var.inner;
8049 if (msg_var.is_owned) {
8052 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8054 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8055 if ((*env)->ExceptionCheck(env)) {
8056 (*env)->ExceptionDescribe(env);
8057 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8059 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8060 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8061 if (get_jenv_res == JNI_EDETACHED) {
8062 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8066 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8067 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8069 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8070 if (get_jenv_res == JNI_EDETACHED) {
8071 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8073 DO_ASSERT(get_jenv_res == JNI_OK);
8075 LDKChannelAnnouncement msg_var = *msg;
8076 msg_var = ChannelAnnouncement_clone(msg);
8077 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8078 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8079 uint64_t msg_ref = (uint64_t)msg_var.inner;
8080 if (msg_var.is_owned) {
8083 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8085 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8086 if ((*env)->ExceptionCheck(env)) {
8087 (*env)->ExceptionDescribe(env);
8088 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8090 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8091 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8092 if (get_jenv_res == JNI_EDETACHED) {
8093 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8097 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8098 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8100 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8101 if (get_jenv_res == JNI_EDETACHED) {
8102 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8104 DO_ASSERT(get_jenv_res == JNI_OK);
8106 LDKChannelUpdate msg_var = *msg;
8107 msg_var = ChannelUpdate_clone(msg);
8108 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8109 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8110 uint64_t msg_ref = (uint64_t)msg_var.inner;
8111 if (msg_var.is_owned) {
8114 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8116 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8117 if ((*env)->ExceptionCheck(env)) {
8118 (*env)->ExceptionDescribe(env);
8119 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8121 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8122 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8123 if (get_jenv_res == JNI_EDETACHED) {
8124 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8128 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
8129 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8131 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8132 if (get_jenv_res == JNI_EDETACHED) {
8133 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8135 DO_ASSERT(get_jenv_res == JNI_OK);
8137 uint64_t ret_update = (uint64_t)update;
8138 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8140 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
8141 if ((*env)->ExceptionCheck(env)) {
8142 (*env)->ExceptionDescribe(env);
8143 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8145 if (get_jenv_res == JNI_EDETACHED) {
8146 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8149 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8150 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8152 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8153 if (get_jenv_res == JNI_EDETACHED) {
8154 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8156 DO_ASSERT(get_jenv_res == JNI_OK);
8158 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8160 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8161 if ((*env)->ExceptionCheck(env)) {
8162 (*env)->ExceptionDescribe(env);
8163 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8165 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8166 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8167 if (ret_constr.datalen > 0)
8168 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8170 ret_constr.data = NULL;
8171 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8172 for (size_t l = 0; l < ret_constr.datalen; l++) {
8173 int64_t ret_conv_63 = ret_vals[l];
8174 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8175 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8176 ret_constr.data[l] = ret_conv_63_conv;
8178 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8179 if (get_jenv_res == JNI_EDETACHED) {
8180 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8184 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8185 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8187 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8188 if (get_jenv_res == JNI_EDETACHED) {
8189 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8191 DO_ASSERT(get_jenv_res == JNI_OK);
8193 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
8194 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
8195 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8197 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
8198 if ((*env)->ExceptionCheck(env)) {
8199 (*env)->ExceptionDescribe(env);
8200 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8202 LDKCVec_NodeAnnouncementZ ret_constr;
8203 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8204 if (ret_constr.datalen > 0)
8205 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8207 ret_constr.data = NULL;
8208 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8209 for (size_t s = 0; s < ret_constr.datalen; s++) {
8210 int64_t ret_conv_18 = ret_vals[s];
8211 LDKNodeAnnouncement ret_conv_18_conv;
8212 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8213 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8214 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
8215 ret_constr.data[s] = ret_conv_18_conv;
8217 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8218 if (get_jenv_res == JNI_EDETACHED) {
8219 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8223 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8224 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8227 if (get_jenv_res == JNI_EDETACHED) {
8228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8230 DO_ASSERT(get_jenv_res == JNI_OK);
8232 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8233 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8234 LDKInit init_var = *init;
8235 init_var = Init_clone(init);
8236 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8237 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8238 uint64_t init_ref = (uint64_t)init_var.inner;
8239 if (init_var.is_owned) {
8242 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8244 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
8245 if ((*env)->ExceptionCheck(env)) {
8246 (*env)->ExceptionDescribe(env);
8247 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8249 if (get_jenv_res == JNI_EDETACHED) {
8250 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8253 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8254 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8256 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8257 if (get_jenv_res == JNI_EDETACHED) {
8258 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8260 DO_ASSERT(get_jenv_res == JNI_OK);
8262 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8263 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8264 LDKReplyChannelRange msg_var = msg;
8265 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8266 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8267 uint64_t msg_ref = (uint64_t)msg_var.inner;
8268 if (msg_var.is_owned) {
8271 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8273 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8274 if ((*env)->ExceptionCheck(env)) {
8275 (*env)->ExceptionDescribe(env);
8276 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8278 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8279 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8280 if (get_jenv_res == JNI_EDETACHED) {
8281 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8285 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8286 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8288 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8289 if (get_jenv_res == JNI_EDETACHED) {
8290 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8292 DO_ASSERT(get_jenv_res == JNI_OK);
8294 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8295 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8296 LDKReplyShortChannelIdsEnd msg_var = msg;
8297 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8298 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8299 uint64_t msg_ref = (uint64_t)msg_var.inner;
8300 if (msg_var.is_owned) {
8303 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8305 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8306 if ((*env)->ExceptionCheck(env)) {
8307 (*env)->ExceptionDescribe(env);
8308 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8310 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8311 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8312 if (get_jenv_res == JNI_EDETACHED) {
8313 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8317 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8318 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8320 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8321 if (get_jenv_res == JNI_EDETACHED) {
8322 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8324 DO_ASSERT(get_jenv_res == JNI_OK);
8326 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8327 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8328 LDKQueryChannelRange msg_var = msg;
8329 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8330 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8331 uint64_t msg_ref = (uint64_t)msg_var.inner;
8332 if (msg_var.is_owned) {
8335 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8337 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8338 if ((*env)->ExceptionCheck(env)) {
8339 (*env)->ExceptionDescribe(env);
8340 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8342 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8343 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8344 if (get_jenv_res == JNI_EDETACHED) {
8345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8349 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8350 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8353 if (get_jenv_res == JNI_EDETACHED) {
8354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8356 DO_ASSERT(get_jenv_res == JNI_OK);
8358 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8359 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8360 LDKQueryShortChannelIds msg_var = msg;
8361 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8362 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8363 uint64_t msg_ref = (uint64_t)msg_var.inner;
8364 if (msg_var.is_owned) {
8367 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8369 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8370 if ((*env)->ExceptionCheck(env)) {
8371 (*env)->ExceptionDescribe(env);
8372 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8374 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8375 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8376 if (get_jenv_res == JNI_EDETACHED) {
8377 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8381 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8382 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8383 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8384 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8385 return (void*) this_arg;
8387 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8388 jclass c = (*env)->GetObjectClass(env, o);
8390 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8391 atomic_init(&calls->refcnt, 1);
8392 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8393 calls->o = (*env)->NewWeakGlobalRef(env, o);
8394 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8395 CHECK(calls->handle_node_announcement_meth != NULL);
8396 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8397 CHECK(calls->handle_channel_announcement_meth != NULL);
8398 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8399 CHECK(calls->handle_channel_update_meth != NULL);
8400 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8401 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8402 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8403 CHECK(calls->get_next_channel_announcements_meth != NULL);
8404 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8405 CHECK(calls->get_next_node_announcements_meth != NULL);
8406 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8407 CHECK(calls->sync_routing_table_meth != NULL);
8408 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8409 CHECK(calls->handle_reply_channel_range_meth != NULL);
8410 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8411 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8412 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8413 CHECK(calls->handle_query_channel_range_meth != NULL);
8414 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8415 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8417 LDKRoutingMessageHandler ret = {
8418 .this_arg = (void*) calls,
8419 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8420 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8421 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8422 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8423 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8424 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8425 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8426 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8427 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8428 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8429 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8430 .free = LDKRoutingMessageHandler_JCalls_free,
8431 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8433 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8437 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8438 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8439 return (uint64_t)res_ptr;
8441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8442 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8443 LDKNodeAnnouncement msg_conv;
8444 msg_conv.inner = (void*)(msg & (~1));
8445 msg_conv.is_owned = false;
8446 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8447 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8448 return (uint64_t)ret_conv;
8451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8452 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8453 LDKChannelAnnouncement msg_conv;
8454 msg_conv.inner = (void*)(msg & (~1));
8455 msg_conv.is_owned = false;
8456 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8457 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8458 return (uint64_t)ret_conv;
8461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8462 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8463 LDKChannelUpdate msg_conv;
8464 msg_conv.inner = (void*)(msg & (~1));
8465 msg_conv.is_owned = false;
8466 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8467 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8468 return (uint64_t)ret_conv;
8471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
8472 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8473 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8474 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8477 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) {
8478 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8479 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8480 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8481 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8482 for (size_t l = 0; l < ret_var.datalen; l++) {
8483 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8484 *ret_conv_63_ref = ret_var.data[l];
8485 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8487 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8492 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) {
8493 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8494 LDKPublicKey starting_point_ref;
8495 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8496 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8497 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8498 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8499 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8500 for (size_t s = 0; s < ret_var.datalen; s++) {
8501 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8502 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8503 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8504 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8505 if (ret_conv_18_var.is_owned) {
8506 ret_conv_18_ref |= 1;
8508 ret_arr_ptr[s] = ret_conv_18_ref;
8510 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8515 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) {
8516 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8517 LDKPublicKey their_node_id_ref;
8518 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8519 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8521 init_conv.inner = (void*)(init & (~1));
8522 init_conv.is_owned = false;
8523 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8526 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) {
8527 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8528 LDKPublicKey their_node_id_ref;
8529 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8530 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8531 LDKReplyChannelRange msg_conv;
8532 msg_conv.inner = (void*)(msg & (~1));
8533 msg_conv.is_owned = (msg & 1) || (msg == 0);
8534 msg_conv = ReplyChannelRange_clone(&msg_conv);
8535 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8536 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8537 return (uint64_t)ret_conv;
8540 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) {
8541 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8542 LDKPublicKey their_node_id_ref;
8543 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8544 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8545 LDKReplyShortChannelIdsEnd msg_conv;
8546 msg_conv.inner = (void*)(msg & (~1));
8547 msg_conv.is_owned = (msg & 1) || (msg == 0);
8548 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8549 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8550 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8551 return (uint64_t)ret_conv;
8554 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) {
8555 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8556 LDKPublicKey their_node_id_ref;
8557 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8558 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8559 LDKQueryChannelRange msg_conv;
8560 msg_conv.inner = (void*)(msg & (~1));
8561 msg_conv.is_owned = (msg & 1) || (msg == 0);
8562 msg_conv = QueryChannelRange_clone(&msg_conv);
8563 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8564 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8565 return (uint64_t)ret_conv;
8568 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) {
8569 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8570 LDKPublicKey their_node_id_ref;
8571 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8572 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8573 LDKQueryShortChannelIds msg_conv;
8574 msg_conv.inner = (void*)(msg & (~1));
8575 msg_conv.is_owned = (msg & 1) || (msg == 0);
8576 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8577 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8578 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8579 return (uint64_t)ret_conv;
8582 typedef struct LDKSocketDescriptor_JCalls {
8583 atomic_size_t refcnt;
8586 jmethodID send_data_meth;
8587 jmethodID disconnect_socket_meth;
8589 jmethodID hash_meth;
8590 } LDKSocketDescriptor_JCalls;
8591 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8592 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8593 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8595 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8596 if (get_jenv_res == JNI_EDETACHED) {
8597 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8599 DO_ASSERT(get_jenv_res == JNI_OK);
8601 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8602 if (get_jenv_res == JNI_EDETACHED) {
8603 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8608 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8609 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8611 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8612 if (get_jenv_res == JNI_EDETACHED) {
8613 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8615 DO_ASSERT(get_jenv_res == JNI_OK);
8617 LDKu8slice data_var = data;
8618 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8619 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8622 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8623 if ((*env)->ExceptionCheck(env)) {
8624 (*env)->ExceptionDescribe(env);
8625 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8627 if (get_jenv_res == JNI_EDETACHED) {
8628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8632 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8633 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8635 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8636 if (get_jenv_res == JNI_EDETACHED) {
8637 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8639 DO_ASSERT(get_jenv_res == JNI_OK);
8641 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8643 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8644 if ((*env)->ExceptionCheck(env)) {
8645 (*env)->ExceptionDescribe(env);
8646 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8648 if (get_jenv_res == JNI_EDETACHED) {
8649 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8652 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8653 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8655 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8656 if (get_jenv_res == JNI_EDETACHED) {
8657 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8659 DO_ASSERT(get_jenv_res == JNI_OK);
8661 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8662 *other_arg_clone = SocketDescriptor_clone(other_arg);
8663 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8665 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8666 if ((*env)->ExceptionCheck(env)) {
8667 (*env)->ExceptionDescribe(env);
8668 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8670 if (get_jenv_res == JNI_EDETACHED) {
8671 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8675 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8676 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8678 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8679 if (get_jenv_res == JNI_EDETACHED) {
8680 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8682 DO_ASSERT(get_jenv_res == JNI_OK);
8684 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8686 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8687 if ((*env)->ExceptionCheck(env)) {
8688 (*env)->ExceptionDescribe(env);
8689 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8691 if (get_jenv_res == JNI_EDETACHED) {
8692 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8696 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8697 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8698 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8699 return (void*) this_arg;
8701 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8702 jclass c = (*env)->GetObjectClass(env, o);
8704 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8705 atomic_init(&calls->refcnt, 1);
8706 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8707 calls->o = (*env)->NewWeakGlobalRef(env, o);
8708 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8709 CHECK(calls->send_data_meth != NULL);
8710 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8711 CHECK(calls->disconnect_socket_meth != NULL);
8712 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8713 CHECK(calls->eq_meth != NULL);
8714 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8715 CHECK(calls->hash_meth != NULL);
8717 LDKSocketDescriptor ret = {
8718 .this_arg = (void*) calls,
8719 .send_data = send_data_LDKSocketDescriptor_jcall,
8720 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8721 .eq = eq_LDKSocketDescriptor_jcall,
8722 .hash = hash_LDKSocketDescriptor_jcall,
8723 .clone = LDKSocketDescriptor_JCalls_clone,
8724 .free = LDKSocketDescriptor_JCalls_free,
8728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8729 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8730 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8731 return (uint64_t)res_ptr;
8733 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) {
8734 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8735 LDKu8slice data_ref;
8736 data_ref.datalen = (*env)->GetArrayLength(env, data);
8737 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8738 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8739 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8744 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8745 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8749 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8750 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8754 typedef struct LDKChannelManagerPersister_JCalls {
8755 atomic_size_t refcnt;
8758 jmethodID persist_manager_meth;
8759 } LDKChannelManagerPersister_JCalls;
8760 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8761 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8762 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8764 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8765 if (get_jenv_res == JNI_EDETACHED) {
8766 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8768 DO_ASSERT(get_jenv_res == JNI_OK);
8770 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8771 if (get_jenv_res == JNI_EDETACHED) {
8772 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8777 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8778 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8780 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8781 if (get_jenv_res == JNI_EDETACHED) {
8782 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8784 DO_ASSERT(get_jenv_res == JNI_OK);
8786 LDKChannelManager channel_manager_var = *channel_manager;
8787 // Warning: we may need a move here but no clone is available for LDKChannelManager
8788 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8789 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8790 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8791 if (channel_manager_var.is_owned) {
8792 channel_manager_ref |= 1;
8794 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8796 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8797 if ((*env)->ExceptionCheck(env)) {
8798 (*env)->ExceptionDescribe(env);
8799 (*env)->FatalError(env, "A Java interface method called from rust threw an exception.");
8801 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8802 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8803 if (get_jenv_res == JNI_EDETACHED) {
8804 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8808 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8809 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8810 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8811 return (void*) this_arg;
8813 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8814 jclass c = (*env)->GetObjectClass(env, o);
8816 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8817 atomic_init(&calls->refcnt, 1);
8818 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8819 calls->o = (*env)->NewWeakGlobalRef(env, o);
8820 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8821 CHECK(calls->persist_manager_meth != NULL);
8823 LDKChannelManagerPersister ret = {
8824 .this_arg = (void*) calls,
8825 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8826 .free = LDKChannelManagerPersister_JCalls_free,
8830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8831 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8832 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8833 return (uint64_t)res_ptr;
8835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8836 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8837 LDKChannelManager channel_manager_conv;
8838 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8839 channel_manager_conv.is_owned = false;
8840 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8841 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8842 return (uint64_t)ret_conv;
8845 static jclass LDKFallback_SegWitProgram_class = NULL;
8846 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8847 static jclass LDKFallback_PubKeyHash_class = NULL;
8848 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8849 static jclass LDKFallback_ScriptHash_class = NULL;
8850 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8852 LDKFallback_SegWitProgram_class =
8853 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8854 CHECK(LDKFallback_SegWitProgram_class != NULL);
8855 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8856 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8857 LDKFallback_PubKeyHash_class =
8858 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8859 CHECK(LDKFallback_PubKeyHash_class != NULL);
8860 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8861 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8862 LDKFallback_ScriptHash_class =
8863 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8864 CHECK(LDKFallback_ScriptHash_class != NULL);
8865 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8866 CHECK(LDKFallback_ScriptHash_meth != NULL);
8868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8869 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8871 case LDKFallback_SegWitProgram: {
8872 uint8_t version_val = obj->seg_wit_program.version._0;
8873 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8874 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8875 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8876 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8878 case LDKFallback_PubKeyHash: {
8879 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8880 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8881 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8883 case LDKFallback_ScriptHash: {
8884 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8885 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8886 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8891 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8892 LDKStr ret_str = _ldk_get_compiled_version();
8893 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8897 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8898 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8899 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8904 LDKTransaction _res_ref;
8905 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8906 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8907 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8908 _res_ref.data_is_owned = true;
8909 Transaction_free(_res_ref);
8912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8913 if ((_res & 1) != 0) return;
8914 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8916 TxOut_free(_res_conv);
8919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8920 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8921 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8922 *ret_ref = TxOut_clone(orig_conv);
8923 return (uint64_t)ret_ref;
8926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8927 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8933 CHECK((*env)->GetArrayLength(env, o) == 32);
8934 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8935 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8936 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8937 return (uint64_t)ret_conv;
8940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8941 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8942 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8943 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8944 return (uint64_t)ret_conv;
8947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8948 if ((_res & 1) != 0) return;
8949 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8951 CResult_SecretKeyErrorZ_free(_res_conv);
8954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8956 CHECK((*env)->GetArrayLength(env, o) == 33);
8957 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8958 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8959 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8960 return (uint64_t)ret_conv;
8963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8964 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8965 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8966 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8967 return (uint64_t)ret_conv;
8970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8971 if ((_res & 1) != 0) return;
8972 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8974 CResult_PublicKeyErrorZ_free(_res_conv);
8977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8978 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8979 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8980 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8981 return (uint64_t)ret_conv;
8984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8985 LDKTxCreationKeys o_conv;
8986 o_conv.inner = (void*)(o & (~1));
8987 o_conv.is_owned = (o & 1) || (o == 0);
8988 o_conv = TxCreationKeys_clone(&o_conv);
8989 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8990 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8991 return (uint64_t)ret_conv;
8994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8995 LDKDecodeError e_conv;
8996 e_conv.inner = (void*)(e & (~1));
8997 e_conv.is_owned = (e & 1) || (e == 0);
8998 e_conv = DecodeError_clone(&e_conv);
8999 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9000 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9001 return (uint64_t)ret_conv;
9004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9005 if ((_res & 1) != 0) return;
9006 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9008 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9012 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9013 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9014 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9015 return (uint64_t)ret_conv;
9018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9019 LDKChannelPublicKeys o_conv;
9020 o_conv.inner = (void*)(o & (~1));
9021 o_conv.is_owned = (o & 1) || (o == 0);
9022 o_conv = ChannelPublicKeys_clone(&o_conv);
9023 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9024 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9025 return (uint64_t)ret_conv;
9028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9029 LDKDecodeError e_conv;
9030 e_conv.inner = (void*)(e & (~1));
9031 e_conv.is_owned = (e & 1) || (e == 0);
9032 e_conv = DecodeError_clone(&e_conv);
9033 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9034 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9035 return (uint64_t)ret_conv;
9038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9039 if ((_res & 1) != 0) return;
9040 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9042 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9046 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9047 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9048 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9049 return (uint64_t)ret_conv;
9052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9053 LDKTxCreationKeys o_conv;
9054 o_conv.inner = (void*)(o & (~1));
9055 o_conv.is_owned = (o & 1) || (o == 0);
9056 o_conv = TxCreationKeys_clone(&o_conv);
9057 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9058 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9059 return (uint64_t)ret_conv;
9062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9063 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9064 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9065 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9066 return (uint64_t)ret_conv;
9069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9070 if ((_res & 1) != 0) return;
9071 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
9073 CResult_TxCreationKeysErrorZ_free(_res_conv);
9076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9077 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9078 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9079 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9080 return (uint64_t)ret_conv;
9083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
9084 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9085 *ret_copy = COption_u32Z_some(o);
9086 uint64_t ret_ref = (uint64_t)ret_copy;
9090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
9091 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9092 *ret_copy = COption_u32Z_none();
9093 uint64_t ret_ref = (uint64_t)ret_copy;
9097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9098 if ((_res & 1) != 0) return;
9099 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
9101 COption_u32Z_free(_res_conv);
9104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9105 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9106 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9107 *ret_copy = COption_u32Z_clone(orig_conv);
9108 uint64_t ret_ref = (uint64_t)ret_copy;
9112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9113 LDKHTLCOutputInCommitment o_conv;
9114 o_conv.inner = (void*)(o & (~1));
9115 o_conv.is_owned = (o & 1) || (o == 0);
9116 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9117 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9118 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9119 return (uint64_t)ret_conv;
9122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9123 LDKDecodeError e_conv;
9124 e_conv.inner = (void*)(e & (~1));
9125 e_conv.is_owned = (e & 1) || (e == 0);
9126 e_conv = DecodeError_clone(&e_conv);
9127 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9128 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9129 return (uint64_t)ret_conv;
9132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9133 if ((_res & 1) != 0) return;
9134 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
9136 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9140 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9141 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9142 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9143 return (uint64_t)ret_conv;
9146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9147 LDKCounterpartyChannelTransactionParameters o_conv;
9148 o_conv.inner = (void*)(o & (~1));
9149 o_conv.is_owned = (o & 1) || (o == 0);
9150 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9151 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9152 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9153 return (uint64_t)ret_conv;
9156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9157 LDKDecodeError e_conv;
9158 e_conv.inner = (void*)(e & (~1));
9159 e_conv.is_owned = (e & 1) || (e == 0);
9160 e_conv = DecodeError_clone(&e_conv);
9161 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9162 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9163 return (uint64_t)ret_conv;
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9167 if ((_res & 1) != 0) return;
9168 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9170 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9174 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9175 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9176 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9177 return (uint64_t)ret_conv;
9180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9181 LDKChannelTransactionParameters o_conv;
9182 o_conv.inner = (void*)(o & (~1));
9183 o_conv.is_owned = (o & 1) || (o == 0);
9184 o_conv = ChannelTransactionParameters_clone(&o_conv);
9185 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9186 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9187 return (uint64_t)ret_conv;
9190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9191 LDKDecodeError e_conv;
9192 e_conv.inner = (void*)(e & (~1));
9193 e_conv.is_owned = (e & 1) || (e == 0);
9194 e_conv = DecodeError_clone(&e_conv);
9195 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9196 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9197 return (uint64_t)ret_conv;
9200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9201 if ((_res & 1) != 0) return;
9202 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9204 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9208 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9209 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9210 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9211 return (uint64_t)ret_conv;
9214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9215 LDKCVec_SignatureZ _res_constr;
9216 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9217 if (_res_constr.datalen > 0)
9218 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9220 _res_constr.data = NULL;
9221 for (size_t i = 0; i < _res_constr.datalen; i++) {
9222 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9223 LDKSignature _res_conv_8_ref;
9224 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
9225 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
9226 _res_constr.data[i] = _res_conv_8_ref;
9228 CVec_SignatureZ_free(_res_constr);
9231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9232 LDKHolderCommitmentTransaction o_conv;
9233 o_conv.inner = (void*)(o & (~1));
9234 o_conv.is_owned = (o & 1) || (o == 0);
9235 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9236 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9237 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9238 return (uint64_t)ret_conv;
9241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9242 LDKDecodeError e_conv;
9243 e_conv.inner = (void*)(e & (~1));
9244 e_conv.is_owned = (e & 1) || (e == 0);
9245 e_conv = DecodeError_clone(&e_conv);
9246 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9247 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9248 return (uint64_t)ret_conv;
9251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9252 if ((_res & 1) != 0) return;
9253 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9255 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9259 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9260 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9261 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9262 return (uint64_t)ret_conv;
9265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9266 LDKBuiltCommitmentTransaction o_conv;
9267 o_conv.inner = (void*)(o & (~1));
9268 o_conv.is_owned = (o & 1) || (o == 0);
9269 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9270 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9271 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9272 return (uint64_t)ret_conv;
9275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9276 LDKDecodeError e_conv;
9277 e_conv.inner = (void*)(e & (~1));
9278 e_conv.is_owned = (e & 1) || (e == 0);
9279 e_conv = DecodeError_clone(&e_conv);
9280 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9281 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9282 return (uint64_t)ret_conv;
9285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9286 if ((_res & 1) != 0) return;
9287 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9289 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9293 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9294 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9295 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9296 return (uint64_t)ret_conv;
9299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9300 LDKCommitmentTransaction o_conv;
9301 o_conv.inner = (void*)(o & (~1));
9302 o_conv.is_owned = (o & 1) || (o == 0);
9303 o_conv = CommitmentTransaction_clone(&o_conv);
9304 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9305 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9306 return (uint64_t)ret_conv;
9309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9310 LDKDecodeError e_conv;
9311 e_conv.inner = (void*)(e & (~1));
9312 e_conv.is_owned = (e & 1) || (e == 0);
9313 e_conv = DecodeError_clone(&e_conv);
9314 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9315 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9316 return (uint64_t)ret_conv;
9319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9320 if ((_res & 1) != 0) return;
9321 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9323 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9327 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9328 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9329 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9330 return (uint64_t)ret_conv;
9333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9334 LDKTrustedCommitmentTransaction o_conv;
9335 o_conv.inner = (void*)(o & (~1));
9336 o_conv.is_owned = (o & 1) || (o == 0);
9337 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9338 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9339 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9340 return (uint64_t)ret_conv;
9343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9344 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9345 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9346 return (uint64_t)ret_conv;
9349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9350 if ((_res & 1) != 0) return;
9351 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9353 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9357 LDKCVec_SignatureZ o_constr;
9358 o_constr.datalen = (*env)->GetArrayLength(env, o);
9359 if (o_constr.datalen > 0)
9360 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9362 o_constr.data = NULL;
9363 for (size_t i = 0; i < o_constr.datalen; i++) {
9364 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9365 LDKSignature o_conv_8_ref;
9366 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9367 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9368 o_constr.data[i] = o_conv_8_ref;
9370 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9371 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9372 return (uint64_t)ret_conv;
9375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9376 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9377 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9378 return (uint64_t)ret_conv;
9381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9382 if ((_res & 1) != 0) return;
9383 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9385 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9389 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9390 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9391 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9392 return (uint64_t)ret_conv;
9395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9396 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9397 *ret_conv = CResult_NoneErrorZ_ok();
9398 return (uint64_t)ret_conv;
9401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9402 LDKIOError e_conv = LDKIOError_from_java(env, e);
9403 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9404 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9405 return (uint64_t)ret_conv;
9408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9409 if ((_res & 1) != 0) return;
9410 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9412 CResult_NoneErrorZ_free(_res_conv);
9415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9416 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9417 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9418 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9419 return (uint64_t)ret_conv;
9422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9424 o_conv.inner = (void*)(o & (~1));
9425 o_conv.is_owned = (o & 1) || (o == 0);
9426 o_conv = RouteHop_clone(&o_conv);
9427 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9428 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9429 return (uint64_t)ret_conv;
9432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9433 LDKDecodeError e_conv;
9434 e_conv.inner = (void*)(e & (~1));
9435 e_conv.is_owned = (e & 1) || (e == 0);
9436 e_conv = DecodeError_clone(&e_conv);
9437 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9438 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9439 return (uint64_t)ret_conv;
9442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9443 if ((_res & 1) != 0) return;
9444 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9446 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9450 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9451 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9452 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9453 return (uint64_t)ret_conv;
9456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9457 LDKCVec_RouteHopZ _res_constr;
9458 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9459 if (_res_constr.datalen > 0)
9460 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9462 _res_constr.data = NULL;
9463 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9464 for (size_t k = 0; k < _res_constr.datalen; k++) {
9465 int64_t _res_conv_10 = _res_vals[k];
9466 LDKRouteHop _res_conv_10_conv;
9467 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9468 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9469 _res_constr.data[k] = _res_conv_10_conv;
9471 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9472 CVec_RouteHopZ_free(_res_constr);
9475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9476 LDKCVec_CVec_RouteHopZZ _res_constr;
9477 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9478 if (_res_constr.datalen > 0)
9479 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9481 _res_constr.data = NULL;
9482 for (size_t m = 0; m < _res_constr.datalen; m++) {
9483 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9484 LDKCVec_RouteHopZ _res_conv_12_constr;
9485 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9486 if (_res_conv_12_constr.datalen > 0)
9487 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9489 _res_conv_12_constr.data = NULL;
9490 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9491 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9492 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9493 LDKRouteHop _res_conv_12_conv_10_conv;
9494 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9495 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9496 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9498 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9499 _res_constr.data[m] = _res_conv_12_constr;
9501 CVec_CVec_RouteHopZZ_free(_res_constr);
9504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9506 o_conv.inner = (void*)(o & (~1));
9507 o_conv.is_owned = (o & 1) || (o == 0);
9508 o_conv = Route_clone(&o_conv);
9509 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9510 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9511 return (uint64_t)ret_conv;
9514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9515 LDKDecodeError e_conv;
9516 e_conv.inner = (void*)(e & (~1));
9517 e_conv.is_owned = (e & 1) || (e == 0);
9518 e_conv = DecodeError_clone(&e_conv);
9519 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9520 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9521 return (uint64_t)ret_conv;
9524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9525 if ((_res & 1) != 0) return;
9526 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9528 CResult_RouteDecodeErrorZ_free(_res_conv);
9531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9532 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9533 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9534 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9535 return (uint64_t)ret_conv;
9538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9539 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9540 *ret_copy = COption_u64Z_some(o);
9541 uint64_t ret_ref = (uint64_t)ret_copy;
9545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9546 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9547 *ret_copy = COption_u64Z_none();
9548 uint64_t ret_ref = (uint64_t)ret_copy;
9552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9553 if ((_res & 1) != 0) return;
9554 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9556 COption_u64Z_free(_res_conv);
9559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9560 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9561 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9562 *ret_copy = COption_u64Z_clone(orig_conv);
9563 uint64_t ret_ref = (uint64_t)ret_copy;
9567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9568 LDKCVec_ChannelDetailsZ _res_constr;
9569 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9570 if (_res_constr.datalen > 0)
9571 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9573 _res_constr.data = NULL;
9574 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9575 for (size_t q = 0; q < _res_constr.datalen; q++) {
9576 int64_t _res_conv_16 = _res_vals[q];
9577 LDKChannelDetails _res_conv_16_conv;
9578 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9579 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9580 _res_constr.data[q] = _res_conv_16_conv;
9582 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9583 CVec_ChannelDetailsZ_free(_res_constr);
9586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9587 LDKCVec_RouteHintZ _res_constr;
9588 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9589 if (_res_constr.datalen > 0)
9590 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9592 _res_constr.data = NULL;
9593 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9594 for (size_t l = 0; l < _res_constr.datalen; l++) {
9595 int64_t _res_conv_11 = _res_vals[l];
9596 LDKRouteHint _res_conv_11_conv;
9597 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9598 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9599 _res_constr.data[l] = _res_conv_11_conv;
9601 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9602 CVec_RouteHintZ_free(_res_constr);
9605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9607 o_conv.inner = (void*)(o & (~1));
9608 o_conv.is_owned = (o & 1) || (o == 0);
9609 o_conv = Route_clone(&o_conv);
9610 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9611 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9612 return (uint64_t)ret_conv;
9615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9616 LDKLightningError e_conv;
9617 e_conv.inner = (void*)(e & (~1));
9618 e_conv.is_owned = (e & 1) || (e == 0);
9619 e_conv = LightningError_clone(&e_conv);
9620 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9621 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9622 return (uint64_t)ret_conv;
9625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9626 if ((_res & 1) != 0) return;
9627 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9629 CResult_RouteLightningErrorZ_free(_res_conv);
9632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9633 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9634 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9635 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9636 return (uint64_t)ret_conv;
9639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9640 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9641 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9642 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9643 return (uint64_t)ret_conv;
9646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9647 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9648 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9649 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9650 return (uint64_t)ret_conv;
9653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9654 if ((_res & 1) != 0) return;
9655 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9657 CResult_TxOutAccessErrorZ_free(_res_conv);
9660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9661 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9662 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9663 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9664 return (uint64_t)ret_conv;
9667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9668 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9669 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9670 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9671 return (uint64_t)ret_ref;
9674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9675 LDKTransaction b_ref;
9676 b_ref.datalen = (*env)->GetArrayLength(env, b);
9677 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9678 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9679 b_ref.data_is_owned = true;
9680 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9681 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9682 return (uint64_t)ret_ref;
9685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9686 if ((_res & 1) != 0) return;
9687 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9689 C2Tuple_usizeTransactionZ_free(_res_conv);
9692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9693 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9694 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9695 if (_res_constr.datalen > 0)
9696 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9698 _res_constr.data = NULL;
9699 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9700 for (size_t y = 0; y < _res_constr.datalen; y++) {
9701 int64_t _res_conv_24 = _res_vals[y];
9702 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9703 FREE((void*)_res_conv_24);
9704 _res_constr.data[y] = _res_conv_24_conv;
9706 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9707 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9711 LDKCVec_TxidZ _res_constr;
9712 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9713 if (_res_constr.datalen > 0)
9714 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9716 _res_constr.data = NULL;
9717 for (size_t i = 0; i < _res_constr.datalen; i++) {
9718 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9719 LDKThirtyTwoBytes _res_conv_8_ref;
9720 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9721 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9722 _res_constr.data[i] = _res_conv_8_ref;
9724 CVec_TxidZ_free(_res_constr);
9727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9728 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9729 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9730 return (uint64_t)ret_conv;
9733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9734 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9735 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9736 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9737 return (uint64_t)ret_conv;
9740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9741 if ((_res & 1) != 0) return;
9742 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9744 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9748 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9749 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9750 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9751 return (uint64_t)ret_conv;
9754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9755 LDKCVec_MonitorEventZ _res_constr;
9756 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9757 if (_res_constr.datalen > 0)
9758 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9760 _res_constr.data = NULL;
9761 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9762 for (size_t o = 0; o < _res_constr.datalen; o++) {
9763 int64_t _res_conv_14 = _res_vals[o];
9764 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9765 FREE((void*)_res_conv_14);
9766 _res_constr.data[o] = _res_conv_14_conv;
9768 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9769 CVec_MonitorEventZ_free(_res_constr);
9772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9773 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9774 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9775 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9776 uint64_t ret_ref = (uint64_t)ret_copy;
9780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9781 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9782 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9783 uint64_t ret_ref = (uint64_t)ret_copy;
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9788 if ((_res & 1) != 0) return;
9789 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9791 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9795 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9796 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9797 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9798 uint64_t ret_ref = (uint64_t)ret_copy;
9802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9803 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9804 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9805 if (_res_constr.datalen > 0)
9806 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9808 _res_constr.data = NULL;
9809 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9810 for (size_t b = 0; b < _res_constr.datalen; b++) {
9811 int64_t _res_conv_27 = _res_vals[b];
9812 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9813 FREE((void*)_res_conv_27);
9814 _res_constr.data[b] = _res_conv_27_conv;
9816 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9817 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9821 LDKCVec_MessageSendEventZ _res_constr;
9822 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9823 if (_res_constr.datalen > 0)
9824 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9826 _res_constr.data = NULL;
9827 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9828 for (size_t s = 0; s < _res_constr.datalen; s++) {
9829 int64_t _res_conv_18 = _res_vals[s];
9830 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9831 FREE((void*)_res_conv_18);
9832 _res_constr.data[s] = _res_conv_18_conv;
9834 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9835 CVec_MessageSendEventZ_free(_res_constr);
9838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9839 LDKInitFeatures o_conv;
9840 o_conv.inner = (void*)(o & (~1));
9841 o_conv.is_owned = (o & 1) || (o == 0);
9842 o_conv = InitFeatures_clone(&o_conv);
9843 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9844 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9845 return (uint64_t)ret_conv;
9848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9849 LDKDecodeError e_conv;
9850 e_conv.inner = (void*)(e & (~1));
9851 e_conv.is_owned = (e & 1) || (e == 0);
9852 e_conv = DecodeError_clone(&e_conv);
9853 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9854 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9855 return (uint64_t)ret_conv;
9858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9859 if ((_res & 1) != 0) return;
9860 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9862 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9866 LDKNodeFeatures o_conv;
9867 o_conv.inner = (void*)(o & (~1));
9868 o_conv.is_owned = (o & 1) || (o == 0);
9869 o_conv = NodeFeatures_clone(&o_conv);
9870 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9871 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9872 return (uint64_t)ret_conv;
9875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9876 LDKDecodeError e_conv;
9877 e_conv.inner = (void*)(e & (~1));
9878 e_conv.is_owned = (e & 1) || (e == 0);
9879 e_conv = DecodeError_clone(&e_conv);
9880 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9881 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9882 return (uint64_t)ret_conv;
9885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9886 if ((_res & 1) != 0) return;
9887 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9889 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9893 LDKChannelFeatures o_conv;
9894 o_conv.inner = (void*)(o & (~1));
9895 o_conv.is_owned = (o & 1) || (o == 0);
9896 o_conv = ChannelFeatures_clone(&o_conv);
9897 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9898 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9899 return (uint64_t)ret_conv;
9902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9903 LDKDecodeError e_conv;
9904 e_conv.inner = (void*)(e & (~1));
9905 e_conv.is_owned = (e & 1) || (e == 0);
9906 e_conv = DecodeError_clone(&e_conv);
9907 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9908 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9909 return (uint64_t)ret_conv;
9912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9913 if ((_res & 1) != 0) return;
9914 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9916 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9920 LDKInvoiceFeatures o_conv;
9921 o_conv.inner = (void*)(o & (~1));
9922 o_conv.is_owned = (o & 1) || (o == 0);
9923 o_conv = InvoiceFeatures_clone(&o_conv);
9924 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9925 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9926 return (uint64_t)ret_conv;
9929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9930 LDKDecodeError e_conv;
9931 e_conv.inner = (void*)(e & (~1));
9932 e_conv.is_owned = (e & 1) || (e == 0);
9933 e_conv = DecodeError_clone(&e_conv);
9934 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9935 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9936 return (uint64_t)ret_conv;
9939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9940 if ((_res & 1) != 0) return;
9941 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9943 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9947 LDKDelayedPaymentOutputDescriptor o_conv;
9948 o_conv.inner = (void*)(o & (~1));
9949 o_conv.is_owned = (o & 1) || (o == 0);
9950 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9951 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9952 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9953 return (uint64_t)ret_conv;
9956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9957 LDKDecodeError e_conv;
9958 e_conv.inner = (void*)(e & (~1));
9959 e_conv.is_owned = (e & 1) || (e == 0);
9960 e_conv = DecodeError_clone(&e_conv);
9961 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9962 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9963 return (uint64_t)ret_conv;
9966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9967 if ((_res & 1) != 0) return;
9968 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9970 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9974 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9975 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9976 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9977 return (uint64_t)ret_conv;
9980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9981 LDKStaticPaymentOutputDescriptor o_conv;
9982 o_conv.inner = (void*)(o & (~1));
9983 o_conv.is_owned = (o & 1) || (o == 0);
9984 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9985 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9986 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9987 return (uint64_t)ret_conv;
9990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9991 LDKDecodeError e_conv;
9992 e_conv.inner = (void*)(e & (~1));
9993 e_conv.is_owned = (e & 1) || (e == 0);
9994 e_conv = DecodeError_clone(&e_conv);
9995 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9996 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9997 return (uint64_t)ret_conv;
10000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10001 if ((_res & 1) != 0) return;
10002 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10004 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10008 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10009 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10010 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10011 return (uint64_t)ret_conv;
10014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10015 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
10016 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10017 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10018 return (uint64_t)ret_conv;
10021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10022 LDKDecodeError e_conv;
10023 e_conv.inner = (void*)(e & (~1));
10024 e_conv.is_owned = (e & 1) || (e == 0);
10025 e_conv = DecodeError_clone(&e_conv);
10026 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10027 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10028 return (uint64_t)ret_conv;
10031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10032 if ((_res & 1) != 0) return;
10033 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10035 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10039 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10040 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10041 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10042 return (uint64_t)ret_conv;
10045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10046 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10047 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10048 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10049 return (uint64_t)ret_ref;
10052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
10053 LDKSignature a_ref;
10054 CHECK((*env)->GetArrayLength(env, a) == 64);
10055 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
10056 LDKCVec_SignatureZ b_constr;
10057 b_constr.datalen = (*env)->GetArrayLength(env, b);
10058 if (b_constr.datalen > 0)
10059 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10061 b_constr.data = NULL;
10062 for (size_t i = 0; i < b_constr.datalen; i++) {
10063 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
10064 LDKSignature b_conv_8_ref;
10065 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
10066 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
10067 b_constr.data[i] = b_conv_8_ref;
10069 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10070 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10071 return (uint64_t)ret_ref;
10074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10075 if ((_res & 1) != 0) return;
10076 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
10078 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10082 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
10083 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10084 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10085 return (uint64_t)ret_conv;
10088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
10089 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10090 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10091 return (uint64_t)ret_conv;
10094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10095 if ((_res & 1) != 0) return;
10096 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
10098 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10102 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10103 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10104 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10105 return (uint64_t)ret_conv;
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10109 LDKSignature o_ref;
10110 CHECK((*env)->GetArrayLength(env, o) == 64);
10111 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
10112 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10113 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10114 return (uint64_t)ret_conv;
10117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10118 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10119 *ret_conv = CResult_SignatureNoneZ_err();
10120 return (uint64_t)ret_conv;
10123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10124 if ((_res & 1) != 0) return;
10125 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
10127 CResult_SignatureNoneZ_free(_res_conv);
10130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10131 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10132 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10133 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10134 return (uint64_t)ret_conv;
10137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10138 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
10139 if (o_conv.free == LDKSign_JCalls_free) {
10140 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10141 LDKSign_JCalls_clone(o_conv.this_arg);
10143 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10144 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10145 return (uint64_t)ret_conv;
10148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10149 LDKDecodeError e_conv;
10150 e_conv.inner = (void*)(e & (~1));
10151 e_conv.is_owned = (e & 1) || (e == 0);
10152 e_conv = DecodeError_clone(&e_conv);
10153 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10154 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10155 return (uint64_t)ret_conv;
10158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10159 if ((_res & 1) != 0) return;
10160 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
10162 CResult_SignDecodeErrorZ_free(_res_conv);
10165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10166 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10167 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10168 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10169 return (uint64_t)ret_conv;
10172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10173 LDKCVec_u8Z _res_ref;
10174 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10175 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10176 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10177 CVec_u8Z_free(_res_ref);
10180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
10181 LDKRecoverableSignature arg_ref;
10182 CHECK((*env)->GetArrayLength(env, arg) == 68);
10183 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
10184 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10185 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10186 return (uint64_t)ret_conv;
10189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10190 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10191 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10192 return (uint64_t)ret_conv;
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10196 if ((_res & 1) != 0) return;
10197 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
10199 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10203 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10204 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10205 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10206 return (uint64_t)ret_conv;
10209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10210 LDKCVec_CVec_u8ZZ _res_constr;
10211 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10212 if (_res_constr.datalen > 0)
10213 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10215 _res_constr.data = NULL;
10216 for (size_t i = 0; i < _res_constr.datalen; i++) {
10217 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10218 LDKCVec_u8Z _res_conv_8_ref;
10219 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
10220 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10221 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
10222 _res_constr.data[i] = _res_conv_8_ref;
10224 CVec_CVec_u8ZZ_free(_res_constr);
10227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10228 LDKCVec_CVec_u8ZZ o_constr;
10229 o_constr.datalen = (*env)->GetArrayLength(env, o);
10230 if (o_constr.datalen > 0)
10231 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10233 o_constr.data = NULL;
10234 for (size_t i = 0; i < o_constr.datalen; i++) {
10235 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10236 LDKCVec_u8Z o_conv_8_ref;
10237 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
10238 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10239 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
10240 o_constr.data[i] = o_conv_8_ref;
10242 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10243 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10244 return (uint64_t)ret_conv;
10247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
10248 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10249 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10250 return (uint64_t)ret_conv;
10253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10254 if ((_res & 1) != 0) return;
10255 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
10257 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10261 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10262 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10263 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10264 return (uint64_t)ret_conv;
10267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10268 LDKInMemorySigner o_conv;
10269 o_conv.inner = (void*)(o & (~1));
10270 o_conv.is_owned = (o & 1) || (o == 0);
10271 o_conv = InMemorySigner_clone(&o_conv);
10272 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10273 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10274 return (uint64_t)ret_conv;
10277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10278 LDKDecodeError e_conv;
10279 e_conv.inner = (void*)(e & (~1));
10280 e_conv.is_owned = (e & 1) || (e == 0);
10281 e_conv = DecodeError_clone(&e_conv);
10282 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10283 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10284 return (uint64_t)ret_conv;
10287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10288 if ((_res & 1) != 0) return;
10289 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
10291 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10295 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10296 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10297 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10298 return (uint64_t)ret_conv;
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10302 LDKCVec_TxOutZ _res_constr;
10303 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10304 if (_res_constr.datalen > 0)
10305 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10307 _res_constr.data = NULL;
10308 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10309 for (size_t h = 0; h < _res_constr.datalen; h++) {
10310 int64_t _res_conv_7 = _res_vals[h];
10311 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10312 FREE((void*)_res_conv_7);
10313 _res_constr.data[h] = _res_conv_7_conv;
10315 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10316 CVec_TxOutZ_free(_res_constr);
10319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10320 LDKTransaction o_ref;
10321 o_ref.datalen = (*env)->GetArrayLength(env, o);
10322 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10323 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10324 o_ref.data_is_owned = true;
10325 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10326 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10327 return (uint64_t)ret_conv;
10330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10331 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10332 *ret_conv = CResult_TransactionNoneZ_err();
10333 return (uint64_t)ret_conv;
10336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10337 if ((_res & 1) != 0) return;
10338 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10340 CResult_TransactionNoneZ_free(_res_conv);
10343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10344 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10345 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10346 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10347 return (uint64_t)ret_conv;
10350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10351 LDKThirtyTwoBytes a_ref;
10352 CHECK((*env)->GetArrayLength(env, a) == 32);
10353 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10354 LDKChannelMonitor b_conv;
10355 b_conv.inner = (void*)(b & (~1));
10356 b_conv.is_owned = (b & 1) || (b == 0);
10357 b_conv = ChannelMonitor_clone(&b_conv);
10358 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10359 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10360 return (uint64_t)ret_ref;
10363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10364 if ((_res & 1) != 0) return;
10365 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10367 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10371 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10372 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10373 if (_res_constr.datalen > 0)
10374 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10376 _res_constr.data = NULL;
10377 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10378 for (size_t i = 0; i < _res_constr.datalen; i++) {
10379 int64_t _res_conv_34 = _res_vals[i];
10380 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10381 FREE((void*)_res_conv_34);
10382 _res_constr.data[i] = _res_conv_34_conv;
10384 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10385 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10389 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10390 o_constr.datalen = (*env)->GetArrayLength(env, o);
10391 if (o_constr.datalen > 0)
10392 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10394 o_constr.data = NULL;
10395 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10396 for (size_t i = 0; i < o_constr.datalen; i++) {
10397 int64_t o_conv_34 = o_vals[i];
10398 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10399 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10400 o_constr.data[i] = o_conv_34_conv;
10402 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10403 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10404 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10405 return (uint64_t)ret_conv;
10408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10409 LDKIOError e_conv = LDKIOError_from_java(env, e);
10410 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10411 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10412 return (uint64_t)ret_conv;
10415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10416 if ((_res & 1) != 0) return;
10417 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10419 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10423 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10424 *ret_conv = CResult_NoneAPIErrorZ_ok();
10425 return (uint64_t)ret_conv;
10428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10429 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10430 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10431 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10432 return (uint64_t)ret_conv;
10435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10436 if ((_res & 1) != 0) return;
10437 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10439 CResult_NoneAPIErrorZ_free(_res_conv);
10442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10443 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10444 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10445 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10446 return (uint64_t)ret_conv;
10449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10450 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10451 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10452 if (_res_constr.datalen > 0)
10453 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10455 _res_constr.data = NULL;
10456 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10457 for (size_t w = 0; w < _res_constr.datalen; w++) {
10458 int64_t _res_conv_22 = _res_vals[w];
10459 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10460 FREE((void*)_res_conv_22);
10461 _res_constr.data[w] = _res_conv_22_conv;
10463 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10464 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10468 LDKCVec_APIErrorZ _res_constr;
10469 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10470 if (_res_constr.datalen > 0)
10471 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10473 _res_constr.data = NULL;
10474 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10475 for (size_t k = 0; k < _res_constr.datalen; k++) {
10476 int64_t _res_conv_10 = _res_vals[k];
10477 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10478 FREE((void*)_res_conv_10);
10479 _res_constr.data[k] = _res_conv_10_conv;
10481 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10482 CVec_APIErrorZ_free(_res_constr);
10485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10486 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10487 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10488 return (uint64_t)ret_conv;
10491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10492 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10493 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10494 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10495 return (uint64_t)ret_conv;
10498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10499 if ((_res & 1) != 0) return;
10500 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10502 CResult_NonePaymentSendFailureZ_free(_res_conv);
10505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10506 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10507 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10508 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10509 return (uint64_t)ret_conv;
10512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10513 LDKCVec_NetAddressZ _res_constr;
10514 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10515 if (_res_constr.datalen > 0)
10516 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10518 _res_constr.data = NULL;
10519 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10520 for (size_t m = 0; m < _res_constr.datalen; m++) {
10521 int64_t _res_conv_12 = _res_vals[m];
10522 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10523 FREE((void*)_res_conv_12);
10524 _res_constr.data[m] = _res_conv_12_conv;
10526 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10527 CVec_NetAddressZ_free(_res_constr);
10530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10531 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10532 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10533 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10534 return (uint64_t)ret_ref;
10537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10538 LDKThirtyTwoBytes a_ref;
10539 CHECK((*env)->GetArrayLength(env, a) == 32);
10540 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10541 LDKThirtyTwoBytes b_ref;
10542 CHECK((*env)->GetArrayLength(env, b) == 32);
10543 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10544 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10545 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10546 return (uint64_t)ret_ref;
10549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10550 if ((_res & 1) != 0) return;
10551 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10553 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10557 LDKThirtyTwoBytes o_ref;
10558 CHECK((*env)->GetArrayLength(env, o) == 32);
10559 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10560 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10561 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10562 return (uint64_t)ret_conv;
10565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10566 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10567 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10568 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10569 return (uint64_t)ret_conv;
10572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10573 if ((_res & 1) != 0) return;
10574 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10576 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10580 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10581 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10582 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10583 return (uint64_t)ret_conv;
10586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10587 LDKCVec_ChannelMonitorZ _res_constr;
10588 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10589 if (_res_constr.datalen > 0)
10590 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10592 _res_constr.data = NULL;
10593 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10594 for (size_t q = 0; q < _res_constr.datalen; q++) {
10595 int64_t _res_conv_16 = _res_vals[q];
10596 LDKChannelMonitor _res_conv_16_conv;
10597 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10598 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10599 _res_constr.data[q] = _res_conv_16_conv;
10601 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10602 CVec_ChannelMonitorZ_free(_res_constr);
10605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10606 LDKThirtyTwoBytes a_ref;
10607 CHECK((*env)->GetArrayLength(env, a) == 32);
10608 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10609 LDKChannelManager b_conv;
10610 b_conv.inner = (void*)(b & (~1));
10611 b_conv.is_owned = (b & 1) || (b == 0);
10612 // Warning: we need a move here but no clone is available for LDKChannelManager
10613 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10614 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10615 return (uint64_t)ret_ref;
10618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10619 if ((_res & 1) != 0) return;
10620 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10622 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10626 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10627 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10628 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10629 return (uint64_t)ret_conv;
10632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10633 LDKDecodeError e_conv;
10634 e_conv.inner = (void*)(e & (~1));
10635 e_conv.is_owned = (e & 1) || (e == 0);
10636 e_conv = DecodeError_clone(&e_conv);
10637 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10638 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10639 return (uint64_t)ret_conv;
10642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10643 if ((_res & 1) != 0) return;
10644 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10646 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10650 LDKChannelConfig o_conv;
10651 o_conv.inner = (void*)(o & (~1));
10652 o_conv.is_owned = (o & 1) || (o == 0);
10653 o_conv = ChannelConfig_clone(&o_conv);
10654 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10655 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10656 return (uint64_t)ret_conv;
10659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10660 LDKDecodeError e_conv;
10661 e_conv.inner = (void*)(e & (~1));
10662 e_conv.is_owned = (e & 1) || (e == 0);
10663 e_conv = DecodeError_clone(&e_conv);
10664 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10665 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10666 return (uint64_t)ret_conv;
10669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10670 if ((_res & 1) != 0) return;
10671 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10673 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10677 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10678 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10679 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10680 return (uint64_t)ret_conv;
10683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10684 LDKOutPoint o_conv;
10685 o_conv.inner = (void*)(o & (~1));
10686 o_conv.is_owned = (o & 1) || (o == 0);
10687 o_conv = OutPoint_clone(&o_conv);
10688 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10689 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10690 return (uint64_t)ret_conv;
10693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10694 LDKDecodeError e_conv;
10695 e_conv.inner = (void*)(e & (~1));
10696 e_conv.is_owned = (e & 1) || (e == 0);
10697 e_conv = DecodeError_clone(&e_conv);
10698 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10699 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10700 return (uint64_t)ret_conv;
10703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10704 if ((_res & 1) != 0) return;
10705 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10707 CResult_OutPointDecodeErrorZ_free(_res_conv);
10710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10711 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10712 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10713 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10714 return (uint64_t)ret_conv;
10717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10718 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10719 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10720 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10721 return (uint64_t)ret_conv;
10724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10725 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10726 *ret_conv = CResult_SiPrefixNoneZ_err();
10727 return (uint64_t)ret_conv;
10730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10731 if ((_res & 1) != 0) return;
10732 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10734 CResult_SiPrefixNoneZ_free(_res_conv);
10737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10738 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10739 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10740 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10741 return (uint64_t)ret_conv;
10744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10746 o_conv.inner = (void*)(o & (~1));
10747 o_conv.is_owned = (o & 1) || (o == 0);
10748 o_conv = Invoice_clone(&o_conv);
10749 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10750 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10751 return (uint64_t)ret_conv;
10754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10755 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10756 *ret_conv = CResult_InvoiceNoneZ_err();
10757 return (uint64_t)ret_conv;
10760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10761 if ((_res & 1) != 0) return;
10762 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10764 CResult_InvoiceNoneZ_free(_res_conv);
10767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10768 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10769 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10770 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10771 return (uint64_t)ret_conv;
10774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10775 LDKSignedRawInvoice o_conv;
10776 o_conv.inner = (void*)(o & (~1));
10777 o_conv.is_owned = (o & 1) || (o == 0);
10778 o_conv = SignedRawInvoice_clone(&o_conv);
10779 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10780 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10781 return (uint64_t)ret_conv;
10784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10785 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10786 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10787 return (uint64_t)ret_conv;
10790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10791 if ((_res & 1) != 0) return;
10792 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10794 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10798 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10799 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10800 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10801 return (uint64_t)ret_conv;
10804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10805 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10806 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10807 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10808 return (uint64_t)ret_ref;
10811 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) {
10812 LDKRawInvoice a_conv;
10813 a_conv.inner = (void*)(a & (~1));
10814 a_conv.is_owned = (a & 1) || (a == 0);
10815 a_conv = RawInvoice_clone(&a_conv);
10816 LDKThirtyTwoBytes b_ref;
10817 CHECK((*env)->GetArrayLength(env, b) == 32);
10818 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10819 LDKInvoiceSignature c_conv;
10820 c_conv.inner = (void*)(c & (~1));
10821 c_conv.is_owned = (c & 1) || (c == 0);
10822 c_conv = InvoiceSignature_clone(&c_conv);
10823 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10824 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10825 return (uint64_t)ret_ref;
10828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10829 if ((_res & 1) != 0) return;
10830 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10832 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10836 LDKPayeePubKey o_conv;
10837 o_conv.inner = (void*)(o & (~1));
10838 o_conv.is_owned = (o & 1) || (o == 0);
10839 o_conv = PayeePubKey_clone(&o_conv);
10840 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10841 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10842 return (uint64_t)ret_conv;
10845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10846 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10847 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10848 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10849 return (uint64_t)ret_conv;
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10853 if ((_res & 1) != 0) return;
10854 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10856 CResult_PayeePubKeyErrorZ_free(_res_conv);
10859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10860 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10861 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10862 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10863 return (uint64_t)ret_conv;
10866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10867 LDKCVec_PrivateRouteZ _res_constr;
10868 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10869 if (_res_constr.datalen > 0)
10870 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10872 _res_constr.data = NULL;
10873 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10874 for (size_t o = 0; o < _res_constr.datalen; o++) {
10875 int64_t _res_conv_14 = _res_vals[o];
10876 LDKPrivateRoute _res_conv_14_conv;
10877 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10878 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10879 _res_constr.data[o] = _res_conv_14_conv;
10881 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10882 CVec_PrivateRouteZ_free(_res_constr);
10885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10886 LDKPositiveTimestamp o_conv;
10887 o_conv.inner = (void*)(o & (~1));
10888 o_conv.is_owned = (o & 1) || (o == 0);
10889 o_conv = PositiveTimestamp_clone(&o_conv);
10890 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10891 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10892 return (uint64_t)ret_conv;
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10896 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10897 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10898 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10899 return (uint64_t)ret_conv;
10902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10903 if ((_res & 1) != 0) return;
10904 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10906 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10910 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10911 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10912 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10913 return (uint64_t)ret_conv;
10916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10917 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10918 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10919 return (uint64_t)ret_conv;
10922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10923 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10924 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10925 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10926 return (uint64_t)ret_conv;
10929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10930 if ((_res & 1) != 0) return;
10931 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10933 CResult_NoneSemanticErrorZ_free(_res_conv);
10936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10937 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10938 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10939 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10940 return (uint64_t)ret_conv;
10943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10945 o_conv.inner = (void*)(o & (~1));
10946 o_conv.is_owned = (o & 1) || (o == 0);
10947 o_conv = Invoice_clone(&o_conv);
10948 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10949 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10950 return (uint64_t)ret_conv;
10953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10954 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10955 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10956 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10957 return (uint64_t)ret_conv;
10960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10961 if ((_res & 1) != 0) return;
10962 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10964 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10968 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10969 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10970 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10971 return (uint64_t)ret_conv;
10974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10975 LDKDescription o_conv;
10976 o_conv.inner = (void*)(o & (~1));
10977 o_conv.is_owned = (o & 1) || (o == 0);
10978 o_conv = Description_clone(&o_conv);
10979 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10980 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10981 return (uint64_t)ret_conv;
10984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10985 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10986 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10987 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10988 return (uint64_t)ret_conv;
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10992 if ((_res & 1) != 0) return;
10993 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10995 CResult_DescriptionCreationErrorZ_free(_res_conv);
10998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10999 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11000 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11001 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11002 return (uint64_t)ret_conv;
11005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11006 LDKExpiryTime o_conv;
11007 o_conv.inner = (void*)(o & (~1));
11008 o_conv.is_owned = (o & 1) || (o == 0);
11009 o_conv = ExpiryTime_clone(&o_conv);
11010 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11011 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11012 return (uint64_t)ret_conv;
11015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11016 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11017 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11018 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11019 return (uint64_t)ret_conv;
11022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11023 if ((_res & 1) != 0) return;
11024 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
11026 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11030 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11031 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11032 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11033 return (uint64_t)ret_conv;
11036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11037 LDKPrivateRoute o_conv;
11038 o_conv.inner = (void*)(o & (~1));
11039 o_conv.is_owned = (o & 1) || (o == 0);
11040 o_conv = PrivateRoute_clone(&o_conv);
11041 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11042 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11043 return (uint64_t)ret_conv;
11046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11047 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11048 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11049 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11050 return (uint64_t)ret_conv;
11053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11054 if ((_res & 1) != 0) return;
11055 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
11057 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11061 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11062 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11063 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11064 return (uint64_t)ret_conv;
11067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
11068 LDKStr o_conv = java_to_owned_str(env, o);
11069 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11070 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11071 return (uint64_t)ret_conv;
11074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11075 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11076 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11077 *ret_conv = CResult_StringErrorZ_err(e_conv);
11078 return (uint64_t)ret_conv;
11081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11082 if ((_res & 1) != 0) return;
11083 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
11085 CResult_StringErrorZ_free(_res_conv);
11088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11089 LDKChannelMonitorUpdate o_conv;
11090 o_conv.inner = (void*)(o & (~1));
11091 o_conv.is_owned = (o & 1) || (o == 0);
11092 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11093 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11094 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11095 return (uint64_t)ret_conv;
11098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11099 LDKDecodeError e_conv;
11100 e_conv.inner = (void*)(e & (~1));
11101 e_conv.is_owned = (e & 1) || (e == 0);
11102 e_conv = DecodeError_clone(&e_conv);
11103 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11104 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11105 return (uint64_t)ret_conv;
11108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11109 if ((_res & 1) != 0) return;
11110 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11112 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11116 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11117 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11118 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11119 return (uint64_t)ret_conv;
11122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11123 LDKHTLCUpdate o_conv;
11124 o_conv.inner = (void*)(o & (~1));
11125 o_conv.is_owned = (o & 1) || (o == 0);
11126 o_conv = HTLCUpdate_clone(&o_conv);
11127 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11128 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11129 return (uint64_t)ret_conv;
11132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11133 LDKDecodeError e_conv;
11134 e_conv.inner = (void*)(e & (~1));
11135 e_conv.is_owned = (e & 1) || (e == 0);
11136 e_conv = DecodeError_clone(&e_conv);
11137 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11138 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11139 return (uint64_t)ret_conv;
11142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11143 if ((_res & 1) != 0) return;
11144 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11146 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11150 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11151 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11152 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11153 return (uint64_t)ret_conv;
11156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
11157 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11158 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11159 return (uint64_t)ret_conv;
11162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11163 LDKMonitorUpdateError e_conv;
11164 e_conv.inner = (void*)(e & (~1));
11165 e_conv.is_owned = (e & 1) || (e == 0);
11166 e_conv = MonitorUpdateError_clone(&e_conv);
11167 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11168 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11169 return (uint64_t)ret_conv;
11172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11173 if ((_res & 1) != 0) return;
11174 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
11176 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11180 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11181 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11182 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11183 return (uint64_t)ret_conv;
11186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11187 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11188 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11189 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
11190 return (uint64_t)ret_ref;
11193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11194 LDKOutPoint a_conv;
11195 a_conv.inner = (void*)(a & (~1));
11196 a_conv.is_owned = (a & 1) || (a == 0);
11197 a_conv = OutPoint_clone(&a_conv);
11199 b_ref.datalen = (*env)->GetArrayLength(env, b);
11200 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11201 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11202 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11203 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11204 return (uint64_t)ret_ref;
11207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11208 if ((_res & 1) != 0) return;
11209 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
11211 C2Tuple_OutPointScriptZ_free(_res_conv);
11214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11215 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11216 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11217 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
11218 return (uint64_t)ret_ref;
11221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
11223 b_ref.datalen = (*env)->GetArrayLength(env, b);
11224 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11225 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11226 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11227 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
11228 return (uint64_t)ret_ref;
11231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11232 if ((_res & 1) != 0) return;
11233 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
11235 C2Tuple_u32ScriptZ_free(_res_conv);
11238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11239 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11240 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11241 if (_res_constr.datalen > 0)
11242 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11244 _res_constr.data = NULL;
11245 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11246 for (size_t b = 0; b < _res_constr.datalen; b++) {
11247 int64_t _res_conv_27 = _res_vals[b];
11248 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
11249 FREE((void*)_res_conv_27);
11250 _res_constr.data[b] = _res_conv_27_conv;
11252 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11253 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11257 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11258 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11259 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11260 return (uint64_t)ret_ref;
11263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11264 LDKThirtyTwoBytes a_ref;
11265 CHECK((*env)->GetArrayLength(env, a) == 32);
11266 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11267 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11268 b_constr.datalen = (*env)->GetArrayLength(env, b);
11269 if (b_constr.datalen > 0)
11270 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11272 b_constr.data = NULL;
11273 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11274 for (size_t b = 0; b < b_constr.datalen; b++) {
11275 int64_t b_conv_27 = b_vals[b];
11276 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
11277 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
11278 b_constr.data[b] = b_conv_27_conv;
11280 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11281 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11282 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11283 return (uint64_t)ret_ref;
11286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11287 if ((_res & 1) != 0) return;
11288 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
11290 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11294 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11295 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11296 if (_res_constr.datalen > 0)
11297 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11299 _res_constr.data = NULL;
11300 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11301 for (size_t v = 0; v < _res_constr.datalen; v++) {
11302 int64_t _res_conv_47 = _res_vals[v];
11303 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11304 FREE((void*)_res_conv_47);
11305 _res_constr.data[v] = _res_conv_47_conv;
11307 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11308 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11312 LDKCVec_EventZ _res_constr;
11313 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11314 if (_res_constr.datalen > 0)
11315 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11317 _res_constr.data = NULL;
11318 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11319 for (size_t h = 0; h < _res_constr.datalen; h++) {
11320 int64_t _res_conv_7 = _res_vals[h];
11321 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11322 FREE((void*)_res_conv_7);
11323 _res_constr.data[h] = _res_conv_7_conv;
11325 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11326 CVec_EventZ_free(_res_constr);
11329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11330 LDKCVec_TransactionZ _res_constr;
11331 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11332 if (_res_constr.datalen > 0)
11333 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11335 _res_constr.data = NULL;
11336 for (size_t i = 0; i < _res_constr.datalen; i++) {
11337 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11338 LDKTransaction _res_conv_8_ref;
11339 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11340 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11341 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11342 _res_conv_8_ref.data_is_owned = true;
11343 _res_constr.data[i] = _res_conv_8_ref;
11345 CVec_TransactionZ_free(_res_constr);
11348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11349 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11350 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11351 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11352 return (uint64_t)ret_ref;
11355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11356 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11357 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11358 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11359 return (uint64_t)ret_ref;
11362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11363 if ((_res & 1) != 0) return;
11364 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11366 C2Tuple_u32TxOutZ_free(_res_conv);
11369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11370 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11371 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11372 if (_res_constr.datalen > 0)
11373 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11375 _res_constr.data = NULL;
11376 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11377 for (size_t a = 0; a < _res_constr.datalen; a++) {
11378 int64_t _res_conv_26 = _res_vals[a];
11379 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11380 FREE((void*)_res_conv_26);
11381 _res_constr.data[a] = _res_conv_26_conv;
11383 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11384 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11388 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11389 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11390 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11391 return (uint64_t)ret_ref;
11394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11395 LDKThirtyTwoBytes a_ref;
11396 CHECK((*env)->GetArrayLength(env, a) == 32);
11397 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11398 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11399 b_constr.datalen = (*env)->GetArrayLength(env, b);
11400 if (b_constr.datalen > 0)
11401 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11403 b_constr.data = NULL;
11404 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11405 for (size_t a = 0; a < b_constr.datalen; a++) {
11406 int64_t b_conv_26 = b_vals[a];
11407 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11408 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11409 b_constr.data[a] = b_conv_26_conv;
11411 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11412 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11413 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11414 return (uint64_t)ret_ref;
11417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11418 if ((_res & 1) != 0) return;
11419 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11421 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11425 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11426 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11427 if (_res_constr.datalen > 0)
11428 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11430 _res_constr.data = NULL;
11431 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11432 for (size_t u = 0; u < _res_constr.datalen; u++) {
11433 int64_t _res_conv_46 = _res_vals[u];
11434 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11435 FREE((void*)_res_conv_46);
11436 _res_constr.data[u] = _res_conv_46_conv;
11438 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11439 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11443 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11444 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11445 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11446 return (uint64_t)ret_conv;
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11450 LDKDecodeError e_conv;
11451 e_conv.inner = (void*)(e & (~1));
11452 e_conv.is_owned = (e & 1) || (e == 0);
11453 e_conv = DecodeError_clone(&e_conv);
11454 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11455 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11456 return (uint64_t)ret_conv;
11459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11460 if ((_res & 1) != 0) return;
11461 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11463 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11467 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11468 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11469 return (uint64_t)ret_conv;
11472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11473 LDKLightningError e_conv;
11474 e_conv.inner = (void*)(e & (~1));
11475 e_conv.is_owned = (e & 1) || (e == 0);
11476 e_conv = LightningError_clone(&e_conv);
11477 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11478 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11479 return (uint64_t)ret_conv;
11482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11483 if ((_res & 1) != 0) return;
11484 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11486 CResult_boolLightningErrorZ_free(_res_conv);
11489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11490 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11491 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11492 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11493 return (uint64_t)ret_conv;
11496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11497 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11498 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11499 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11500 return (uint64_t)ret_ref;
11503 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) {
11504 LDKChannelAnnouncement a_conv;
11505 a_conv.inner = (void*)(a & (~1));
11506 a_conv.is_owned = (a & 1) || (a == 0);
11507 a_conv = ChannelAnnouncement_clone(&a_conv);
11508 LDKChannelUpdate b_conv;
11509 b_conv.inner = (void*)(b & (~1));
11510 b_conv.is_owned = (b & 1) || (b == 0);
11511 b_conv = ChannelUpdate_clone(&b_conv);
11512 LDKChannelUpdate c_conv;
11513 c_conv.inner = (void*)(c & (~1));
11514 c_conv.is_owned = (c & 1) || (c == 0);
11515 c_conv = ChannelUpdate_clone(&c_conv);
11516 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11517 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11518 return (uint64_t)ret_ref;
11521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11522 if ((_res & 1) != 0) return;
11523 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11525 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11529 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11530 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11531 if (_res_constr.datalen > 0)
11532 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11534 _res_constr.data = NULL;
11535 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11536 for (size_t l = 0; l < _res_constr.datalen; l++) {
11537 int64_t _res_conv_63 = _res_vals[l];
11538 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11539 FREE((void*)_res_conv_63);
11540 _res_constr.data[l] = _res_conv_63_conv;
11542 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11543 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11547 LDKCVec_NodeAnnouncementZ _res_constr;
11548 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11549 if (_res_constr.datalen > 0)
11550 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11552 _res_constr.data = NULL;
11553 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11554 for (size_t s = 0; s < _res_constr.datalen; s++) {
11555 int64_t _res_conv_18 = _res_vals[s];
11556 LDKNodeAnnouncement _res_conv_18_conv;
11557 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11558 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11559 _res_constr.data[s] = _res_conv_18_conv;
11561 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11562 CVec_NodeAnnouncementZ_free(_res_constr);
11565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11566 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11567 *ret_conv = CResult_NoneLightningErrorZ_ok();
11568 return (uint64_t)ret_conv;
11571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11572 LDKLightningError e_conv;
11573 e_conv.inner = (void*)(e & (~1));
11574 e_conv.is_owned = (e & 1) || (e == 0);
11575 e_conv = LightningError_clone(&e_conv);
11576 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11577 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11578 return (uint64_t)ret_conv;
11581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11582 if ((_res & 1) != 0) return;
11583 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11585 CResult_NoneLightningErrorZ_free(_res_conv);
11588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11589 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11590 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11591 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11592 return (uint64_t)ret_conv;
11595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11596 LDKCVec_PublicKeyZ _res_constr;
11597 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11598 if (_res_constr.datalen > 0)
11599 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11601 _res_constr.data = NULL;
11602 for (size_t i = 0; i < _res_constr.datalen; i++) {
11603 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11604 LDKPublicKey _res_conv_8_ref;
11605 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11606 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11607 _res_constr.data[i] = _res_conv_8_ref;
11609 CVec_PublicKeyZ_free(_res_constr);
11612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11614 o_ref.datalen = (*env)->GetArrayLength(env, o);
11615 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11616 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11617 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11618 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11619 return (uint64_t)ret_conv;
11622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11623 LDKPeerHandleError e_conv;
11624 e_conv.inner = (void*)(e & (~1));
11625 e_conv.is_owned = (e & 1) || (e == 0);
11626 e_conv = PeerHandleError_clone(&e_conv);
11627 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11628 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11629 return (uint64_t)ret_conv;
11632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11633 if ((_res & 1) != 0) return;
11634 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11636 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11640 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11641 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11642 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11643 return (uint64_t)ret_conv;
11646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11647 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11648 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11649 return (uint64_t)ret_conv;
11652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11653 LDKPeerHandleError e_conv;
11654 e_conv.inner = (void*)(e & (~1));
11655 e_conv.is_owned = (e & 1) || (e == 0);
11656 e_conv = PeerHandleError_clone(&e_conv);
11657 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11658 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11659 return (uint64_t)ret_conv;
11662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11663 if ((_res & 1) != 0) return;
11664 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11666 CResult_NonePeerHandleErrorZ_free(_res_conv);
11669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11670 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11671 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11672 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11673 return (uint64_t)ret_conv;
11676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11677 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11678 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11679 return (uint64_t)ret_conv;
11682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11683 LDKPeerHandleError e_conv;
11684 e_conv.inner = (void*)(e & (~1));
11685 e_conv.is_owned = (e & 1) || (e == 0);
11686 e_conv = PeerHandleError_clone(&e_conv);
11687 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11688 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11689 return (uint64_t)ret_conv;
11692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11693 if ((_res & 1) != 0) return;
11694 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11696 CResult_boolPeerHandleErrorZ_free(_res_conv);
11699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11700 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11701 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11702 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11703 return (uint64_t)ret_conv;
11706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11707 LDKDirectionalChannelInfo o_conv;
11708 o_conv.inner = (void*)(o & (~1));
11709 o_conv.is_owned = (o & 1) || (o == 0);
11710 o_conv = DirectionalChannelInfo_clone(&o_conv);
11711 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11712 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11713 return (uint64_t)ret_conv;
11716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11717 LDKDecodeError e_conv;
11718 e_conv.inner = (void*)(e & (~1));
11719 e_conv.is_owned = (e & 1) || (e == 0);
11720 e_conv = DecodeError_clone(&e_conv);
11721 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11722 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11723 return (uint64_t)ret_conv;
11726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11727 if ((_res & 1) != 0) return;
11728 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11730 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11734 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11735 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11736 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11737 return (uint64_t)ret_conv;
11740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11741 LDKChannelInfo o_conv;
11742 o_conv.inner = (void*)(o & (~1));
11743 o_conv.is_owned = (o & 1) || (o == 0);
11744 o_conv = ChannelInfo_clone(&o_conv);
11745 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11746 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11747 return (uint64_t)ret_conv;
11750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11751 LDKDecodeError e_conv;
11752 e_conv.inner = (void*)(e & (~1));
11753 e_conv.is_owned = (e & 1) || (e == 0);
11754 e_conv = DecodeError_clone(&e_conv);
11755 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11756 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11757 return (uint64_t)ret_conv;
11760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11761 if ((_res & 1) != 0) return;
11762 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11764 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11768 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11769 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11770 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11771 return (uint64_t)ret_conv;
11774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11775 LDKRoutingFees o_conv;
11776 o_conv.inner = (void*)(o & (~1));
11777 o_conv.is_owned = (o & 1) || (o == 0);
11778 o_conv = RoutingFees_clone(&o_conv);
11779 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11780 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11781 return (uint64_t)ret_conv;
11784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11785 LDKDecodeError e_conv;
11786 e_conv.inner = (void*)(e & (~1));
11787 e_conv.is_owned = (e & 1) || (e == 0);
11788 e_conv = DecodeError_clone(&e_conv);
11789 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11790 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11791 return (uint64_t)ret_conv;
11794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11795 if ((_res & 1) != 0) return;
11796 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11798 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11802 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11803 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11804 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11805 return (uint64_t)ret_conv;
11808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11809 LDKNodeAnnouncementInfo o_conv;
11810 o_conv.inner = (void*)(o & (~1));
11811 o_conv.is_owned = (o & 1) || (o == 0);
11812 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11813 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11814 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11815 return (uint64_t)ret_conv;
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11819 LDKDecodeError e_conv;
11820 e_conv.inner = (void*)(e & (~1));
11821 e_conv.is_owned = (e & 1) || (e == 0);
11822 e_conv = DecodeError_clone(&e_conv);
11823 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11824 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11825 return (uint64_t)ret_conv;
11828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11829 if ((_res & 1) != 0) return;
11830 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11832 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11836 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11837 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11838 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11839 return (uint64_t)ret_conv;
11842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11843 LDKCVec_u64Z _res_constr;
11844 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11845 if (_res_constr.datalen > 0)
11846 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11848 _res_constr.data = NULL;
11849 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11850 for (size_t g = 0; g < _res_constr.datalen; g++) {
11851 int64_t _res_conv_6 = _res_vals[g];
11852 _res_constr.data[g] = _res_conv_6;
11854 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11855 CVec_u64Z_free(_res_constr);
11858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11859 LDKNodeInfo o_conv;
11860 o_conv.inner = (void*)(o & (~1));
11861 o_conv.is_owned = (o & 1) || (o == 0);
11862 o_conv = NodeInfo_clone(&o_conv);
11863 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11864 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11865 return (uint64_t)ret_conv;
11868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11869 LDKDecodeError e_conv;
11870 e_conv.inner = (void*)(e & (~1));
11871 e_conv.is_owned = (e & 1) || (e == 0);
11872 e_conv = DecodeError_clone(&e_conv);
11873 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11874 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11875 return (uint64_t)ret_conv;
11878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11879 if ((_res & 1) != 0) return;
11880 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11882 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11886 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11887 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11888 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11889 return (uint64_t)ret_conv;
11892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11893 LDKNetworkGraph o_conv;
11894 o_conv.inner = (void*)(o & (~1));
11895 o_conv.is_owned = (o & 1) || (o == 0);
11896 o_conv = NetworkGraph_clone(&o_conv);
11897 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11898 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11899 return (uint64_t)ret_conv;
11902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11903 LDKDecodeError e_conv;
11904 e_conv.inner = (void*)(e & (~1));
11905 e_conv.is_owned = (e & 1) || (e == 0);
11906 e_conv = DecodeError_clone(&e_conv);
11907 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11908 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11909 return (uint64_t)ret_conv;
11912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11913 if ((_res & 1) != 0) return;
11914 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11916 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11920 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11921 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11922 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11923 return (uint64_t)ret_conv;
11926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11927 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11928 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11929 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11930 return (uint64_t)ret_conv;
11933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11934 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11935 *ret_conv = CResult_NetAddressu8Z_err(e);
11936 return (uint64_t)ret_conv;
11939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11940 if ((_res & 1) != 0) return;
11941 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11943 CResult_NetAddressu8Z_free(_res_conv);
11946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11947 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11948 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11949 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11950 return (uint64_t)ret_conv;
11953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11954 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11955 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11956 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11957 return (uint64_t)ret_conv;
11960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11961 LDKDecodeError e_conv;
11962 e_conv.inner = (void*)(e & (~1));
11963 e_conv.is_owned = (e & 1) || (e == 0);
11964 e_conv = DecodeError_clone(&e_conv);
11965 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11966 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11967 return (uint64_t)ret_conv;
11970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11971 if ((_res & 1) != 0) return;
11972 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11974 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11978 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11979 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11980 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11981 return (uint64_t)ret_conv;
11984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11985 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11986 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11987 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11988 return (uint64_t)ret_conv;
11991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11992 LDKDecodeError e_conv;
11993 e_conv.inner = (void*)(e & (~1));
11994 e_conv.is_owned = (e & 1) || (e == 0);
11995 e_conv = DecodeError_clone(&e_conv);
11996 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11997 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11998 return (uint64_t)ret_conv;
12001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12002 if ((_res & 1) != 0) return;
12003 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
12005 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12009 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12010 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12011 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12012 return (uint64_t)ret_conv;
12015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12016 LDKCVec_UpdateAddHTLCZ _res_constr;
12017 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12018 if (_res_constr.datalen > 0)
12019 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12021 _res_constr.data = NULL;
12022 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12023 for (size_t p = 0; p < _res_constr.datalen; p++) {
12024 int64_t _res_conv_15 = _res_vals[p];
12025 LDKUpdateAddHTLC _res_conv_15_conv;
12026 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12027 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12028 _res_constr.data[p] = _res_conv_15_conv;
12030 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12031 CVec_UpdateAddHTLCZ_free(_res_constr);
12034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12035 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12036 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12037 if (_res_constr.datalen > 0)
12038 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12040 _res_constr.data = NULL;
12041 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12042 for (size_t t = 0; t < _res_constr.datalen; t++) {
12043 int64_t _res_conv_19 = _res_vals[t];
12044 LDKUpdateFulfillHTLC _res_conv_19_conv;
12045 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12046 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12047 _res_constr.data[t] = _res_conv_19_conv;
12049 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12050 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12054 LDKCVec_UpdateFailHTLCZ _res_constr;
12055 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12056 if (_res_constr.datalen > 0)
12057 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12059 _res_constr.data = NULL;
12060 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12061 for (size_t q = 0; q < _res_constr.datalen; q++) {
12062 int64_t _res_conv_16 = _res_vals[q];
12063 LDKUpdateFailHTLC _res_conv_16_conv;
12064 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12065 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12066 _res_constr.data[q] = _res_conv_16_conv;
12068 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12069 CVec_UpdateFailHTLCZ_free(_res_constr);
12072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12073 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12074 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12075 if (_res_constr.datalen > 0)
12076 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12078 _res_constr.data = NULL;
12079 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12080 for (size_t z = 0; z < _res_constr.datalen; z++) {
12081 int64_t _res_conv_25 = _res_vals[z];
12082 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12083 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12084 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12085 _res_constr.data[z] = _res_conv_25_conv;
12087 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12088 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12092 LDKAcceptChannel o_conv;
12093 o_conv.inner = (void*)(o & (~1));
12094 o_conv.is_owned = (o & 1) || (o == 0);
12095 o_conv = AcceptChannel_clone(&o_conv);
12096 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12097 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12098 return (uint64_t)ret_conv;
12101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12102 LDKDecodeError e_conv;
12103 e_conv.inner = (void*)(e & (~1));
12104 e_conv.is_owned = (e & 1) || (e == 0);
12105 e_conv = DecodeError_clone(&e_conv);
12106 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12107 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12108 return (uint64_t)ret_conv;
12111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12112 if ((_res & 1) != 0) return;
12113 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12115 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12119 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12120 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12121 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12122 return (uint64_t)ret_conv;
12125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12126 LDKAnnouncementSignatures o_conv;
12127 o_conv.inner = (void*)(o & (~1));
12128 o_conv.is_owned = (o & 1) || (o == 0);
12129 o_conv = AnnouncementSignatures_clone(&o_conv);
12130 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12131 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12132 return (uint64_t)ret_conv;
12135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12136 LDKDecodeError e_conv;
12137 e_conv.inner = (void*)(e & (~1));
12138 e_conv.is_owned = (e & 1) || (e == 0);
12139 e_conv = DecodeError_clone(&e_conv);
12140 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12141 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12142 return (uint64_t)ret_conv;
12145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12146 if ((_res & 1) != 0) return;
12147 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12149 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12153 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12154 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12155 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12156 return (uint64_t)ret_conv;
12159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12160 LDKChannelReestablish o_conv;
12161 o_conv.inner = (void*)(o & (~1));
12162 o_conv.is_owned = (o & 1) || (o == 0);
12163 o_conv = ChannelReestablish_clone(&o_conv);
12164 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12165 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12166 return (uint64_t)ret_conv;
12169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12170 LDKDecodeError e_conv;
12171 e_conv.inner = (void*)(e & (~1));
12172 e_conv.is_owned = (e & 1) || (e == 0);
12173 e_conv = DecodeError_clone(&e_conv);
12174 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12175 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12176 return (uint64_t)ret_conv;
12179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12180 if ((_res & 1) != 0) return;
12181 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
12183 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12187 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12188 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12189 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12190 return (uint64_t)ret_conv;
12193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12194 LDKClosingSigned o_conv;
12195 o_conv.inner = (void*)(o & (~1));
12196 o_conv.is_owned = (o & 1) || (o == 0);
12197 o_conv = ClosingSigned_clone(&o_conv);
12198 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12199 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12200 return (uint64_t)ret_conv;
12203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12204 LDKDecodeError e_conv;
12205 e_conv.inner = (void*)(e & (~1));
12206 e_conv.is_owned = (e & 1) || (e == 0);
12207 e_conv = DecodeError_clone(&e_conv);
12208 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12209 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12210 return (uint64_t)ret_conv;
12213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12214 if ((_res & 1) != 0) return;
12215 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12217 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12221 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12222 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12223 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12224 return (uint64_t)ret_conv;
12227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12228 LDKCommitmentSigned o_conv;
12229 o_conv.inner = (void*)(o & (~1));
12230 o_conv.is_owned = (o & 1) || (o == 0);
12231 o_conv = CommitmentSigned_clone(&o_conv);
12232 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12233 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12234 return (uint64_t)ret_conv;
12237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12238 LDKDecodeError e_conv;
12239 e_conv.inner = (void*)(e & (~1));
12240 e_conv.is_owned = (e & 1) || (e == 0);
12241 e_conv = DecodeError_clone(&e_conv);
12242 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12243 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12244 return (uint64_t)ret_conv;
12247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12248 if ((_res & 1) != 0) return;
12249 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12251 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12255 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12256 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12257 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12258 return (uint64_t)ret_conv;
12261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12262 LDKFundingCreated o_conv;
12263 o_conv.inner = (void*)(o & (~1));
12264 o_conv.is_owned = (o & 1) || (o == 0);
12265 o_conv = FundingCreated_clone(&o_conv);
12266 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12267 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12268 return (uint64_t)ret_conv;
12271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12272 LDKDecodeError e_conv;
12273 e_conv.inner = (void*)(e & (~1));
12274 e_conv.is_owned = (e & 1) || (e == 0);
12275 e_conv = DecodeError_clone(&e_conv);
12276 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12277 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12278 return (uint64_t)ret_conv;
12281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12282 if ((_res & 1) != 0) return;
12283 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12285 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12289 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12290 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12291 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12292 return (uint64_t)ret_conv;
12295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12296 LDKFundingSigned o_conv;
12297 o_conv.inner = (void*)(o & (~1));
12298 o_conv.is_owned = (o & 1) || (o == 0);
12299 o_conv = FundingSigned_clone(&o_conv);
12300 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12301 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12302 return (uint64_t)ret_conv;
12305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12306 LDKDecodeError e_conv;
12307 e_conv.inner = (void*)(e & (~1));
12308 e_conv.is_owned = (e & 1) || (e == 0);
12309 e_conv = DecodeError_clone(&e_conv);
12310 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12311 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12312 return (uint64_t)ret_conv;
12315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12316 if ((_res & 1) != 0) return;
12317 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12319 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12323 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12324 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12325 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12326 return (uint64_t)ret_conv;
12329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12330 LDKFundingLocked o_conv;
12331 o_conv.inner = (void*)(o & (~1));
12332 o_conv.is_owned = (o & 1) || (o == 0);
12333 o_conv = FundingLocked_clone(&o_conv);
12334 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12335 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12336 return (uint64_t)ret_conv;
12339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12340 LDKDecodeError e_conv;
12341 e_conv.inner = (void*)(e & (~1));
12342 e_conv.is_owned = (e & 1) || (e == 0);
12343 e_conv = DecodeError_clone(&e_conv);
12344 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12345 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12346 return (uint64_t)ret_conv;
12349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12350 if ((_res & 1) != 0) return;
12351 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12353 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12357 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12358 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12359 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12360 return (uint64_t)ret_conv;
12363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12365 o_conv.inner = (void*)(o & (~1));
12366 o_conv.is_owned = (o & 1) || (o == 0);
12367 o_conv = Init_clone(&o_conv);
12368 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12369 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12370 return (uint64_t)ret_conv;
12373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12374 LDKDecodeError e_conv;
12375 e_conv.inner = (void*)(e & (~1));
12376 e_conv.is_owned = (e & 1) || (e == 0);
12377 e_conv = DecodeError_clone(&e_conv);
12378 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12379 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12380 return (uint64_t)ret_conv;
12383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12384 if ((_res & 1) != 0) return;
12385 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12387 CResult_InitDecodeErrorZ_free(_res_conv);
12390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12391 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12392 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12393 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12394 return (uint64_t)ret_conv;
12397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12398 LDKOpenChannel o_conv;
12399 o_conv.inner = (void*)(o & (~1));
12400 o_conv.is_owned = (o & 1) || (o == 0);
12401 o_conv = OpenChannel_clone(&o_conv);
12402 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12403 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12404 return (uint64_t)ret_conv;
12407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12408 LDKDecodeError e_conv;
12409 e_conv.inner = (void*)(e & (~1));
12410 e_conv.is_owned = (e & 1) || (e == 0);
12411 e_conv = DecodeError_clone(&e_conv);
12412 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12413 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12414 return (uint64_t)ret_conv;
12417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12418 if ((_res & 1) != 0) return;
12419 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12421 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12425 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12426 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12427 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12428 return (uint64_t)ret_conv;
12431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12432 LDKRevokeAndACK o_conv;
12433 o_conv.inner = (void*)(o & (~1));
12434 o_conv.is_owned = (o & 1) || (o == 0);
12435 o_conv = RevokeAndACK_clone(&o_conv);
12436 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12437 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12438 return (uint64_t)ret_conv;
12441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12442 LDKDecodeError e_conv;
12443 e_conv.inner = (void*)(e & (~1));
12444 e_conv.is_owned = (e & 1) || (e == 0);
12445 e_conv = DecodeError_clone(&e_conv);
12446 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12447 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12448 return (uint64_t)ret_conv;
12451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12452 if ((_res & 1) != 0) return;
12453 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12455 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12459 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12460 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12461 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12462 return (uint64_t)ret_conv;
12465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12466 LDKShutdown o_conv;
12467 o_conv.inner = (void*)(o & (~1));
12468 o_conv.is_owned = (o & 1) || (o == 0);
12469 o_conv = Shutdown_clone(&o_conv);
12470 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12471 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12472 return (uint64_t)ret_conv;
12475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12476 LDKDecodeError e_conv;
12477 e_conv.inner = (void*)(e & (~1));
12478 e_conv.is_owned = (e & 1) || (e == 0);
12479 e_conv = DecodeError_clone(&e_conv);
12480 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12481 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12482 return (uint64_t)ret_conv;
12485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12486 if ((_res & 1) != 0) return;
12487 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12489 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12493 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12494 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12495 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12496 return (uint64_t)ret_conv;
12499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12500 LDKUpdateFailHTLC o_conv;
12501 o_conv.inner = (void*)(o & (~1));
12502 o_conv.is_owned = (o & 1) || (o == 0);
12503 o_conv = UpdateFailHTLC_clone(&o_conv);
12504 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12505 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12506 return (uint64_t)ret_conv;
12509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12510 LDKDecodeError e_conv;
12511 e_conv.inner = (void*)(e & (~1));
12512 e_conv.is_owned = (e & 1) || (e == 0);
12513 e_conv = DecodeError_clone(&e_conv);
12514 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12515 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12516 return (uint64_t)ret_conv;
12519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12520 if ((_res & 1) != 0) return;
12521 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12523 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12527 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12528 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12529 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12530 return (uint64_t)ret_conv;
12533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12534 LDKUpdateFailMalformedHTLC o_conv;
12535 o_conv.inner = (void*)(o & (~1));
12536 o_conv.is_owned = (o & 1) || (o == 0);
12537 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12538 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12539 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12540 return (uint64_t)ret_conv;
12543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12544 LDKDecodeError e_conv;
12545 e_conv.inner = (void*)(e & (~1));
12546 e_conv.is_owned = (e & 1) || (e == 0);
12547 e_conv = DecodeError_clone(&e_conv);
12548 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12549 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12550 return (uint64_t)ret_conv;
12553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12554 if ((_res & 1) != 0) return;
12555 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12557 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12561 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12562 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12563 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12564 return (uint64_t)ret_conv;
12567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12568 LDKUpdateFee o_conv;
12569 o_conv.inner = (void*)(o & (~1));
12570 o_conv.is_owned = (o & 1) || (o == 0);
12571 o_conv = UpdateFee_clone(&o_conv);
12572 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12573 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12574 return (uint64_t)ret_conv;
12577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12578 LDKDecodeError e_conv;
12579 e_conv.inner = (void*)(e & (~1));
12580 e_conv.is_owned = (e & 1) || (e == 0);
12581 e_conv = DecodeError_clone(&e_conv);
12582 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12583 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12584 return (uint64_t)ret_conv;
12587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12588 if ((_res & 1) != 0) return;
12589 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12591 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12595 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12596 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12597 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12598 return (uint64_t)ret_conv;
12601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12602 LDKUpdateFulfillHTLC o_conv;
12603 o_conv.inner = (void*)(o & (~1));
12604 o_conv.is_owned = (o & 1) || (o == 0);
12605 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12606 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12607 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12608 return (uint64_t)ret_conv;
12611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12612 LDKDecodeError e_conv;
12613 e_conv.inner = (void*)(e & (~1));
12614 e_conv.is_owned = (e & 1) || (e == 0);
12615 e_conv = DecodeError_clone(&e_conv);
12616 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12617 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12618 return (uint64_t)ret_conv;
12621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12622 if ((_res & 1) != 0) return;
12623 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12625 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12629 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12630 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12631 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12632 return (uint64_t)ret_conv;
12635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12636 LDKUpdateAddHTLC o_conv;
12637 o_conv.inner = (void*)(o & (~1));
12638 o_conv.is_owned = (o & 1) || (o == 0);
12639 o_conv = UpdateAddHTLC_clone(&o_conv);
12640 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12641 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12642 return (uint64_t)ret_conv;
12645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12646 LDKDecodeError e_conv;
12647 e_conv.inner = (void*)(e & (~1));
12648 e_conv.is_owned = (e & 1) || (e == 0);
12649 e_conv = DecodeError_clone(&e_conv);
12650 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12651 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12652 return (uint64_t)ret_conv;
12655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12656 if ((_res & 1) != 0) return;
12657 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12659 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12663 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12664 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12665 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12666 return (uint64_t)ret_conv;
12669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12671 o_conv.inner = (void*)(o & (~1));
12672 o_conv.is_owned = (o & 1) || (o == 0);
12673 o_conv = Ping_clone(&o_conv);
12674 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12675 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12676 return (uint64_t)ret_conv;
12679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12680 LDKDecodeError e_conv;
12681 e_conv.inner = (void*)(e & (~1));
12682 e_conv.is_owned = (e & 1) || (e == 0);
12683 e_conv = DecodeError_clone(&e_conv);
12684 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12685 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12686 return (uint64_t)ret_conv;
12689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12690 if ((_res & 1) != 0) return;
12691 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12693 CResult_PingDecodeErrorZ_free(_res_conv);
12696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12697 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12698 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12699 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12700 return (uint64_t)ret_conv;
12703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12705 o_conv.inner = (void*)(o & (~1));
12706 o_conv.is_owned = (o & 1) || (o == 0);
12707 o_conv = Pong_clone(&o_conv);
12708 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12709 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12710 return (uint64_t)ret_conv;
12713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12714 LDKDecodeError e_conv;
12715 e_conv.inner = (void*)(e & (~1));
12716 e_conv.is_owned = (e & 1) || (e == 0);
12717 e_conv = DecodeError_clone(&e_conv);
12718 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12719 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12720 return (uint64_t)ret_conv;
12723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12724 if ((_res & 1) != 0) return;
12725 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12727 CResult_PongDecodeErrorZ_free(_res_conv);
12730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12731 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12732 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12733 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12734 return (uint64_t)ret_conv;
12737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12738 LDKUnsignedChannelAnnouncement o_conv;
12739 o_conv.inner = (void*)(o & (~1));
12740 o_conv.is_owned = (o & 1) || (o == 0);
12741 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12742 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12743 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12744 return (uint64_t)ret_conv;
12747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12748 LDKDecodeError e_conv;
12749 e_conv.inner = (void*)(e & (~1));
12750 e_conv.is_owned = (e & 1) || (e == 0);
12751 e_conv = DecodeError_clone(&e_conv);
12752 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12753 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12754 return (uint64_t)ret_conv;
12757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12758 if ((_res & 1) != 0) return;
12759 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12761 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12765 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12766 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12767 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12768 return (uint64_t)ret_conv;
12771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12772 LDKChannelAnnouncement o_conv;
12773 o_conv.inner = (void*)(o & (~1));
12774 o_conv.is_owned = (o & 1) || (o == 0);
12775 o_conv = ChannelAnnouncement_clone(&o_conv);
12776 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12777 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12778 return (uint64_t)ret_conv;
12781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12782 LDKDecodeError e_conv;
12783 e_conv.inner = (void*)(e & (~1));
12784 e_conv.is_owned = (e & 1) || (e == 0);
12785 e_conv = DecodeError_clone(&e_conv);
12786 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12787 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12788 return (uint64_t)ret_conv;
12791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12792 if ((_res & 1) != 0) return;
12793 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12795 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12799 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12800 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12801 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12802 return (uint64_t)ret_conv;
12805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12806 LDKUnsignedChannelUpdate o_conv;
12807 o_conv.inner = (void*)(o & (~1));
12808 o_conv.is_owned = (o & 1) || (o == 0);
12809 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12810 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12811 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12812 return (uint64_t)ret_conv;
12815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12816 LDKDecodeError e_conv;
12817 e_conv.inner = (void*)(e & (~1));
12818 e_conv.is_owned = (e & 1) || (e == 0);
12819 e_conv = DecodeError_clone(&e_conv);
12820 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12821 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12822 return (uint64_t)ret_conv;
12825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12826 if ((_res & 1) != 0) return;
12827 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12829 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12833 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12834 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12835 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12836 return (uint64_t)ret_conv;
12839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12840 LDKChannelUpdate o_conv;
12841 o_conv.inner = (void*)(o & (~1));
12842 o_conv.is_owned = (o & 1) || (o == 0);
12843 o_conv = ChannelUpdate_clone(&o_conv);
12844 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12845 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12846 return (uint64_t)ret_conv;
12849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12850 LDKDecodeError e_conv;
12851 e_conv.inner = (void*)(e & (~1));
12852 e_conv.is_owned = (e & 1) || (e == 0);
12853 e_conv = DecodeError_clone(&e_conv);
12854 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12855 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12856 return (uint64_t)ret_conv;
12859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12860 if ((_res & 1) != 0) return;
12861 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12863 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12867 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12868 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12869 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12870 return (uint64_t)ret_conv;
12873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12874 LDKErrorMessage o_conv;
12875 o_conv.inner = (void*)(o & (~1));
12876 o_conv.is_owned = (o & 1) || (o == 0);
12877 o_conv = ErrorMessage_clone(&o_conv);
12878 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12879 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12880 return (uint64_t)ret_conv;
12883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12884 LDKDecodeError e_conv;
12885 e_conv.inner = (void*)(e & (~1));
12886 e_conv.is_owned = (e & 1) || (e == 0);
12887 e_conv = DecodeError_clone(&e_conv);
12888 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12889 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12890 return (uint64_t)ret_conv;
12893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12894 if ((_res & 1) != 0) return;
12895 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12897 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12901 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12902 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12903 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12904 return (uint64_t)ret_conv;
12907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12908 LDKUnsignedNodeAnnouncement o_conv;
12909 o_conv.inner = (void*)(o & (~1));
12910 o_conv.is_owned = (o & 1) || (o == 0);
12911 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12912 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12913 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12914 return (uint64_t)ret_conv;
12917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12918 LDKDecodeError e_conv;
12919 e_conv.inner = (void*)(e & (~1));
12920 e_conv.is_owned = (e & 1) || (e == 0);
12921 e_conv = DecodeError_clone(&e_conv);
12922 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12923 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12924 return (uint64_t)ret_conv;
12927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12928 if ((_res & 1) != 0) return;
12929 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12931 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12935 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12936 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12937 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12938 return (uint64_t)ret_conv;
12941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12942 LDKNodeAnnouncement o_conv;
12943 o_conv.inner = (void*)(o & (~1));
12944 o_conv.is_owned = (o & 1) || (o == 0);
12945 o_conv = NodeAnnouncement_clone(&o_conv);
12946 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12947 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12948 return (uint64_t)ret_conv;
12951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12952 LDKDecodeError e_conv;
12953 e_conv.inner = (void*)(e & (~1));
12954 e_conv.is_owned = (e & 1) || (e == 0);
12955 e_conv = DecodeError_clone(&e_conv);
12956 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12957 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12958 return (uint64_t)ret_conv;
12961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12962 if ((_res & 1) != 0) return;
12963 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12965 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12969 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12970 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12971 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12972 return (uint64_t)ret_conv;
12975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12976 LDKQueryShortChannelIds o_conv;
12977 o_conv.inner = (void*)(o & (~1));
12978 o_conv.is_owned = (o & 1) || (o == 0);
12979 o_conv = QueryShortChannelIds_clone(&o_conv);
12980 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12981 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12982 return (uint64_t)ret_conv;
12985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12986 LDKDecodeError e_conv;
12987 e_conv.inner = (void*)(e & (~1));
12988 e_conv.is_owned = (e & 1) || (e == 0);
12989 e_conv = DecodeError_clone(&e_conv);
12990 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12991 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12992 return (uint64_t)ret_conv;
12995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12996 if ((_res & 1) != 0) return;
12997 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12999 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13003 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13004 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13005 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13006 return (uint64_t)ret_conv;
13009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13010 LDKReplyShortChannelIdsEnd o_conv;
13011 o_conv.inner = (void*)(o & (~1));
13012 o_conv.is_owned = (o & 1) || (o == 0);
13013 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13014 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13015 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13016 return (uint64_t)ret_conv;
13019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13020 LDKDecodeError e_conv;
13021 e_conv.inner = (void*)(e & (~1));
13022 e_conv.is_owned = (e & 1) || (e == 0);
13023 e_conv = DecodeError_clone(&e_conv);
13024 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13025 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13026 return (uint64_t)ret_conv;
13029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13030 if ((_res & 1) != 0) return;
13031 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
13033 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13037 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13038 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13039 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13040 return (uint64_t)ret_conv;
13043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13044 LDKQueryChannelRange o_conv;
13045 o_conv.inner = (void*)(o & (~1));
13046 o_conv.is_owned = (o & 1) || (o == 0);
13047 o_conv = QueryChannelRange_clone(&o_conv);
13048 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13049 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13050 return (uint64_t)ret_conv;
13053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13054 LDKDecodeError e_conv;
13055 e_conv.inner = (void*)(e & (~1));
13056 e_conv.is_owned = (e & 1) || (e == 0);
13057 e_conv = DecodeError_clone(&e_conv);
13058 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13059 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13060 return (uint64_t)ret_conv;
13063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13064 if ((_res & 1) != 0) return;
13065 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13067 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13071 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13072 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13073 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13074 return (uint64_t)ret_conv;
13077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13078 LDKReplyChannelRange o_conv;
13079 o_conv.inner = (void*)(o & (~1));
13080 o_conv.is_owned = (o & 1) || (o == 0);
13081 o_conv = ReplyChannelRange_clone(&o_conv);
13082 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13083 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13084 return (uint64_t)ret_conv;
13087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13088 LDKDecodeError e_conv;
13089 e_conv.inner = (void*)(e & (~1));
13090 e_conv.is_owned = (e & 1) || (e == 0);
13091 e_conv = DecodeError_clone(&e_conv);
13092 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13093 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13094 return (uint64_t)ret_conv;
13097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13098 if ((_res & 1) != 0) return;
13099 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13101 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13105 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13106 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13107 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13108 return (uint64_t)ret_conv;
13111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13112 LDKGossipTimestampFilter o_conv;
13113 o_conv.inner = (void*)(o & (~1));
13114 o_conv.is_owned = (o & 1) || (o == 0);
13115 o_conv = GossipTimestampFilter_clone(&o_conv);
13116 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13117 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13118 return (uint64_t)ret_conv;
13121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13122 LDKDecodeError e_conv;
13123 e_conv.inner = (void*)(e & (~1));
13124 e_conv.is_owned = (e & 1) || (e == 0);
13125 e_conv = DecodeError_clone(&e_conv);
13126 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13127 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13128 return (uint64_t)ret_conv;
13131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13132 if ((_res & 1) != 0) return;
13133 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
13135 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13139 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13140 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13141 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13142 return (uint64_t)ret_conv;
13145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13147 o_conv.inner = (void*)(o & (~1));
13148 o_conv.is_owned = (o & 1) || (o == 0);
13149 o_conv = Invoice_clone(&o_conv);
13150 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13151 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13152 return (uint64_t)ret_conv;
13155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13156 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
13157 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13158 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13159 return (uint64_t)ret_conv;
13162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13163 if ((_res & 1) != 0) return;
13164 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
13166 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13170 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13171 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13172 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13173 return (uint64_t)ret_conv;
13176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13177 if ((this_ptr & 1) != 0) return;
13178 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
13179 FREE((void*)this_ptr);
13180 Event_free(this_ptr_conv);
13183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13184 LDKEvent* orig_conv = (LDKEvent*)orig;
13185 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13186 *ret_copy = Event_clone(orig_conv);
13187 uint64_t ret_ref = (uint64_t)ret_copy;
13191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
13192 LDKEvent* obj_conv = (LDKEvent*)obj;
13193 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13194 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13195 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13196 CVec_u8Z_free(ret_var);
13200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13201 if ((this_ptr & 1) != 0) return;
13202 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
13203 FREE((void*)this_ptr);
13204 MessageSendEvent_free(this_ptr_conv);
13207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13208 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13209 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13210 *ret_copy = MessageSendEvent_clone(orig_conv);
13211 uint64_t ret_ref = (uint64_t)ret_copy;
13215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13216 if ((this_ptr & 1) != 0) return;
13217 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
13218 FREE((void*)this_ptr);
13219 MessageSendEventsProvider_free(this_ptr_conv);
13222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13223 if ((this_ptr & 1) != 0) return;
13224 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
13225 FREE((void*)this_ptr);
13226 EventsProvider_free(this_ptr_conv);
13229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13230 if ((this_ptr & 1) != 0) return;
13231 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
13232 FREE((void*)this_ptr);
13233 EventHandler_free(this_ptr_conv);
13236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13237 if ((this_ptr & 1) != 0) return;
13238 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
13239 FREE((void*)this_ptr);
13240 APIError_free(this_ptr_conv);
13243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13244 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13245 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13246 *ret_copy = APIError_clone(orig_conv);
13247 uint64_t ret_ref = (uint64_t)ret_copy;
13251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
13252 LDKu8slice msg_ref;
13253 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13254 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13255 LDKSecretKey sk_ref;
13256 CHECK((*env)->GetArrayLength(env, sk) == 32);
13257 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
13258 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13259 *ret_conv = sign(msg_ref, sk_ref);
13260 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13261 return (uint64_t)ret_conv;
13264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
13265 LDKu8slice msg_ref;
13266 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13267 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13268 LDKStr sig_conv = java_to_owned_str(env, sig);
13269 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13270 *ret_conv = recover_pk(msg_ref, sig_conv);
13271 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13272 return (uint64_t)ret_conv;
13275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
13276 LDKu8slice msg_ref;
13277 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13278 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13279 LDKStr sig_conv = java_to_owned_str(env, sig);
13280 LDKPublicKey pk_ref;
13281 CHECK((*env)->GetArrayLength(env, pk) == 33);
13282 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
13283 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13284 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13288 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13289 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13290 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
13294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
13295 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13296 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13297 jboolean ret_val = Level_eq(a_conv, b_conv);
13301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13302 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13303 int64_t ret_val = Level_hash(o_conv);
13307 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13308 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13313 if ((this_ptr & 1) != 0) return;
13314 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13315 FREE((void*)this_ptr);
13316 Logger_free(this_ptr_conv);
13319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13320 LDKChannelHandshakeConfig this_obj_conv;
13321 this_obj_conv.inner = (void*)(this_obj & (~1));
13322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13323 ChannelHandshakeConfig_free(this_obj_conv);
13326 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13327 LDKChannelHandshakeConfig this_ptr_conv;
13328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13329 this_ptr_conv.is_owned = false;
13330 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13335 LDKChannelHandshakeConfig this_ptr_conv;
13336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13337 this_ptr_conv.is_owned = false;
13338 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13341 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13342 LDKChannelHandshakeConfig this_ptr_conv;
13343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13344 this_ptr_conv.is_owned = false;
13345 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13349 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) {
13350 LDKChannelHandshakeConfig this_ptr_conv;
13351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13352 this_ptr_conv.is_owned = false;
13353 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13357 LDKChannelHandshakeConfig this_ptr_conv;
13358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13359 this_ptr_conv.is_owned = false;
13360 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13364 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) {
13365 LDKChannelHandshakeConfig this_ptr_conv;
13366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13367 this_ptr_conv.is_owned = false;
13368 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13371 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) {
13372 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13375 uint64_t ret_ref = (uint64_t)ret_var.inner;
13376 if (ret_var.is_owned) {
13382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13383 LDKChannelHandshakeConfig orig_conv;
13384 orig_conv.inner = (void*)(orig & (~1));
13385 orig_conv.is_owned = false;
13386 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13389 uint64_t ret_ref = (uint64_t)ret_var.inner;
13390 if (ret_var.is_owned) {
13396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13397 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13400 uint64_t ret_ref = (uint64_t)ret_var.inner;
13401 if (ret_var.is_owned) {
13407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13408 LDKChannelHandshakeLimits this_obj_conv;
13409 this_obj_conv.inner = (void*)(this_obj & (~1));
13410 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13411 ChannelHandshakeLimits_free(this_obj_conv);
13414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13415 LDKChannelHandshakeLimits this_ptr_conv;
13416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13417 this_ptr_conv.is_owned = false;
13418 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13423 LDKChannelHandshakeLimits this_ptr_conv;
13424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13425 this_ptr_conv.is_owned = false;
13426 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13430 LDKChannelHandshakeLimits this_ptr_conv;
13431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13432 this_ptr_conv.is_owned = false;
13433 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13437 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) {
13438 LDKChannelHandshakeLimits this_ptr_conv;
13439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13440 this_ptr_conv.is_owned = false;
13441 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13444 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) {
13445 LDKChannelHandshakeLimits this_ptr_conv;
13446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13447 this_ptr_conv.is_owned = false;
13448 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13452 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) {
13453 LDKChannelHandshakeLimits this_ptr_conv;
13454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13455 this_ptr_conv.is_owned = false;
13456 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13460 LDKChannelHandshakeLimits this_ptr_conv;
13461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13462 this_ptr_conv.is_owned = false;
13463 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13467 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) {
13468 LDKChannelHandshakeLimits this_ptr_conv;
13469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13470 this_ptr_conv.is_owned = false;
13471 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13474 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13475 LDKChannelHandshakeLimits this_ptr_conv;
13476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13477 this_ptr_conv.is_owned = false;
13478 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13482 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) {
13483 LDKChannelHandshakeLimits this_ptr_conv;
13484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13485 this_ptr_conv.is_owned = false;
13486 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13490 LDKChannelHandshakeLimits this_ptr_conv;
13491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13492 this_ptr_conv.is_owned = false;
13493 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13498 LDKChannelHandshakeLimits this_ptr_conv;
13499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13500 this_ptr_conv.is_owned = false;
13501 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13505 LDKChannelHandshakeLimits this_ptr_conv;
13506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13507 this_ptr_conv.is_owned = false;
13508 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13513 LDKChannelHandshakeLimits this_ptr_conv;
13514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13515 this_ptr_conv.is_owned = false;
13516 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13519 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13520 LDKChannelHandshakeLimits this_ptr_conv;
13521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13522 this_ptr_conv.is_owned = false;
13523 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13527 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) {
13528 LDKChannelHandshakeLimits this_ptr_conv;
13529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13530 this_ptr_conv.is_owned = false;
13531 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13534 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) {
13535 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);
13536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13538 uint64_t ret_ref = (uint64_t)ret_var.inner;
13539 if (ret_var.is_owned) {
13545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13546 LDKChannelHandshakeLimits orig_conv;
13547 orig_conv.inner = (void*)(orig & (~1));
13548 orig_conv.is_owned = false;
13549 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13552 uint64_t ret_ref = (uint64_t)ret_var.inner;
13553 if (ret_var.is_owned) {
13559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13560 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13561 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13562 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13563 uint64_t ret_ref = (uint64_t)ret_var.inner;
13564 if (ret_var.is_owned) {
13570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13571 LDKChannelConfig this_obj_conv;
13572 this_obj_conv.inner = (void*)(this_obj & (~1));
13573 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13574 ChannelConfig_free(this_obj_conv);
13577 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13578 LDKChannelConfig this_ptr_conv;
13579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13580 this_ptr_conv.is_owned = false;
13581 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13586 LDKChannelConfig this_ptr_conv;
13587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13588 this_ptr_conv.is_owned = false;
13589 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13592 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13593 LDKChannelConfig this_ptr_conv;
13594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13595 this_ptr_conv.is_owned = false;
13596 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13601 LDKChannelConfig this_ptr_conv;
13602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13603 this_ptr_conv.is_owned = false;
13604 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13608 LDKChannelConfig this_ptr_conv;
13609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13610 this_ptr_conv.is_owned = false;
13611 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13616 LDKChannelConfig this_ptr_conv;
13617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13618 this_ptr_conv.is_owned = false;
13619 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13623 LDKChannelConfig this_ptr_conv;
13624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13625 this_ptr_conv.is_owned = false;
13626 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13631 LDKChannelConfig this_ptr_conv;
13632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13633 this_ptr_conv.is_owned = false;
13634 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13638 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13641 uint64_t ret_ref = (uint64_t)ret_var.inner;
13642 if (ret_var.is_owned) {
13648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13649 LDKChannelConfig orig_conv;
13650 orig_conv.inner = (void*)(orig & (~1));
13651 orig_conv.is_owned = false;
13652 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13655 uint64_t ret_ref = (uint64_t)ret_var.inner;
13656 if (ret_var.is_owned) {
13662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13663 LDKChannelConfig ret_var = ChannelConfig_default();
13664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13666 uint64_t ret_ref = (uint64_t)ret_var.inner;
13667 if (ret_var.is_owned) {
13673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13674 LDKChannelConfig obj_conv;
13675 obj_conv.inner = (void*)(obj & (~1));
13676 obj_conv.is_owned = false;
13677 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13678 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13679 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13680 CVec_u8Z_free(ret_var);
13684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13685 LDKu8slice ser_ref;
13686 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13687 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13688 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13689 *ret_conv = ChannelConfig_read(ser_ref);
13690 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13691 return (uint64_t)ret_conv;
13694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13695 LDKUserConfig this_obj_conv;
13696 this_obj_conv.inner = (void*)(this_obj & (~1));
13697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13698 UserConfig_free(this_obj_conv);
13701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13702 LDKUserConfig this_ptr_conv;
13703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13704 this_ptr_conv.is_owned = false;
13705 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13708 uint64_t ret_ref = (uint64_t)ret_var.inner;
13709 if (ret_var.is_owned) {
13715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13716 LDKUserConfig this_ptr_conv;
13717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13718 this_ptr_conv.is_owned = false;
13719 LDKChannelHandshakeConfig val_conv;
13720 val_conv.inner = (void*)(val & (~1));
13721 val_conv.is_owned = (val & 1) || (val == 0);
13722 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13723 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13727 LDKUserConfig this_ptr_conv;
13728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13729 this_ptr_conv.is_owned = false;
13730 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13731 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13732 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13733 uint64_t ret_ref = (uint64_t)ret_var.inner;
13734 if (ret_var.is_owned) {
13740 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) {
13741 LDKUserConfig this_ptr_conv;
13742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13743 this_ptr_conv.is_owned = false;
13744 LDKChannelHandshakeLimits val_conv;
13745 val_conv.inner = (void*)(val & (~1));
13746 val_conv.is_owned = (val & 1) || (val == 0);
13747 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13748 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13752 LDKUserConfig this_ptr_conv;
13753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13754 this_ptr_conv.is_owned = false;
13755 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13756 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13757 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13758 uint64_t ret_ref = (uint64_t)ret_var.inner;
13759 if (ret_var.is_owned) {
13765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13766 LDKUserConfig this_ptr_conv;
13767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13768 this_ptr_conv.is_owned = false;
13769 LDKChannelConfig val_conv;
13770 val_conv.inner = (void*)(val & (~1));
13771 val_conv.is_owned = (val & 1) || (val == 0);
13772 val_conv = ChannelConfig_clone(&val_conv);
13773 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13776 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) {
13777 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13778 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13779 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13780 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13781 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13782 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13783 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13784 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13785 LDKChannelConfig channel_options_arg_conv;
13786 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13787 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13788 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13789 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13792 uint64_t ret_ref = (uint64_t)ret_var.inner;
13793 if (ret_var.is_owned) {
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13800 LDKUserConfig orig_conv;
13801 orig_conv.inner = (void*)(orig & (~1));
13802 orig_conv.is_owned = false;
13803 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13806 uint64_t ret_ref = (uint64_t)ret_var.inner;
13807 if (ret_var.is_owned) {
13813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13814 LDKUserConfig ret_var = UserConfig_default();
13815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13817 uint64_t ret_ref = (uint64_t)ret_var.inner;
13818 if (ret_var.is_owned) {
13824 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13825 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13826 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13831 if ((this_ptr & 1) != 0) return;
13832 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13833 FREE((void*)this_ptr);
13834 Access_free(this_ptr_conv);
13837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13838 if ((this_ptr & 1) != 0) return;
13839 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13840 FREE((void*)this_ptr);
13841 Listen_free(this_ptr_conv);
13844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13845 if ((this_ptr & 1) != 0) return;
13846 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13847 FREE((void*)this_ptr);
13848 Confirm_free(this_ptr_conv);
13851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13852 if ((this_ptr & 1) != 0) return;
13853 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13854 FREE((void*)this_ptr);
13855 Watch_free(this_ptr_conv);
13858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13859 if ((this_ptr & 1) != 0) return;
13860 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13861 FREE((void*)this_ptr);
13862 Filter_free(this_ptr_conv);
13865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13866 LDKWatchedOutput this_obj_conv;
13867 this_obj_conv.inner = (void*)(this_obj & (~1));
13868 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13869 WatchedOutput_free(this_obj_conv);
13872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13873 LDKWatchedOutput this_ptr_conv;
13874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13875 this_ptr_conv.is_owned = false;
13876 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13877 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13882 LDKWatchedOutput this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 LDKThirtyTwoBytes val_ref;
13886 CHECK((*env)->GetArrayLength(env, val) == 32);
13887 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13888 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13892 LDKWatchedOutput this_ptr_conv;
13893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13894 this_ptr_conv.is_owned = false;
13895 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13898 uint64_t ret_ref = (uint64_t)ret_var.inner;
13899 if (ret_var.is_owned) {
13905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13906 LDKWatchedOutput this_ptr_conv;
13907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13908 this_ptr_conv.is_owned = false;
13909 LDKOutPoint val_conv;
13910 val_conv.inner = (void*)(val & (~1));
13911 val_conv.is_owned = (val & 1) || (val == 0);
13912 val_conv = OutPoint_clone(&val_conv);
13913 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13917 LDKWatchedOutput this_ptr_conv;
13918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13919 this_ptr_conv.is_owned = false;
13920 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13921 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13922 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13927 LDKWatchedOutput this_ptr_conv;
13928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13929 this_ptr_conv.is_owned = false;
13930 LDKCVec_u8Z val_ref;
13931 val_ref.datalen = (*env)->GetArrayLength(env, val);
13932 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13933 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13934 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13937 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) {
13938 LDKThirtyTwoBytes block_hash_arg_ref;
13939 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13940 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13941 LDKOutPoint outpoint_arg_conv;
13942 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13943 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13944 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13945 LDKCVec_u8Z script_pubkey_arg_ref;
13946 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13947 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13948 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13949 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13952 uint64_t ret_ref = (uint64_t)ret_var.inner;
13953 if (ret_var.is_owned) {
13959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13960 LDKWatchedOutput orig_conv;
13961 orig_conv.inner = (void*)(orig & (~1));
13962 orig_conv.is_owned = false;
13963 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13966 uint64_t ret_ref = (uint64_t)ret_var.inner;
13967 if (ret_var.is_owned) {
13973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13974 LDKWatchedOutput o_conv;
13975 o_conv.inner = (void*)(o & (~1));
13976 o_conv.is_owned = false;
13977 int64_t ret_val = WatchedOutput_hash(&o_conv);
13981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13982 if ((this_ptr & 1) != 0) return;
13983 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13984 FREE((void*)this_ptr);
13985 BroadcasterInterface_free(this_ptr_conv);
13988 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13989 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13990 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13995 if ((this_ptr & 1) != 0) return;
13996 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13997 FREE((void*)this_ptr);
13998 FeeEstimator_free(this_ptr_conv);
14001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14002 LDKChainMonitor this_obj_conv;
14003 this_obj_conv.inner = (void*)(this_obj & (~1));
14004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14005 ChainMonitor_free(this_obj_conv);
14008 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) {
14009 LDKFilter *chain_source_conv_ptr = NULL;
14010 if (chain_source != 0) {
14011 LDKFilter chain_source_conv;
14012 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
14013 if (chain_source_conv.free == LDKFilter_JCalls_free) {
14014 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14015 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
14017 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14018 *chain_source_conv_ptr = chain_source_conv;
14020 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14021 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14022 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14023 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14025 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14026 if (logger_conv.free == LDKLogger_JCalls_free) {
14027 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14028 LDKLogger_JCalls_clone(logger_conv.this_arg);
14030 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
14031 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
14032 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14033 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
14035 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
14036 if (persister_conv.free == LDKPersist_JCalls_free) {
14037 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14038 LDKPersist_JCalls_clone(persister_conv.this_arg);
14040 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
14041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14043 uint64_t ret_ref = (uint64_t)ret_var.inner;
14044 if (ret_var.is_owned) {
14050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
14051 LDKChainMonitor this_arg_conv;
14052 this_arg_conv.inner = (void*)(this_arg & (~1));
14053 this_arg_conv.is_owned = false;
14054 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14055 *ret = ChainMonitor_as_Listen(&this_arg_conv);
14056 return (uint64_t)ret;
14059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
14060 LDKChainMonitor this_arg_conv;
14061 this_arg_conv.inner = (void*)(this_arg & (~1));
14062 this_arg_conv.is_owned = false;
14063 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14064 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
14065 return (uint64_t)ret;
14068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14069 LDKChainMonitor this_arg_conv;
14070 this_arg_conv.inner = (void*)(this_arg & (~1));
14071 this_arg_conv.is_owned = false;
14072 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
14073 *ret = ChainMonitor_as_Watch(&this_arg_conv);
14074 return (uint64_t)ret;
14077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
14078 LDKChainMonitor this_arg_conv;
14079 this_arg_conv.inner = (void*)(this_arg & (~1));
14080 this_arg_conv.is_owned = false;
14081 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14082 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14083 return (uint64_t)ret;
14086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14087 LDKChannelMonitorUpdate this_obj_conv;
14088 this_obj_conv.inner = (void*)(this_obj & (~1));
14089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14090 ChannelMonitorUpdate_free(this_obj_conv);
14093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14094 LDKChannelMonitorUpdate this_ptr_conv;
14095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14096 this_ptr_conv.is_owned = false;
14097 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14102 LDKChannelMonitorUpdate this_ptr_conv;
14103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14104 this_ptr_conv.is_owned = false;
14105 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14109 LDKChannelMonitorUpdate orig_conv;
14110 orig_conv.inner = (void*)(orig & (~1));
14111 orig_conv.is_owned = false;
14112 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14115 uint64_t ret_ref = (uint64_t)ret_var.inner;
14116 if (ret_var.is_owned) {
14122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14123 LDKChannelMonitorUpdate obj_conv;
14124 obj_conv.inner = (void*)(obj & (~1));
14125 obj_conv.is_owned = false;
14126 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14127 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14128 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14129 CVec_u8Z_free(ret_var);
14133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14134 LDKu8slice ser_ref;
14135 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14136 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14137 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14138 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14139 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14140 return (uint64_t)ret_conv;
14143 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14144 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
14145 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
14149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14150 LDKMonitorUpdateError this_obj_conv;
14151 this_obj_conv.inner = (void*)(this_obj & (~1));
14152 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14153 MonitorUpdateError_free(this_obj_conv);
14156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14157 LDKMonitorUpdateError orig_conv;
14158 orig_conv.inner = (void*)(orig & (~1));
14159 orig_conv.is_owned = false;
14160 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14163 uint64_t ret_ref = (uint64_t)ret_var.inner;
14164 if (ret_var.is_owned) {
14170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14171 if ((this_ptr & 1) != 0) return;
14172 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
14173 FREE((void*)this_ptr);
14174 MonitorEvent_free(this_ptr_conv);
14177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14178 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14179 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14180 *ret_copy = MonitorEvent_clone(orig_conv);
14181 uint64_t ret_ref = (uint64_t)ret_copy;
14185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14186 LDKHTLCUpdate this_obj_conv;
14187 this_obj_conv.inner = (void*)(this_obj & (~1));
14188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14189 HTLCUpdate_free(this_obj_conv);
14192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14193 LDKHTLCUpdate orig_conv;
14194 orig_conv.inner = (void*)(orig & (~1));
14195 orig_conv.is_owned = false;
14196 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14199 uint64_t ret_ref = (uint64_t)ret_var.inner;
14200 if (ret_var.is_owned) {
14206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14207 LDKHTLCUpdate obj_conv;
14208 obj_conv.inner = (void*)(obj & (~1));
14209 obj_conv.is_owned = false;
14210 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14213 CVec_u8Z_free(ret_var);
14217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14218 LDKu8slice ser_ref;
14219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14221 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14222 *ret_conv = HTLCUpdate_read(ser_ref);
14223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14224 return (uint64_t)ret_conv;
14227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14228 LDKChannelMonitor this_obj_conv;
14229 this_obj_conv.inner = (void*)(this_obj & (~1));
14230 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14231 ChannelMonitor_free(this_obj_conv);
14234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14235 LDKChannelMonitor orig_conv;
14236 orig_conv.inner = (void*)(orig & (~1));
14237 orig_conv.is_owned = false;
14238 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14241 uint64_t ret_ref = (uint64_t)ret_var.inner;
14242 if (ret_var.is_owned) {
14248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14249 LDKChannelMonitor obj_conv;
14250 obj_conv.inner = (void*)(obj & (~1));
14251 obj_conv.is_owned = false;
14252 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14253 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14254 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14255 CVec_u8Z_free(ret_var);
14259 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) {
14260 LDKChannelMonitor this_arg_conv;
14261 this_arg_conv.inner = (void*)(this_arg & (~1));
14262 this_arg_conv.is_owned = false;
14263 LDKChannelMonitorUpdate updates_conv;
14264 updates_conv.inner = (void*)(updates & (~1));
14265 updates_conv.is_owned = false;
14266 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14267 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14268 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14269 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14270 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14271 return (uint64_t)ret_conv;
14274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14275 LDKChannelMonitor this_arg_conv;
14276 this_arg_conv.inner = (void*)(this_arg & (~1));
14277 this_arg_conv.is_owned = false;
14278 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
14283 LDKChannelMonitor this_arg_conv;
14284 this_arg_conv.inner = (void*)(this_arg & (~1));
14285 this_arg_conv.is_owned = false;
14286 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14287 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
14288 return (uint64_t)ret_ref;
14291 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14292 LDKChannelMonitor this_arg_conv;
14293 this_arg_conv.inner = (void*)(this_arg & (~1));
14294 this_arg_conv.is_owned = false;
14295 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14296 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14297 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14298 for (size_t v = 0; v < ret_var.datalen; v++) {
14299 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14300 *ret_conv_47_ref = ret_var.data[v];
14301 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14303 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14304 FREE(ret_var.data);
14308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14309 LDKChannelMonitor this_arg_conv;
14310 this_arg_conv.inner = (void*)(this_arg & (~1));
14311 this_arg_conv.is_owned = false;
14312 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14313 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14316 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14317 LDKChannelMonitor this_arg_conv;
14318 this_arg_conv.inner = (void*)(this_arg & (~1));
14319 this_arg_conv.is_owned = false;
14320 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14321 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14322 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14323 for (size_t o = 0; o < ret_var.datalen; o++) {
14324 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14325 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14326 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14327 ret_arr_ptr[o] = ret_conv_14_ref;
14329 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14330 FREE(ret_var.data);
14334 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14335 LDKChannelMonitor this_arg_conv;
14336 this_arg_conv.inner = (void*)(this_arg & (~1));
14337 this_arg_conv.is_owned = false;
14338 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14339 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14340 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14341 for (size_t h = 0; h < ret_var.datalen; h++) {
14342 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14343 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14344 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14345 ret_arr_ptr[h] = ret_conv_7_ref;
14347 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14348 FREE(ret_var.data);
14352 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) {
14353 LDKChannelMonitor this_arg_conv;
14354 this_arg_conv.inner = (void*)(this_arg & (~1));
14355 this_arg_conv.is_owned = false;
14356 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14357 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14358 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14360 for (size_t i = 0; i < ret_var.datalen; i++) {
14361 LDKTransaction ret_conv_8_var = ret_var.data[i];
14362 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14363 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14364 Transaction_free(ret_conv_8_var);
14365 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14367 FREE(ret_var.data);
14371 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) {
14372 LDKChannelMonitor this_arg_conv;
14373 this_arg_conv.inner = (void*)(this_arg & (~1));
14374 this_arg_conv.is_owned = false;
14375 unsigned char header_arr[80];
14376 CHECK((*env)->GetArrayLength(env, header) == 80);
14377 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14378 unsigned char (*header_ref)[80] = &header_arr;
14379 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14380 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14381 if (txdata_constr.datalen > 0)
14382 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14384 txdata_constr.data = NULL;
14385 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14386 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14387 int64_t txdata_conv_24 = txdata_vals[y];
14388 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14389 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14390 txdata_constr.data[y] = txdata_conv_24_conv;
14392 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14393 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14394 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14395 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14396 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14398 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14399 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14400 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14401 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14403 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14404 if (logger_conv.free == LDKLogger_JCalls_free) {
14405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14406 LDKLogger_JCalls_clone(logger_conv.this_arg);
14408 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);
14409 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14410 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14411 for (size_t u = 0; u < ret_var.datalen; u++) {
14412 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14413 *ret_conv_46_ref = ret_var.data[u];
14414 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14416 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14417 FREE(ret_var.data);
14421 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) {
14422 LDKChannelMonitor this_arg_conv;
14423 this_arg_conv.inner = (void*)(this_arg & (~1));
14424 this_arg_conv.is_owned = false;
14425 unsigned char header_arr[80];
14426 CHECK((*env)->GetArrayLength(env, header) == 80);
14427 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14428 unsigned char (*header_ref)[80] = &header_arr;
14429 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14430 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14431 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14432 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14434 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14435 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14436 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14437 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14439 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14440 if (logger_conv.free == LDKLogger_JCalls_free) {
14441 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14442 LDKLogger_JCalls_clone(logger_conv.this_arg);
14444 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14447 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) {
14448 LDKChannelMonitor this_arg_conv;
14449 this_arg_conv.inner = (void*)(this_arg & (~1));
14450 this_arg_conv.is_owned = false;
14451 unsigned char header_arr[80];
14452 CHECK((*env)->GetArrayLength(env, header) == 80);
14453 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14454 unsigned char (*header_ref)[80] = &header_arr;
14455 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14456 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14457 if (txdata_constr.datalen > 0)
14458 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14460 txdata_constr.data = NULL;
14461 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14462 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14463 int64_t txdata_conv_24 = txdata_vals[y];
14464 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14465 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14466 txdata_constr.data[y] = txdata_conv_24_conv;
14468 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14469 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14470 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14471 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14472 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14474 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14475 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14476 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14477 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14479 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14480 if (logger_conv.free == LDKLogger_JCalls_free) {
14481 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14482 LDKLogger_JCalls_clone(logger_conv.this_arg);
14484 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);
14485 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14486 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14487 for (size_t u = 0; u < ret_var.datalen; u++) {
14488 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14489 *ret_conv_46_ref = ret_var.data[u];
14490 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14492 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14493 FREE(ret_var.data);
14497 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) {
14498 LDKChannelMonitor this_arg_conv;
14499 this_arg_conv.inner = (void*)(this_arg & (~1));
14500 this_arg_conv.is_owned = false;
14501 unsigned char txid_arr[32];
14502 CHECK((*env)->GetArrayLength(env, txid) == 32);
14503 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14504 unsigned char (*txid_ref)[32] = &txid_arr;
14505 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14506 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14507 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14508 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14510 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14511 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14512 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14513 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14515 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14516 if (logger_conv.free == LDKLogger_JCalls_free) {
14517 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14518 LDKLogger_JCalls_clone(logger_conv.this_arg);
14520 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14523 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) {
14524 LDKChannelMonitor this_arg_conv;
14525 this_arg_conv.inner = (void*)(this_arg & (~1));
14526 this_arg_conv.is_owned = false;
14527 unsigned char header_arr[80];
14528 CHECK((*env)->GetArrayLength(env, header) == 80);
14529 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14530 unsigned char (*header_ref)[80] = &header_arr;
14531 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14532 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14533 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14534 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14536 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14537 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14538 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14539 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14541 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14542 if (logger_conv.free == LDKLogger_JCalls_free) {
14543 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14544 LDKLogger_JCalls_clone(logger_conv.this_arg);
14546 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14547 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14548 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14549 for (size_t u = 0; u < ret_var.datalen; u++) {
14550 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14551 *ret_conv_46_ref = ret_var.data[u];
14552 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14554 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14555 FREE(ret_var.data);
14559 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14560 LDKChannelMonitor this_arg_conv;
14561 this_arg_conv.inner = (void*)(this_arg & (~1));
14562 this_arg_conv.is_owned = false;
14563 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14564 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14566 for (size_t i = 0; i < ret_var.datalen; i++) {
14567 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14568 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14569 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14571 FREE(ret_var.data);
14575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14576 if ((this_ptr & 1) != 0) return;
14577 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14578 FREE((void*)this_ptr);
14579 Persist_free(this_ptr_conv);
14582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14583 LDKu8slice ser_ref;
14584 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14585 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14586 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14587 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14588 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14589 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14590 return (uint64_t)ret_conv;
14593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14594 LDKOutPoint this_obj_conv;
14595 this_obj_conv.inner = (void*)(this_obj & (~1));
14596 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14597 OutPoint_free(this_obj_conv);
14600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14601 LDKOutPoint this_ptr_conv;
14602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14603 this_ptr_conv.is_owned = false;
14604 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14605 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14610 LDKOutPoint this_ptr_conv;
14611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14612 this_ptr_conv.is_owned = false;
14613 LDKThirtyTwoBytes val_ref;
14614 CHECK((*env)->GetArrayLength(env, val) == 32);
14615 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14616 OutPoint_set_txid(&this_ptr_conv, val_ref);
14619 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14620 LDKOutPoint this_ptr_conv;
14621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14622 this_ptr_conv.is_owned = false;
14623 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14628 LDKOutPoint this_ptr_conv;
14629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14630 this_ptr_conv.is_owned = false;
14631 OutPoint_set_index(&this_ptr_conv, val);
14634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14635 LDKThirtyTwoBytes txid_arg_ref;
14636 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14637 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14638 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14641 uint64_t ret_ref = (uint64_t)ret_var.inner;
14642 if (ret_var.is_owned) {
14648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14649 LDKOutPoint orig_conv;
14650 orig_conv.inner = (void*)(orig & (~1));
14651 orig_conv.is_owned = false;
14652 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14655 uint64_t ret_ref = (uint64_t)ret_var.inner;
14656 if (ret_var.is_owned) {
14662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14663 LDKOutPoint a_conv;
14664 a_conv.inner = (void*)(a & (~1));
14665 a_conv.is_owned = false;
14666 LDKOutPoint b_conv;
14667 b_conv.inner = (void*)(b & (~1));
14668 b_conv.is_owned = false;
14669 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14674 LDKOutPoint o_conv;
14675 o_conv.inner = (void*)(o & (~1));
14676 o_conv.is_owned = false;
14677 int64_t ret_val = OutPoint_hash(&o_conv);
14681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14682 LDKOutPoint this_arg_conv;
14683 this_arg_conv.inner = (void*)(this_arg & (~1));
14684 this_arg_conv.is_owned = false;
14685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14691 LDKOutPoint obj_conv;
14692 obj_conv.inner = (void*)(obj & (~1));
14693 obj_conv.is_owned = false;
14694 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14695 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14696 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14697 CVec_u8Z_free(ret_var);
14701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14702 LDKu8slice ser_ref;
14703 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14704 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14705 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14706 *ret_conv = OutPoint_read(ser_ref);
14707 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14708 return (uint64_t)ret_conv;
14711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14712 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14713 this_obj_conv.inner = (void*)(this_obj & (~1));
14714 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14715 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14719 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14721 this_ptr_conv.is_owned = false;
14722 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14725 uint64_t ret_ref = (uint64_t)ret_var.inner;
14726 if (ret_var.is_owned) {
14732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14733 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14735 this_ptr_conv.is_owned = false;
14736 LDKOutPoint val_conv;
14737 val_conv.inner = (void*)(val & (~1));
14738 val_conv.is_owned = (val & 1) || (val == 0);
14739 val_conv = OutPoint_clone(&val_conv);
14740 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14744 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14746 this_ptr_conv.is_owned = false;
14747 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14753 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14755 this_ptr_conv.is_owned = false;
14756 LDKPublicKey val_ref;
14757 CHECK((*env)->GetArrayLength(env, val) == 33);
14758 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14759 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14762 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14763 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14765 this_ptr_conv.is_owned = false;
14766 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14771 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14773 this_ptr_conv.is_owned = false;
14774 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14778 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14780 this_ptr_conv.is_owned = false;
14781 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14782 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14786 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14788 this_ptr_conv.is_owned = false;
14789 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14795 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14797 this_ptr_conv.is_owned = false;
14798 LDKPublicKey val_ref;
14799 CHECK((*env)->GetArrayLength(env, val) == 33);
14800 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14801 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14805 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14807 this_ptr_conv.is_owned = false;
14808 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14809 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14814 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14816 this_ptr_conv.is_owned = false;
14817 LDKThirtyTwoBytes val_ref;
14818 CHECK((*env)->GetArrayLength(env, val) == 32);
14819 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14820 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14824 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14826 this_ptr_conv.is_owned = false;
14827 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14832 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14834 this_ptr_conv.is_owned = false;
14835 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14838 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) {
14839 LDKOutPoint outpoint_arg_conv;
14840 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14841 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14842 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14843 LDKPublicKey per_commitment_point_arg_ref;
14844 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14845 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14846 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14847 LDKPublicKey revocation_pubkey_arg_ref;
14848 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14849 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14850 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14851 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14852 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14853 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);
14854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14856 uint64_t ret_ref = (uint64_t)ret_var.inner;
14857 if (ret_var.is_owned) {
14863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14864 LDKDelayedPaymentOutputDescriptor orig_conv;
14865 orig_conv.inner = (void*)(orig & (~1));
14866 orig_conv.is_owned = false;
14867 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14870 uint64_t ret_ref = (uint64_t)ret_var.inner;
14871 if (ret_var.is_owned) {
14877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14878 LDKDelayedPaymentOutputDescriptor obj_conv;
14879 obj_conv.inner = (void*)(obj & (~1));
14880 obj_conv.is_owned = false;
14881 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14882 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14883 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14884 CVec_u8Z_free(ret_var);
14888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14889 LDKu8slice ser_ref;
14890 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14891 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14892 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14893 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14894 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14895 return (uint64_t)ret_conv;
14898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14899 LDKStaticPaymentOutputDescriptor this_obj_conv;
14900 this_obj_conv.inner = (void*)(this_obj & (~1));
14901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14902 StaticPaymentOutputDescriptor_free(this_obj_conv);
14905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14906 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14908 this_ptr_conv.is_owned = false;
14909 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14912 uint64_t ret_ref = (uint64_t)ret_var.inner;
14913 if (ret_var.is_owned) {
14919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14920 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14922 this_ptr_conv.is_owned = false;
14923 LDKOutPoint val_conv;
14924 val_conv.inner = (void*)(val & (~1));
14925 val_conv.is_owned = (val & 1) || (val == 0);
14926 val_conv = OutPoint_clone(&val_conv);
14927 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14931 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14933 this_ptr_conv.is_owned = false;
14934 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14935 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14939 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14941 this_ptr_conv.is_owned = false;
14942 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14943 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14948 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14950 this_ptr_conv.is_owned = false;
14951 LDKThirtyTwoBytes val_ref;
14952 CHECK((*env)->GetArrayLength(env, val) == 32);
14953 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14954 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14958 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14960 this_ptr_conv.is_owned = false;
14961 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14966 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14968 this_ptr_conv.is_owned = false;
14969 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14972 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) {
14973 LDKOutPoint outpoint_arg_conv;
14974 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14975 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14976 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14977 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14978 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14979 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14980 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14981 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14982 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14983 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14984 uint64_t ret_ref = (uint64_t)ret_var.inner;
14985 if (ret_var.is_owned) {
14991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14992 LDKStaticPaymentOutputDescriptor orig_conv;
14993 orig_conv.inner = (void*)(orig & (~1));
14994 orig_conv.is_owned = false;
14995 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14998 uint64_t ret_ref = (uint64_t)ret_var.inner;
14999 if (ret_var.is_owned) {
15005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15006 LDKStaticPaymentOutputDescriptor obj_conv;
15007 obj_conv.inner = (void*)(obj & (~1));
15008 obj_conv.is_owned = false;
15009 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15010 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15011 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15012 CVec_u8Z_free(ret_var);
15016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15017 LDKu8slice ser_ref;
15018 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15019 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15020 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15021 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15022 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15023 return (uint64_t)ret_conv;
15026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15027 if ((this_ptr & 1) != 0) return;
15028 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
15029 FREE((void*)this_ptr);
15030 SpendableOutputDescriptor_free(this_ptr_conv);
15033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15034 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15035 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15036 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15037 uint64_t ret_ref = (uint64_t)ret_copy;
15041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15042 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15043 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15044 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15045 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15046 CVec_u8Z_free(ret_var);
15050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15051 LDKu8slice ser_ref;
15052 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15053 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15054 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15055 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15056 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15057 return (uint64_t)ret_conv;
15060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15061 if ((this_ptr & 1) != 0) return;
15062 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
15063 FREE((void*)this_ptr);
15064 BaseSign_free(this_ptr_conv);
15067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15068 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
15069 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15070 *ret = Sign_clone(orig_conv);
15071 return (uint64_t)ret;
15074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15075 if ((this_ptr & 1) != 0) return;
15076 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
15077 FREE((void*)this_ptr);
15078 Sign_free(this_ptr_conv);
15081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15082 if ((this_ptr & 1) != 0) return;
15083 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
15084 FREE((void*)this_ptr);
15085 KeysInterface_free(this_ptr_conv);
15088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15089 LDKInMemorySigner this_obj_conv;
15090 this_obj_conv.inner = (void*)(this_obj & (~1));
15091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15092 InMemorySigner_free(this_obj_conv);
15095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15096 LDKInMemorySigner this_ptr_conv;
15097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15098 this_ptr_conv.is_owned = false;
15099 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15100 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
15104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15105 LDKInMemorySigner this_ptr_conv;
15106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15107 this_ptr_conv.is_owned = false;
15108 LDKSecretKey val_ref;
15109 CHECK((*env)->GetArrayLength(env, val) == 32);
15110 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15111 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15115 LDKInMemorySigner this_ptr_conv;
15116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15117 this_ptr_conv.is_owned = false;
15118 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15119 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
15123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15124 LDKInMemorySigner this_ptr_conv;
15125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15126 this_ptr_conv.is_owned = false;
15127 LDKSecretKey val_ref;
15128 CHECK((*env)->GetArrayLength(env, val) == 32);
15129 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15130 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15134 LDKInMemorySigner this_ptr_conv;
15135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15136 this_ptr_conv.is_owned = false;
15137 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15138 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
15142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15143 LDKInMemorySigner this_ptr_conv;
15144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15145 this_ptr_conv.is_owned = false;
15146 LDKSecretKey val_ref;
15147 CHECK((*env)->GetArrayLength(env, val) == 32);
15148 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15149 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15153 LDKInMemorySigner this_ptr_conv;
15154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15155 this_ptr_conv.is_owned = false;
15156 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15157 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
15161 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) {
15162 LDKInMemorySigner this_ptr_conv;
15163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15164 this_ptr_conv.is_owned = false;
15165 LDKSecretKey val_ref;
15166 CHECK((*env)->GetArrayLength(env, val) == 32);
15167 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15168 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15172 LDKInMemorySigner this_ptr_conv;
15173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15174 this_ptr_conv.is_owned = false;
15175 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
15180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15181 LDKInMemorySigner this_ptr_conv;
15182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15183 this_ptr_conv.is_owned = false;
15184 LDKSecretKey val_ref;
15185 CHECK((*env)->GetArrayLength(env, val) == 32);
15186 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15187 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
15191 LDKInMemorySigner this_ptr_conv;
15192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15193 this_ptr_conv.is_owned = false;
15194 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15195 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
15199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15200 LDKInMemorySigner this_ptr_conv;
15201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15202 this_ptr_conv.is_owned = false;
15203 LDKThirtyTwoBytes val_ref;
15204 CHECK((*env)->GetArrayLength(env, val) == 32);
15205 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15206 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15210 LDKInMemorySigner orig_conv;
15211 orig_conv.inner = (void*)(orig & (~1));
15212 orig_conv.is_owned = false;
15213 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
15214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15216 uint64_t ret_ref = (uint64_t)ret_var.inner;
15217 if (ret_var.is_owned) {
15223 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) {
15224 LDKSecretKey funding_key_ref;
15225 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15226 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
15227 LDKSecretKey revocation_base_key_ref;
15228 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
15229 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
15230 LDKSecretKey payment_key_ref;
15231 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
15232 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
15233 LDKSecretKey delayed_payment_base_key_ref;
15234 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
15235 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
15236 LDKSecretKey htlc_base_key_ref;
15237 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15238 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
15239 LDKThirtyTwoBytes commitment_seed_ref;
15240 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
15241 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
15242 LDKThirtyTwoBytes channel_keys_id_ref;
15243 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
15244 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
15245 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);
15246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15248 uint64_t ret_ref = (uint64_t)ret_var.inner;
15249 if (ret_var.is_owned) {
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15256 LDKInMemorySigner this_arg_conv;
15257 this_arg_conv.inner = (void*)(this_arg & (~1));
15258 this_arg_conv.is_owned = false;
15259 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15262 uint64_t ret_ref = (uint64_t)ret_var.inner;
15263 if (ret_var.is_owned) {
15269 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15270 LDKInMemorySigner this_arg_conv;
15271 this_arg_conv.inner = (void*)(this_arg & (~1));
15272 this_arg_conv.is_owned = false;
15273 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15277 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15278 LDKInMemorySigner this_arg_conv;
15279 this_arg_conv.inner = (void*)(this_arg & (~1));
15280 this_arg_conv.is_owned = false;
15281 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15286 LDKInMemorySigner this_arg_conv;
15287 this_arg_conv.inner = (void*)(this_arg & (~1));
15288 this_arg_conv.is_owned = false;
15289 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15294 LDKInMemorySigner this_arg_conv;
15295 this_arg_conv.inner = (void*)(this_arg & (~1));
15296 this_arg_conv.is_owned = false;
15297 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15300 uint64_t ret_ref = (uint64_t)ret_var.inner;
15301 if (ret_var.is_owned) {
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15308 LDKInMemorySigner this_arg_conv;
15309 this_arg_conv.inner = (void*)(this_arg & (~1));
15310 this_arg_conv.is_owned = false;
15311 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15314 uint64_t ret_ref = (uint64_t)ret_var.inner;
15315 if (ret_var.is_owned) {
15321 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) {
15322 LDKInMemorySigner this_arg_conv;
15323 this_arg_conv.inner = (void*)(this_arg & (~1));
15324 this_arg_conv.is_owned = false;
15325 LDKTransaction spend_tx_ref;
15326 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15327 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15328 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15329 spend_tx_ref.data_is_owned = true;
15330 LDKStaticPaymentOutputDescriptor descriptor_conv;
15331 descriptor_conv.inner = (void*)(descriptor & (~1));
15332 descriptor_conv.is_owned = false;
15333 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15334 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15335 return (uint64_t)ret_conv;
15338 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) {
15339 LDKInMemorySigner this_arg_conv;
15340 this_arg_conv.inner = (void*)(this_arg & (~1));
15341 this_arg_conv.is_owned = false;
15342 LDKTransaction spend_tx_ref;
15343 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15344 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15345 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15346 spend_tx_ref.data_is_owned = true;
15347 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15348 descriptor_conv.inner = (void*)(descriptor & (~1));
15349 descriptor_conv.is_owned = false;
15350 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15351 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15352 return (uint64_t)ret_conv;
15355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15356 LDKInMemorySigner this_arg_conv;
15357 this_arg_conv.inner = (void*)(this_arg & (~1));
15358 this_arg_conv.is_owned = false;
15359 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15360 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15361 return (uint64_t)ret;
15364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15365 LDKInMemorySigner this_arg_conv;
15366 this_arg_conv.inner = (void*)(this_arg & (~1));
15367 this_arg_conv.is_owned = false;
15368 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15369 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15370 return (uint64_t)ret;
15373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15374 LDKInMemorySigner obj_conv;
15375 obj_conv.inner = (void*)(obj & (~1));
15376 obj_conv.is_owned = false;
15377 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15378 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15379 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15380 CVec_u8Z_free(ret_var);
15384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15385 LDKu8slice ser_ref;
15386 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15387 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15388 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15389 *ret_conv = InMemorySigner_read(ser_ref);
15390 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15391 return (uint64_t)ret_conv;
15394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15395 LDKKeysManager this_obj_conv;
15396 this_obj_conv.inner = (void*)(this_obj & (~1));
15397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15398 KeysManager_free(this_obj_conv);
15401 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) {
15402 unsigned char seed_arr[32];
15403 CHECK((*env)->GetArrayLength(env, seed) == 32);
15404 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15405 unsigned char (*seed_ref)[32] = &seed_arr;
15406 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15409 uint64_t ret_ref = (uint64_t)ret_var.inner;
15410 if (ret_var.is_owned) {
15416 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) {
15417 LDKKeysManager this_arg_conv;
15418 this_arg_conv.inner = (void*)(this_arg & (~1));
15419 this_arg_conv.is_owned = false;
15420 unsigned char params_arr[32];
15421 CHECK((*env)->GetArrayLength(env, params) == 32);
15422 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15423 unsigned char (*params_ref)[32] = ¶ms_arr;
15424 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15427 uint64_t ret_ref = (uint64_t)ret_var.inner;
15428 if (ret_var.is_owned) {
15434 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) {
15435 LDKKeysManager this_arg_conv;
15436 this_arg_conv.inner = (void*)(this_arg & (~1));
15437 this_arg_conv.is_owned = false;
15438 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15439 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15440 if (descriptors_constr.datalen > 0)
15441 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15443 descriptors_constr.data = NULL;
15444 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15445 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15446 int64_t descriptors_conv_27 = descriptors_vals[b];
15447 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15448 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15449 descriptors_constr.data[b] = descriptors_conv_27_conv;
15451 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15452 LDKCVec_TxOutZ outputs_constr;
15453 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15454 if (outputs_constr.datalen > 0)
15455 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15457 outputs_constr.data = NULL;
15458 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15459 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15460 int64_t outputs_conv_7 = outputs_vals[h];
15461 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15462 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15463 outputs_constr.data[h] = outputs_conv_7_conv;
15465 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15466 LDKCVec_u8Z change_destination_script_ref;
15467 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15468 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15469 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15470 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15471 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15472 return (uint64_t)ret_conv;
15475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15476 LDKKeysManager this_arg_conv;
15477 this_arg_conv.inner = (void*)(this_arg & (~1));
15478 this_arg_conv.is_owned = false;
15479 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15480 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15481 return (uint64_t)ret;
15484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15485 LDKChannelManager this_obj_conv;
15486 this_obj_conv.inner = (void*)(this_obj & (~1));
15487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15488 ChannelManager_free(this_obj_conv);
15491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15492 LDKChainParameters this_obj_conv;
15493 this_obj_conv.inner = (void*)(this_obj & (~1));
15494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15495 ChainParameters_free(this_obj_conv);
15498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15499 LDKChainParameters this_ptr_conv;
15500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15501 this_ptr_conv.is_owned = false;
15502 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15507 LDKChainParameters this_ptr_conv;
15508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15509 this_ptr_conv.is_owned = false;
15510 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15511 ChainParameters_set_network(&this_ptr_conv, val_conv);
15514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15515 LDKChainParameters this_ptr_conv;
15516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15517 this_ptr_conv.is_owned = false;
15518 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15519 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15520 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15521 uint64_t ret_ref = (uint64_t)ret_var.inner;
15522 if (ret_var.is_owned) {
15528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15529 LDKChainParameters this_ptr_conv;
15530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15531 this_ptr_conv.is_owned = false;
15532 LDKBestBlock val_conv;
15533 val_conv.inner = (void*)(val & (~1));
15534 val_conv.is_owned = (val & 1) || (val == 0);
15535 val_conv = BestBlock_clone(&val_conv);
15536 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15540 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15541 LDKBestBlock best_block_arg_conv;
15542 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15543 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15544 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15545 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15548 uint64_t ret_ref = (uint64_t)ret_var.inner;
15549 if (ret_var.is_owned) {
15555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15556 LDKChainParameters orig_conv;
15557 orig_conv.inner = (void*)(orig & (~1));
15558 orig_conv.is_owned = false;
15559 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15562 uint64_t ret_ref = (uint64_t)ret_var.inner;
15563 if (ret_var.is_owned) {
15569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15570 LDKBestBlock this_obj_conv;
15571 this_obj_conv.inner = (void*)(this_obj & (~1));
15572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15573 BestBlock_free(this_obj_conv);
15576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15577 LDKBestBlock orig_conv;
15578 orig_conv.inner = (void*)(orig & (~1));
15579 orig_conv.is_owned = false;
15580 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15583 uint64_t ret_ref = (uint64_t)ret_var.inner;
15584 if (ret_var.is_owned) {
15590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15591 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15592 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15595 uint64_t ret_ref = (uint64_t)ret_var.inner;
15596 if (ret_var.is_owned) {
15602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15603 LDKThirtyTwoBytes block_hash_ref;
15604 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15605 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15606 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15609 uint64_t ret_ref = (uint64_t)ret_var.inner;
15610 if (ret_var.is_owned) {
15616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15617 LDKBestBlock this_arg_conv;
15618 this_arg_conv.inner = (void*)(this_arg & (~1));
15619 this_arg_conv.is_owned = false;
15620 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15625 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15626 LDKBestBlock this_arg_conv;
15627 this_arg_conv.inner = (void*)(this_arg & (~1));
15628 this_arg_conv.is_owned = false;
15629 int32_t ret_val = BestBlock_height(&this_arg_conv);
15633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15634 LDKChannelDetails this_obj_conv;
15635 this_obj_conv.inner = (void*)(this_obj & (~1));
15636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15637 ChannelDetails_free(this_obj_conv);
15640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15641 LDKChannelDetails this_ptr_conv;
15642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15643 this_ptr_conv.is_owned = false;
15644 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15645 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15650 LDKChannelDetails this_ptr_conv;
15651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15652 this_ptr_conv.is_owned = false;
15653 LDKThirtyTwoBytes val_ref;
15654 CHECK((*env)->GetArrayLength(env, val) == 32);
15655 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15656 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15660 LDKChannelDetails this_ptr_conv;
15661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15662 this_ptr_conv.is_owned = false;
15663 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15666 uint64_t ret_ref = (uint64_t)ret_var.inner;
15667 if (ret_var.is_owned) {
15673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15674 LDKChannelDetails this_ptr_conv;
15675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15676 this_ptr_conv.is_owned = false;
15677 LDKOutPoint val_conv;
15678 val_conv.inner = (void*)(val & (~1));
15679 val_conv.is_owned = (val & 1) || (val == 0);
15680 val_conv = OutPoint_clone(&val_conv);
15681 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15685 LDKChannelDetails this_ptr_conv;
15686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15687 this_ptr_conv.is_owned = false;
15688 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15689 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15690 uint64_t ret_ref = (uint64_t)ret_copy;
15694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15695 LDKChannelDetails this_ptr_conv;
15696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15697 this_ptr_conv.is_owned = false;
15698 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15699 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15703 LDKChannelDetails this_ptr_conv;
15704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15705 this_ptr_conv.is_owned = false;
15706 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15707 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15712 LDKChannelDetails this_ptr_conv;
15713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15714 this_ptr_conv.is_owned = false;
15715 LDKPublicKey val_ref;
15716 CHECK((*env)->GetArrayLength(env, val) == 33);
15717 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15718 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15722 LDKChannelDetails this_ptr_conv;
15723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15724 this_ptr_conv.is_owned = false;
15725 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15728 uint64_t ret_ref = (uint64_t)ret_var.inner;
15729 if (ret_var.is_owned) {
15735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15736 LDKChannelDetails this_ptr_conv;
15737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15738 this_ptr_conv.is_owned = false;
15739 LDKInitFeatures val_conv;
15740 val_conv.inner = (void*)(val & (~1));
15741 val_conv.is_owned = (val & 1) || (val == 0);
15742 val_conv = InitFeatures_clone(&val_conv);
15743 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15747 LDKChannelDetails this_ptr_conv;
15748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15749 this_ptr_conv.is_owned = false;
15750 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15755 LDKChannelDetails this_ptr_conv;
15756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15757 this_ptr_conv.is_owned = false;
15758 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15762 LDKChannelDetails this_ptr_conv;
15763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15764 this_ptr_conv.is_owned = false;
15765 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15770 LDKChannelDetails this_ptr_conv;
15771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15772 this_ptr_conv.is_owned = false;
15773 ChannelDetails_set_user_id(&this_ptr_conv, val);
15776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15777 LDKChannelDetails this_ptr_conv;
15778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15779 this_ptr_conv.is_owned = false;
15780 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15785 LDKChannelDetails this_ptr_conv;
15786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15787 this_ptr_conv.is_owned = false;
15788 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15792 LDKChannelDetails this_ptr_conv;
15793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15794 this_ptr_conv.is_owned = false;
15795 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15800 LDKChannelDetails this_ptr_conv;
15801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15802 this_ptr_conv.is_owned = false;
15803 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15807 LDKChannelDetails this_ptr_conv;
15808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15809 this_ptr_conv.is_owned = false;
15810 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15815 LDKChannelDetails this_ptr_conv;
15816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15817 this_ptr_conv.is_owned = false;
15818 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15822 LDKChannelDetails this_ptr_conv;
15823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15824 this_ptr_conv.is_owned = false;
15825 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15830 LDKChannelDetails this_ptr_conv;
15831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15832 this_ptr_conv.is_owned = false;
15833 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15837 LDKChannelDetails this_ptr_conv;
15838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15839 this_ptr_conv.is_owned = false;
15840 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15845 LDKChannelDetails this_ptr_conv;
15846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15847 this_ptr_conv.is_owned = false;
15848 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15852 LDKChannelDetails this_ptr_conv;
15853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15854 this_ptr_conv.is_owned = false;
15855 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15860 LDKChannelDetails this_ptr_conv;
15861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15862 this_ptr_conv.is_owned = false;
15863 ChannelDetails_set_is_public(&this_ptr_conv, val);
15866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15867 LDKChannelDetails orig_conv;
15868 orig_conv.inner = (void*)(orig & (~1));
15869 orig_conv.is_owned = false;
15870 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15873 uint64_t ret_ref = (uint64_t)ret_var.inner;
15874 if (ret_var.is_owned) {
15880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15881 if ((this_ptr & 1) != 0) return;
15882 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15883 FREE((void*)this_ptr);
15884 PaymentSendFailure_free(this_ptr_conv);
15887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15888 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15889 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15890 *ret_copy = PaymentSendFailure_clone(orig_conv);
15891 uint64_t ret_ref = (uint64_t)ret_copy;
15895 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) {
15896 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15897 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15898 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15899 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15901 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15902 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15904 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15906 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15907 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15909 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15911 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15912 if (logger_conv.free == LDKLogger_JCalls_free) {
15913 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15914 LDKLogger_JCalls_clone(logger_conv.this_arg);
15916 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15917 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15918 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15919 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15921 LDKUserConfig config_conv;
15922 config_conv.inner = (void*)(config & (~1));
15923 config_conv.is_owned = (config & 1) || (config == 0);
15924 config_conv = UserConfig_clone(&config_conv);
15925 LDKChainParameters params_conv;
15926 params_conv.inner = (void*)(params & (~1));
15927 params_conv.is_owned = (params & 1) || (params == 0);
15928 params_conv = ChainParameters_clone(¶ms_conv);
15929 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15932 uint64_t ret_ref = (uint64_t)ret_var.inner;
15933 if (ret_var.is_owned) {
15939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15940 LDKChannelManager this_arg_conv;
15941 this_arg_conv.inner = (void*)(this_arg & (~1));
15942 this_arg_conv.is_owned = false;
15943 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15946 uint64_t ret_ref = (uint64_t)ret_var.inner;
15947 if (ret_var.is_owned) {
15953 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_id, int64_t override_config) {
15954 LDKChannelManager this_arg_conv;
15955 this_arg_conv.inner = (void*)(this_arg & (~1));
15956 this_arg_conv.is_owned = false;
15957 LDKPublicKey their_network_key_ref;
15958 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15959 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15960 LDKUserConfig override_config_conv;
15961 override_config_conv.inner = (void*)(override_config & (~1));
15962 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15963 override_config_conv = UserConfig_clone(&override_config_conv);
15964 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15965 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15966 return (uint64_t)ret_conv;
15969 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15970 LDKChannelManager this_arg_conv;
15971 this_arg_conv.inner = (void*)(this_arg & (~1));
15972 this_arg_conv.is_owned = false;
15973 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15974 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15975 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15976 for (size_t q = 0; q < ret_var.datalen; q++) {
15977 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15978 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15979 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15980 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15981 if (ret_conv_16_var.is_owned) {
15982 ret_conv_16_ref |= 1;
15984 ret_arr_ptr[q] = ret_conv_16_ref;
15986 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15987 FREE(ret_var.data);
15991 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15992 LDKChannelManager this_arg_conv;
15993 this_arg_conv.inner = (void*)(this_arg & (~1));
15994 this_arg_conv.is_owned = false;
15995 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15996 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15997 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15998 for (size_t q = 0; q < ret_var.datalen; q++) {
15999 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16000 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16001 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16002 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16003 if (ret_conv_16_var.is_owned) {
16004 ret_conv_16_ref |= 1;
16006 ret_arr_ptr[q] = ret_conv_16_ref;
16008 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16009 FREE(ret_var.data);
16013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
16014 LDKChannelManager this_arg_conv;
16015 this_arg_conv.inner = (void*)(this_arg & (~1));
16016 this_arg_conv.is_owned = false;
16017 unsigned char channel_id_arr[32];
16018 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16019 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16020 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16021 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16022 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16023 return (uint64_t)ret_conv;
16026 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) {
16027 LDKChannelManager this_arg_conv;
16028 this_arg_conv.inner = (void*)(this_arg & (~1));
16029 this_arg_conv.is_owned = false;
16030 unsigned char channel_id_arr[32];
16031 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16032 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16033 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16034 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16035 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
16036 return (uint64_t)ret_conv;
16039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
16040 LDKChannelManager this_arg_conv;
16041 this_arg_conv.inner = (void*)(this_arg & (~1));
16042 this_arg_conv.is_owned = false;
16043 ChannelManager_force_close_all_channels(&this_arg_conv);
16046 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) {
16047 LDKChannelManager this_arg_conv;
16048 this_arg_conv.inner = (void*)(this_arg & (~1));
16049 this_arg_conv.is_owned = false;
16050 LDKRoute route_conv;
16051 route_conv.inner = (void*)(route & (~1));
16052 route_conv.is_owned = false;
16053 LDKThirtyTwoBytes payment_hash_ref;
16054 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16055 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16056 LDKThirtyTwoBytes payment_secret_ref;
16057 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
16058 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
16059 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16060 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
16061 return (uint64_t)ret_conv;
16064 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) {
16065 LDKChannelManager this_arg_conv;
16066 this_arg_conv.inner = (void*)(this_arg & (~1));
16067 this_arg_conv.is_owned = false;
16068 unsigned char temporary_channel_id_arr[32];
16069 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
16070 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
16071 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
16072 LDKTransaction funding_transaction_ref;
16073 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
16074 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
16075 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
16076 funding_transaction_ref.data_is_owned = true;
16077 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16078 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
16079 return (uint64_t)ret_conv;
16082 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) {
16083 LDKChannelManager this_arg_conv;
16084 this_arg_conv.inner = (void*)(this_arg & (~1));
16085 this_arg_conv.is_owned = false;
16086 LDKThreeBytes rgb_ref;
16087 CHECK((*env)->GetArrayLength(env, rgb) == 3);
16088 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
16089 LDKThirtyTwoBytes alias_ref;
16090 CHECK((*env)->GetArrayLength(env, alias) == 32);
16091 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
16092 LDKCVec_NetAddressZ addresses_constr;
16093 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
16094 if (addresses_constr.datalen > 0)
16095 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16097 addresses_constr.data = NULL;
16098 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
16099 for (size_t m = 0; m < addresses_constr.datalen; m++) {
16100 int64_t addresses_conv_12 = addresses_vals[m];
16101 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
16102 addresses_constr.data[m] = addresses_conv_12_conv;
16104 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
16105 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
16108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
16109 LDKChannelManager this_arg_conv;
16110 this_arg_conv.inner = (void*)(this_arg & (~1));
16111 this_arg_conv.is_owned = false;
16112 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
16115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
16116 LDKChannelManager this_arg_conv;
16117 this_arg_conv.inner = (void*)(this_arg & (~1));
16118 this_arg_conv.is_owned = false;
16119 ChannelManager_timer_tick_occurred(&this_arg_conv);
16122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
16123 LDKChannelManager this_arg_conv;
16124 this_arg_conv.inner = (void*)(this_arg & (~1));
16125 this_arg_conv.is_owned = false;
16126 unsigned char payment_hash_arr[32];
16127 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16128 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
16129 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
16130 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
16134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
16135 LDKChannelManager this_arg_conv;
16136 this_arg_conv.inner = (void*)(this_arg & (~1));
16137 this_arg_conv.is_owned = false;
16138 LDKThirtyTwoBytes payment_preimage_ref;
16139 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
16140 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
16141 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
16145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16146 LDKChannelManager this_arg_conv;
16147 this_arg_conv.inner = (void*)(this_arg & (~1));
16148 this_arg_conv.is_owned = false;
16149 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
16154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
16155 LDKChannelManager this_arg_conv;
16156 this_arg_conv.inner = (void*)(this_arg & (~1));
16157 this_arg_conv.is_owned = false;
16158 LDKOutPoint funding_txo_conv;
16159 funding_txo_conv.inner = (void*)(funding_txo & (~1));
16160 funding_txo_conv.is_owned = false;
16161 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
16164 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) {
16165 LDKChannelManager this_arg_conv;
16166 this_arg_conv.inner = (void*)(this_arg & (~1));
16167 this_arg_conv.is_owned = false;
16168 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16169 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16170 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
16171 return (uint64_t)ret_ref;
16174 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) {
16175 LDKChannelManager this_arg_conv;
16176 this_arg_conv.inner = (void*)(this_arg & (~1));
16177 this_arg_conv.is_owned = false;
16178 LDKThirtyTwoBytes payment_hash_ref;
16179 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16180 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16181 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16182 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16183 *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);
16184 return (uint64_t)ret_conv;
16187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16188 LDKChannelManager this_arg_conv;
16189 this_arg_conv.inner = (void*)(this_arg & (~1));
16190 this_arg_conv.is_owned = false;
16191 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16192 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
16193 return (uint64_t)ret;
16196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16197 LDKChannelManager this_arg_conv;
16198 this_arg_conv.inner = (void*)(this_arg & (~1));
16199 this_arg_conv.is_owned = false;
16200 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16201 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
16202 return (uint64_t)ret;
16205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16206 LDKChannelManager this_arg_conv;
16207 this_arg_conv.inner = (void*)(this_arg & (~1));
16208 this_arg_conv.is_owned = false;
16209 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
16210 *ret = ChannelManager_as_Listen(&this_arg_conv);
16211 return (uint64_t)ret;
16214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16215 LDKChannelManager this_arg_conv;
16216 this_arg_conv.inner = (void*)(this_arg & (~1));
16217 this_arg_conv.is_owned = false;
16218 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16219 *ret = ChannelManager_as_Confirm(&this_arg_conv);
16220 return (uint64_t)ret;
16223 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) {
16224 LDKChannelManager this_arg_conv;
16225 this_arg_conv.inner = (void*)(this_arg & (~1));
16226 this_arg_conv.is_owned = false;
16227 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
16231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
16232 LDKChannelManager this_arg_conv;
16233 this_arg_conv.inner = (void*)(this_arg & (~1));
16234 this_arg_conv.is_owned = false;
16235 ChannelManager_await_persistable_update(&this_arg_conv);
16238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16239 LDKChannelManager this_arg_conv;
16240 this_arg_conv.inner = (void*)(this_arg & (~1));
16241 this_arg_conv.is_owned = false;
16242 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16243 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
16244 return (uint64_t)ret;
16247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
16248 LDKChannelManager obj_conv;
16249 obj_conv.inner = (void*)(obj & (~1));
16250 obj_conv.is_owned = false;
16251 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
16252 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16253 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16254 CVec_u8Z_free(ret_var);
16258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16259 LDKChannelManagerReadArgs this_obj_conv;
16260 this_obj_conv.inner = (void*)(this_obj & (~1));
16261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16262 ChannelManagerReadArgs_free(this_obj_conv);
16265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
16266 LDKChannelManagerReadArgs this_ptr_conv;
16267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16268 this_ptr_conv.is_owned = false;
16269 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
16273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16274 LDKChannelManagerReadArgs this_ptr_conv;
16275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16276 this_ptr_conv.is_owned = false;
16277 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
16278 if (val_conv.free == LDKKeysInterface_JCalls_free) {
16279 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16280 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
16282 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
16285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
16286 LDKChannelManagerReadArgs this_ptr_conv;
16287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16288 this_ptr_conv.is_owned = false;
16289 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
16293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16294 LDKChannelManagerReadArgs this_ptr_conv;
16295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16296 this_ptr_conv.is_owned = false;
16297 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16298 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
16299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16300 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
16302 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16306 LDKChannelManagerReadArgs this_ptr_conv;
16307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16308 this_ptr_conv.is_owned = false;
16309 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16314 LDKChannelManagerReadArgs this_ptr_conv;
16315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16316 this_ptr_conv.is_owned = false;
16317 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16318 if (val_conv.free == LDKWatch_JCalls_free) {
16319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16320 LDKWatch_JCalls_clone(val_conv.this_arg);
16322 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16326 LDKChannelManagerReadArgs this_ptr_conv;
16327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16328 this_ptr_conv.is_owned = false;
16329 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16334 LDKChannelManagerReadArgs this_ptr_conv;
16335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16336 this_ptr_conv.is_owned = false;
16337 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16338 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16339 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16340 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16342 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16346 LDKChannelManagerReadArgs this_ptr_conv;
16347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16348 this_ptr_conv.is_owned = false;
16349 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16354 LDKChannelManagerReadArgs this_ptr_conv;
16355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16356 this_ptr_conv.is_owned = false;
16357 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16358 if (val_conv.free == LDKLogger_JCalls_free) {
16359 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16360 LDKLogger_JCalls_clone(val_conv.this_arg);
16362 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16366 LDKChannelManagerReadArgs this_ptr_conv;
16367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16368 this_ptr_conv.is_owned = false;
16369 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16372 uint64_t ret_ref = (uint64_t)ret_var.inner;
16373 if (ret_var.is_owned) {
16379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16380 LDKChannelManagerReadArgs this_ptr_conv;
16381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16382 this_ptr_conv.is_owned = false;
16383 LDKUserConfig val_conv;
16384 val_conv.inner = (void*)(val & (~1));
16385 val_conv.is_owned = (val & 1) || (val == 0);
16386 val_conv = UserConfig_clone(&val_conv);
16387 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16390 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) {
16391 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16392 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16393 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16394 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16396 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16397 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16398 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16399 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16401 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16402 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16403 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16404 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16406 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16407 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16408 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16409 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16411 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16412 if (logger_conv.free == LDKLogger_JCalls_free) {
16413 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16414 LDKLogger_JCalls_clone(logger_conv.this_arg);
16416 LDKUserConfig default_config_conv;
16417 default_config_conv.inner = (void*)(default_config & (~1));
16418 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16419 default_config_conv = UserConfig_clone(&default_config_conv);
16420 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16421 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16422 if (channel_monitors_constr.datalen > 0)
16423 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16425 channel_monitors_constr.data = NULL;
16426 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16427 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16428 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16429 LDKChannelMonitor channel_monitors_conv_16_conv;
16430 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16431 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16432 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16434 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16435 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);
16436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16438 uint64_t ret_ref = (uint64_t)ret_var.inner;
16439 if (ret_var.is_owned) {
16445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16446 LDKu8slice ser_ref;
16447 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16448 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16449 LDKChannelManagerReadArgs arg_conv;
16450 arg_conv.inner = (void*)(arg & (~1));
16451 arg_conv.is_owned = (arg & 1) || (arg == 0);
16452 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16453 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16454 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16456 return (uint64_t)ret_conv;
16459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16460 LDKDecodeError this_obj_conv;
16461 this_obj_conv.inner = (void*)(this_obj & (~1));
16462 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16463 DecodeError_free(this_obj_conv);
16466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16467 LDKDecodeError orig_conv;
16468 orig_conv.inner = (void*)(orig & (~1));
16469 orig_conv.is_owned = false;
16470 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16473 uint64_t ret_ref = (uint64_t)ret_var.inner;
16474 if (ret_var.is_owned) {
16480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16481 LDKInit this_obj_conv;
16482 this_obj_conv.inner = (void*)(this_obj & (~1));
16483 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16484 Init_free(this_obj_conv);
16487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16488 LDKInit this_ptr_conv;
16489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16490 this_ptr_conv.is_owned = false;
16491 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16494 uint64_t ret_ref = (uint64_t)ret_var.inner;
16495 if (ret_var.is_owned) {
16501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16502 LDKInit this_ptr_conv;
16503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16504 this_ptr_conv.is_owned = false;
16505 LDKInitFeatures val_conv;
16506 val_conv.inner = (void*)(val & (~1));
16507 val_conv.is_owned = (val & 1) || (val == 0);
16508 val_conv = InitFeatures_clone(&val_conv);
16509 Init_set_features(&this_ptr_conv, val_conv);
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16513 LDKInitFeatures features_arg_conv;
16514 features_arg_conv.inner = (void*)(features_arg & (~1));
16515 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16516 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16517 LDKInit ret_var = Init_new(features_arg_conv);
16518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16520 uint64_t ret_ref = (uint64_t)ret_var.inner;
16521 if (ret_var.is_owned) {
16527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16529 orig_conv.inner = (void*)(orig & (~1));
16530 orig_conv.is_owned = false;
16531 LDKInit ret_var = Init_clone(&orig_conv);
16532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16534 uint64_t ret_ref = (uint64_t)ret_var.inner;
16535 if (ret_var.is_owned) {
16541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16542 LDKErrorMessage this_obj_conv;
16543 this_obj_conv.inner = (void*)(this_obj & (~1));
16544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16545 ErrorMessage_free(this_obj_conv);
16548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16549 LDKErrorMessage this_ptr_conv;
16550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16551 this_ptr_conv.is_owned = false;
16552 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16553 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16558 LDKErrorMessage this_ptr_conv;
16559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16560 this_ptr_conv.is_owned = false;
16561 LDKThirtyTwoBytes val_ref;
16562 CHECK((*env)->GetArrayLength(env, val) == 32);
16563 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16564 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16567 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16568 LDKErrorMessage this_ptr_conv;
16569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16570 this_ptr_conv.is_owned = false;
16571 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16572 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16577 LDKErrorMessage this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 LDKStr val_conv = java_to_owned_str(env, val);
16581 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16585 LDKThirtyTwoBytes channel_id_arg_ref;
16586 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16587 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16588 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16589 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16592 uint64_t ret_ref = (uint64_t)ret_var.inner;
16593 if (ret_var.is_owned) {
16599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16600 LDKErrorMessage orig_conv;
16601 orig_conv.inner = (void*)(orig & (~1));
16602 orig_conv.is_owned = false;
16603 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16606 uint64_t ret_ref = (uint64_t)ret_var.inner;
16607 if (ret_var.is_owned) {
16613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16614 LDKPing this_obj_conv;
16615 this_obj_conv.inner = (void*)(this_obj & (~1));
16616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16617 Ping_free(this_obj_conv);
16620 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16621 LDKPing this_ptr_conv;
16622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16623 this_ptr_conv.is_owned = false;
16624 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16629 LDKPing this_ptr_conv;
16630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16631 this_ptr_conv.is_owned = false;
16632 Ping_set_ponglen(&this_ptr_conv, val);
16635 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16636 LDKPing this_ptr_conv;
16637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16638 this_ptr_conv.is_owned = false;
16639 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16644 LDKPing this_ptr_conv;
16645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16646 this_ptr_conv.is_owned = false;
16647 Ping_set_byteslen(&this_ptr_conv, val);
16650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16651 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16654 uint64_t ret_ref = (uint64_t)ret_var.inner;
16655 if (ret_var.is_owned) {
16661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16663 orig_conv.inner = (void*)(orig & (~1));
16664 orig_conv.is_owned = false;
16665 LDKPing ret_var = Ping_clone(&orig_conv);
16666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16668 uint64_t ret_ref = (uint64_t)ret_var.inner;
16669 if (ret_var.is_owned) {
16675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16676 LDKPong this_obj_conv;
16677 this_obj_conv.inner = (void*)(this_obj & (~1));
16678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16679 Pong_free(this_obj_conv);
16682 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16683 LDKPong this_ptr_conv;
16684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16685 this_ptr_conv.is_owned = false;
16686 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16691 LDKPong this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 Pong_set_byteslen(&this_ptr_conv, val);
16697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16698 LDKPong ret_var = Pong_new(byteslen_arg);
16699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16701 uint64_t ret_ref = (uint64_t)ret_var.inner;
16702 if (ret_var.is_owned) {
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16710 orig_conv.inner = (void*)(orig & (~1));
16711 orig_conv.is_owned = false;
16712 LDKPong ret_var = Pong_clone(&orig_conv);
16713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16715 uint64_t ret_ref = (uint64_t)ret_var.inner;
16716 if (ret_var.is_owned) {
16722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16723 LDKOpenChannel this_obj_conv;
16724 this_obj_conv.inner = (void*)(this_obj & (~1));
16725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16726 OpenChannel_free(this_obj_conv);
16729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16730 LDKOpenChannel this_ptr_conv;
16731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16732 this_ptr_conv.is_owned = false;
16733 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16739 LDKOpenChannel this_ptr_conv;
16740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16741 this_ptr_conv.is_owned = false;
16742 LDKThirtyTwoBytes val_ref;
16743 CHECK((*env)->GetArrayLength(env, val) == 32);
16744 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16745 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16749 LDKOpenChannel this_ptr_conv;
16750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16751 this_ptr_conv.is_owned = false;
16752 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16758 LDKOpenChannel this_ptr_conv;
16759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16760 this_ptr_conv.is_owned = false;
16761 LDKThirtyTwoBytes val_ref;
16762 CHECK((*env)->GetArrayLength(env, val) == 32);
16763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16764 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16768 LDKOpenChannel this_ptr_conv;
16769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16770 this_ptr_conv.is_owned = false;
16771 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16776 LDKOpenChannel this_ptr_conv;
16777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16778 this_ptr_conv.is_owned = false;
16779 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16783 LDKOpenChannel this_ptr_conv;
16784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16785 this_ptr_conv.is_owned = false;
16786 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16791 LDKOpenChannel this_ptr_conv;
16792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16793 this_ptr_conv.is_owned = false;
16794 OpenChannel_set_push_msat(&this_ptr_conv, val);
16797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16798 LDKOpenChannel this_ptr_conv;
16799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16800 this_ptr_conv.is_owned = false;
16801 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16806 LDKOpenChannel this_ptr_conv;
16807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16808 this_ptr_conv.is_owned = false;
16809 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16812 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) {
16813 LDKOpenChannel this_ptr_conv;
16814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16815 this_ptr_conv.is_owned = false;
16816 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16820 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) {
16821 LDKOpenChannel this_ptr_conv;
16822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16823 this_ptr_conv.is_owned = false;
16824 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16828 LDKOpenChannel this_ptr_conv;
16829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16830 this_ptr_conv.is_owned = false;
16831 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16836 LDKOpenChannel this_ptr_conv;
16837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16838 this_ptr_conv.is_owned = false;
16839 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16843 LDKOpenChannel this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = false;
16846 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16851 LDKOpenChannel this_ptr_conv;
16852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16853 this_ptr_conv.is_owned = false;
16854 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16857 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16858 LDKOpenChannel this_ptr_conv;
16859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16860 this_ptr_conv.is_owned = false;
16861 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16866 LDKOpenChannel this_ptr_conv;
16867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16868 this_ptr_conv.is_owned = false;
16869 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16872 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16873 LDKOpenChannel this_ptr_conv;
16874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16875 this_ptr_conv.is_owned = false;
16876 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16881 LDKOpenChannel this_ptr_conv;
16882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16883 this_ptr_conv.is_owned = false;
16884 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16887 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16888 LDKOpenChannel this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16896 LDKOpenChannel this_ptr_conv;
16897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16898 this_ptr_conv.is_owned = false;
16899 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16903 LDKOpenChannel this_ptr_conv;
16904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16905 this_ptr_conv.is_owned = false;
16906 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16907 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16912 LDKOpenChannel this_ptr_conv;
16913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16914 this_ptr_conv.is_owned = false;
16915 LDKPublicKey val_ref;
16916 CHECK((*env)->GetArrayLength(env, val) == 33);
16917 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16918 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16922 LDKOpenChannel this_ptr_conv;
16923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16924 this_ptr_conv.is_owned = false;
16925 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16926 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16931 LDKOpenChannel this_ptr_conv;
16932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16933 this_ptr_conv.is_owned = false;
16934 LDKPublicKey val_ref;
16935 CHECK((*env)->GetArrayLength(env, val) == 33);
16936 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16937 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16941 LDKOpenChannel this_ptr_conv;
16942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16943 this_ptr_conv.is_owned = false;
16944 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16945 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16950 LDKOpenChannel this_ptr_conv;
16951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16952 this_ptr_conv.is_owned = false;
16953 LDKPublicKey val_ref;
16954 CHECK((*env)->GetArrayLength(env, val) == 33);
16955 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16956 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16960 LDKOpenChannel this_ptr_conv;
16961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16962 this_ptr_conv.is_owned = false;
16963 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16964 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16969 LDKOpenChannel this_ptr_conv;
16970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16971 this_ptr_conv.is_owned = false;
16972 LDKPublicKey val_ref;
16973 CHECK((*env)->GetArrayLength(env, val) == 33);
16974 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16975 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16979 LDKOpenChannel this_ptr_conv;
16980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16981 this_ptr_conv.is_owned = false;
16982 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16988 LDKOpenChannel this_ptr_conv;
16989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16990 this_ptr_conv.is_owned = false;
16991 LDKPublicKey val_ref;
16992 CHECK((*env)->GetArrayLength(env, val) == 33);
16993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16994 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16998 LDKOpenChannel this_ptr_conv;
16999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17000 this_ptr_conv.is_owned = false;
17001 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17006 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) {
17007 LDKOpenChannel this_ptr_conv;
17008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17009 this_ptr_conv.is_owned = false;
17010 LDKPublicKey val_ref;
17011 CHECK((*env)->GetArrayLength(env, val) == 33);
17012 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17013 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17016 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
17017 LDKOpenChannel this_ptr_conv;
17018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17019 this_ptr_conv.is_owned = false;
17020 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
17024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
17025 LDKOpenChannel this_ptr_conv;
17026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17027 this_ptr_conv.is_owned = false;
17028 OpenChannel_set_channel_flags(&this_ptr_conv, val);
17031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17032 LDKOpenChannel orig_conv;
17033 orig_conv.inner = (void*)(orig & (~1));
17034 orig_conv.is_owned = false;
17035 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
17036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17038 uint64_t ret_ref = (uint64_t)ret_var.inner;
17039 if (ret_var.is_owned) {
17045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17046 LDKAcceptChannel this_obj_conv;
17047 this_obj_conv.inner = (void*)(this_obj & (~1));
17048 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17049 AcceptChannel_free(this_obj_conv);
17052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17053 LDKAcceptChannel this_ptr_conv;
17054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17055 this_ptr_conv.is_owned = false;
17056 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17057 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
17061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17062 LDKAcceptChannel this_ptr_conv;
17063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17064 this_ptr_conv.is_owned = false;
17065 LDKThirtyTwoBytes val_ref;
17066 CHECK((*env)->GetArrayLength(env, val) == 32);
17067 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17068 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17072 LDKAcceptChannel this_ptr_conv;
17073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17074 this_ptr_conv.is_owned = false;
17075 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
17079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17080 LDKAcceptChannel this_ptr_conv;
17081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17082 this_ptr_conv.is_owned = false;
17083 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17086 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) {
17087 LDKAcceptChannel this_ptr_conv;
17088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17089 this_ptr_conv.is_owned = false;
17090 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17094 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) {
17095 LDKAcceptChannel this_ptr_conv;
17096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17097 this_ptr_conv.is_owned = false;
17098 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17102 LDKAcceptChannel this_ptr_conv;
17103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17104 this_ptr_conv.is_owned = false;
17105 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17110 LDKAcceptChannel this_ptr_conv;
17111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17112 this_ptr_conv.is_owned = false;
17113 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17117 LDKAcceptChannel this_ptr_conv;
17118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17119 this_ptr_conv.is_owned = false;
17120 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
17124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17125 LDKAcceptChannel this_ptr_conv;
17126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17127 this_ptr_conv.is_owned = false;
17128 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17131 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
17132 LDKAcceptChannel this_ptr_conv;
17133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17134 this_ptr_conv.is_owned = false;
17135 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
17139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17140 LDKAcceptChannel this_ptr_conv;
17141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17142 this_ptr_conv.is_owned = false;
17143 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
17146 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17147 LDKAcceptChannel this_ptr_conv;
17148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17149 this_ptr_conv.is_owned = false;
17150 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
17154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17155 LDKAcceptChannel this_ptr_conv;
17156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17157 this_ptr_conv.is_owned = false;
17158 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
17161 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
17162 LDKAcceptChannel this_ptr_conv;
17163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17164 this_ptr_conv.is_owned = false;
17165 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
17169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17170 LDKAcceptChannel this_ptr_conv;
17171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17172 this_ptr_conv.is_owned = false;
17173 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17177 LDKAcceptChannel this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17181 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
17185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17186 LDKAcceptChannel this_ptr_conv;
17187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17188 this_ptr_conv.is_owned = false;
17189 LDKPublicKey val_ref;
17190 CHECK((*env)->GetArrayLength(env, val) == 33);
17191 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17192 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17196 LDKAcceptChannel this_ptr_conv;
17197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17198 this_ptr_conv.is_owned = false;
17199 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17205 LDKAcceptChannel this_ptr_conv;
17206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17207 this_ptr_conv.is_owned = false;
17208 LDKPublicKey val_ref;
17209 CHECK((*env)->GetArrayLength(env, val) == 33);
17210 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17211 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17215 LDKAcceptChannel this_ptr_conv;
17216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17217 this_ptr_conv.is_owned = false;
17218 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17219 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
17223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17224 LDKAcceptChannel this_ptr_conv;
17225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17226 this_ptr_conv.is_owned = false;
17227 LDKPublicKey val_ref;
17228 CHECK((*env)->GetArrayLength(env, val) == 33);
17229 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17230 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
17233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17234 LDKAcceptChannel this_ptr_conv;
17235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17236 this_ptr_conv.is_owned = false;
17237 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17238 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17243 LDKAcceptChannel this_ptr_conv;
17244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17245 this_ptr_conv.is_owned = false;
17246 LDKPublicKey val_ref;
17247 CHECK((*env)->GetArrayLength(env, val) == 33);
17248 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17249 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17253 LDKAcceptChannel this_ptr_conv;
17254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17255 this_ptr_conv.is_owned = false;
17256 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17257 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17262 LDKAcceptChannel this_ptr_conv;
17263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17264 this_ptr_conv.is_owned = false;
17265 LDKPublicKey val_ref;
17266 CHECK((*env)->GetArrayLength(env, val) == 33);
17267 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17268 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17272 LDKAcceptChannel this_ptr_conv;
17273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17274 this_ptr_conv.is_owned = false;
17275 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17276 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17280 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) {
17281 LDKAcceptChannel this_ptr_conv;
17282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17283 this_ptr_conv.is_owned = false;
17284 LDKPublicKey val_ref;
17285 CHECK((*env)->GetArrayLength(env, val) == 33);
17286 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17287 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17291 LDKAcceptChannel orig_conv;
17292 orig_conv.inner = (void*)(orig & (~1));
17293 orig_conv.is_owned = false;
17294 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
17295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17297 uint64_t ret_ref = (uint64_t)ret_var.inner;
17298 if (ret_var.is_owned) {
17304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17305 LDKFundingCreated this_obj_conv;
17306 this_obj_conv.inner = (void*)(this_obj & (~1));
17307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17308 FundingCreated_free(this_obj_conv);
17311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17312 LDKFundingCreated this_ptr_conv;
17313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17314 this_ptr_conv.is_owned = false;
17315 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17316 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17321 LDKFundingCreated this_ptr_conv;
17322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17323 this_ptr_conv.is_owned = false;
17324 LDKThirtyTwoBytes val_ref;
17325 CHECK((*env)->GetArrayLength(env, val) == 32);
17326 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17327 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17331 LDKFundingCreated this_ptr_conv;
17332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17333 this_ptr_conv.is_owned = false;
17334 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17335 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17340 LDKFundingCreated this_ptr_conv;
17341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17342 this_ptr_conv.is_owned = false;
17343 LDKThirtyTwoBytes val_ref;
17344 CHECK((*env)->GetArrayLength(env, val) == 32);
17345 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17346 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17349 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17350 LDKFundingCreated this_ptr_conv;
17351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17352 this_ptr_conv.is_owned = false;
17353 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17358 LDKFundingCreated this_ptr_conv;
17359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17360 this_ptr_conv.is_owned = false;
17361 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17365 LDKFundingCreated this_ptr_conv;
17366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17367 this_ptr_conv.is_owned = false;
17368 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17369 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17374 LDKFundingCreated this_ptr_conv;
17375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17376 this_ptr_conv.is_owned = false;
17377 LDKSignature val_ref;
17378 CHECK((*env)->GetArrayLength(env, val) == 64);
17379 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17380 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17383 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) {
17384 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17385 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17386 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17387 LDKThirtyTwoBytes funding_txid_arg_ref;
17388 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17389 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17390 LDKSignature signature_arg_ref;
17391 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17392 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17393 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17396 uint64_t ret_ref = (uint64_t)ret_var.inner;
17397 if (ret_var.is_owned) {
17403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17404 LDKFundingCreated orig_conv;
17405 orig_conv.inner = (void*)(orig & (~1));
17406 orig_conv.is_owned = false;
17407 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17410 uint64_t ret_ref = (uint64_t)ret_var.inner;
17411 if (ret_var.is_owned) {
17417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17418 LDKFundingSigned this_obj_conv;
17419 this_obj_conv.inner = (void*)(this_obj & (~1));
17420 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17421 FundingSigned_free(this_obj_conv);
17424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17425 LDKFundingSigned this_ptr_conv;
17426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17427 this_ptr_conv.is_owned = false;
17428 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17429 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17434 LDKFundingSigned this_ptr_conv;
17435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17436 this_ptr_conv.is_owned = false;
17437 LDKThirtyTwoBytes val_ref;
17438 CHECK((*env)->GetArrayLength(env, val) == 32);
17439 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17440 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17444 LDKFundingSigned this_ptr_conv;
17445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17446 this_ptr_conv.is_owned = false;
17447 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17453 LDKFundingSigned this_ptr_conv;
17454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17455 this_ptr_conv.is_owned = false;
17456 LDKSignature val_ref;
17457 CHECK((*env)->GetArrayLength(env, val) == 64);
17458 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17459 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17463 LDKThirtyTwoBytes channel_id_arg_ref;
17464 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17465 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17466 LDKSignature signature_arg_ref;
17467 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17468 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17469 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17472 uint64_t ret_ref = (uint64_t)ret_var.inner;
17473 if (ret_var.is_owned) {
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17480 LDKFundingSigned orig_conv;
17481 orig_conv.inner = (void*)(orig & (~1));
17482 orig_conv.is_owned = false;
17483 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17486 uint64_t ret_ref = (uint64_t)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17494 LDKFundingLocked this_obj_conv;
17495 this_obj_conv.inner = (void*)(this_obj & (~1));
17496 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17497 FundingLocked_free(this_obj_conv);
17500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17501 LDKFundingLocked this_ptr_conv;
17502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17503 this_ptr_conv.is_owned = false;
17504 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17510 LDKFundingLocked this_ptr_conv;
17511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17512 this_ptr_conv.is_owned = false;
17513 LDKThirtyTwoBytes val_ref;
17514 CHECK((*env)->GetArrayLength(env, val) == 32);
17515 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17516 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17520 LDKFundingLocked this_ptr_conv;
17521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17522 this_ptr_conv.is_owned = false;
17523 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17524 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17528 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) {
17529 LDKFundingLocked this_ptr_conv;
17530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17531 this_ptr_conv.is_owned = false;
17532 LDKPublicKey val_ref;
17533 CHECK((*env)->GetArrayLength(env, val) == 33);
17534 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17535 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17538 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) {
17539 LDKThirtyTwoBytes channel_id_arg_ref;
17540 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17541 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17542 LDKPublicKey next_per_commitment_point_arg_ref;
17543 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17544 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17545 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17548 uint64_t ret_ref = (uint64_t)ret_var.inner;
17549 if (ret_var.is_owned) {
17555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17556 LDKFundingLocked orig_conv;
17557 orig_conv.inner = (void*)(orig & (~1));
17558 orig_conv.is_owned = false;
17559 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17562 uint64_t ret_ref = (uint64_t)ret_var.inner;
17563 if (ret_var.is_owned) {
17569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17570 LDKShutdown this_obj_conv;
17571 this_obj_conv.inner = (void*)(this_obj & (~1));
17572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17573 Shutdown_free(this_obj_conv);
17576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17577 LDKShutdown this_ptr_conv;
17578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17579 this_ptr_conv.is_owned = false;
17580 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17581 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17586 LDKShutdown this_ptr_conv;
17587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17588 this_ptr_conv.is_owned = false;
17589 LDKThirtyTwoBytes val_ref;
17590 CHECK((*env)->GetArrayLength(env, val) == 32);
17591 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17592 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17596 LDKShutdown this_ptr_conv;
17597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17598 this_ptr_conv.is_owned = false;
17599 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17600 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17601 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17606 LDKShutdown this_ptr_conv;
17607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17608 this_ptr_conv.is_owned = false;
17609 LDKCVec_u8Z val_ref;
17610 val_ref.datalen = (*env)->GetArrayLength(env, val);
17611 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17612 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17613 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17617 LDKThirtyTwoBytes channel_id_arg_ref;
17618 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17619 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17620 LDKCVec_u8Z scriptpubkey_arg_ref;
17621 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17622 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17623 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17624 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17627 uint64_t ret_ref = (uint64_t)ret_var.inner;
17628 if (ret_var.is_owned) {
17634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17635 LDKShutdown orig_conv;
17636 orig_conv.inner = (void*)(orig & (~1));
17637 orig_conv.is_owned = false;
17638 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17641 uint64_t ret_ref = (uint64_t)ret_var.inner;
17642 if (ret_var.is_owned) {
17648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17649 LDKClosingSigned this_obj_conv;
17650 this_obj_conv.inner = (void*)(this_obj & (~1));
17651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17652 ClosingSigned_free(this_obj_conv);
17655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17656 LDKClosingSigned this_ptr_conv;
17657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17658 this_ptr_conv.is_owned = false;
17659 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17665 LDKClosingSigned this_ptr_conv;
17666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17667 this_ptr_conv.is_owned = false;
17668 LDKThirtyTwoBytes val_ref;
17669 CHECK((*env)->GetArrayLength(env, val) == 32);
17670 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17671 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17675 LDKClosingSigned this_ptr_conv;
17676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17677 this_ptr_conv.is_owned = false;
17678 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17683 LDKClosingSigned this_ptr_conv;
17684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17685 this_ptr_conv.is_owned = false;
17686 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17690 LDKClosingSigned this_ptr_conv;
17691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17692 this_ptr_conv.is_owned = false;
17693 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17694 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17699 LDKClosingSigned this_ptr_conv;
17700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17701 this_ptr_conv.is_owned = false;
17702 LDKSignature val_ref;
17703 CHECK((*env)->GetArrayLength(env, val) == 64);
17704 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17705 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17708 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) {
17709 LDKThirtyTwoBytes channel_id_arg_ref;
17710 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17711 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17712 LDKSignature signature_arg_ref;
17713 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17714 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17715 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17718 uint64_t ret_ref = (uint64_t)ret_var.inner;
17719 if (ret_var.is_owned) {
17725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17726 LDKClosingSigned orig_conv;
17727 orig_conv.inner = (void*)(orig & (~1));
17728 orig_conv.is_owned = false;
17729 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17732 uint64_t ret_ref = (uint64_t)ret_var.inner;
17733 if (ret_var.is_owned) {
17739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17740 LDKUpdateAddHTLC this_obj_conv;
17741 this_obj_conv.inner = (void*)(this_obj & (~1));
17742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17743 UpdateAddHTLC_free(this_obj_conv);
17746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17747 LDKUpdateAddHTLC this_ptr_conv;
17748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17749 this_ptr_conv.is_owned = false;
17750 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17751 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17756 LDKUpdateAddHTLC this_ptr_conv;
17757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17758 this_ptr_conv.is_owned = false;
17759 LDKThirtyTwoBytes val_ref;
17760 CHECK((*env)->GetArrayLength(env, val) == 32);
17761 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17762 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17766 LDKUpdateAddHTLC this_ptr_conv;
17767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17768 this_ptr_conv.is_owned = false;
17769 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17774 LDKUpdateAddHTLC this_ptr_conv;
17775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17776 this_ptr_conv.is_owned = false;
17777 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17781 LDKUpdateAddHTLC this_ptr_conv;
17782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17783 this_ptr_conv.is_owned = false;
17784 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17789 LDKUpdateAddHTLC this_ptr_conv;
17790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17791 this_ptr_conv.is_owned = false;
17792 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17796 LDKUpdateAddHTLC this_ptr_conv;
17797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17798 this_ptr_conv.is_owned = false;
17799 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17800 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17805 LDKUpdateAddHTLC this_ptr_conv;
17806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17807 this_ptr_conv.is_owned = false;
17808 LDKThirtyTwoBytes val_ref;
17809 CHECK((*env)->GetArrayLength(env, val) == 32);
17810 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17811 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17814 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17815 LDKUpdateAddHTLC this_ptr_conv;
17816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17817 this_ptr_conv.is_owned = false;
17818 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17823 LDKUpdateAddHTLC this_ptr_conv;
17824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17825 this_ptr_conv.is_owned = false;
17826 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17830 LDKUpdateAddHTLC orig_conv;
17831 orig_conv.inner = (void*)(orig & (~1));
17832 orig_conv.is_owned = false;
17833 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17836 uint64_t ret_ref = (uint64_t)ret_var.inner;
17837 if (ret_var.is_owned) {
17843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17844 LDKUpdateFulfillHTLC this_obj_conv;
17845 this_obj_conv.inner = (void*)(this_obj & (~1));
17846 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17847 UpdateFulfillHTLC_free(this_obj_conv);
17850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17851 LDKUpdateFulfillHTLC this_ptr_conv;
17852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17853 this_ptr_conv.is_owned = false;
17854 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17855 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17860 LDKUpdateFulfillHTLC this_ptr_conv;
17861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17862 this_ptr_conv.is_owned = false;
17863 LDKThirtyTwoBytes val_ref;
17864 CHECK((*env)->GetArrayLength(env, val) == 32);
17865 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17866 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17870 LDKUpdateFulfillHTLC this_ptr_conv;
17871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17872 this_ptr_conv.is_owned = false;
17873 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17878 LDKUpdateFulfillHTLC this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17885 LDKUpdateFulfillHTLC this_ptr_conv;
17886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17887 this_ptr_conv.is_owned = false;
17888 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17889 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17894 LDKUpdateFulfillHTLC this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 LDKThirtyTwoBytes val_ref;
17898 CHECK((*env)->GetArrayLength(env, val) == 32);
17899 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17900 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17903 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) {
17904 LDKThirtyTwoBytes channel_id_arg_ref;
17905 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17906 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17907 LDKThirtyTwoBytes payment_preimage_arg_ref;
17908 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17909 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17910 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17913 uint64_t ret_ref = (uint64_t)ret_var.inner;
17914 if (ret_var.is_owned) {
17920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17921 LDKUpdateFulfillHTLC orig_conv;
17922 orig_conv.inner = (void*)(orig & (~1));
17923 orig_conv.is_owned = false;
17924 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17927 uint64_t ret_ref = (uint64_t)ret_var.inner;
17928 if (ret_var.is_owned) {
17934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17935 LDKUpdateFailHTLC this_obj_conv;
17936 this_obj_conv.inner = (void*)(this_obj & (~1));
17937 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17938 UpdateFailHTLC_free(this_obj_conv);
17941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17942 LDKUpdateFailHTLC this_ptr_conv;
17943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17944 this_ptr_conv.is_owned = false;
17945 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17946 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17951 LDKUpdateFailHTLC this_ptr_conv;
17952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17953 this_ptr_conv.is_owned = false;
17954 LDKThirtyTwoBytes val_ref;
17955 CHECK((*env)->GetArrayLength(env, val) == 32);
17956 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17957 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17961 LDKUpdateFailHTLC this_ptr_conv;
17962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17963 this_ptr_conv.is_owned = false;
17964 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17969 LDKUpdateFailHTLC this_ptr_conv;
17970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17971 this_ptr_conv.is_owned = false;
17972 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17976 LDKUpdateFailHTLC orig_conv;
17977 orig_conv.inner = (void*)(orig & (~1));
17978 orig_conv.is_owned = false;
17979 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17980 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17981 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17982 uint64_t ret_ref = (uint64_t)ret_var.inner;
17983 if (ret_var.is_owned) {
17989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17990 LDKUpdateFailMalformedHTLC this_obj_conv;
17991 this_obj_conv.inner = (void*)(this_obj & (~1));
17992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17993 UpdateFailMalformedHTLC_free(this_obj_conv);
17996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17997 LDKUpdateFailMalformedHTLC this_ptr_conv;
17998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17999 this_ptr_conv.is_owned = false;
18000 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18001 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
18005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18006 LDKUpdateFailMalformedHTLC this_ptr_conv;
18007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18008 this_ptr_conv.is_owned = false;
18009 LDKThirtyTwoBytes val_ref;
18010 CHECK((*env)->GetArrayLength(env, val) == 32);
18011 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18012 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
18015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18016 LDKUpdateFailMalformedHTLC this_ptr_conv;
18017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18018 this_ptr_conv.is_owned = false;
18019 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
18023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18024 LDKUpdateFailMalformedHTLC this_ptr_conv;
18025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18026 this_ptr_conv.is_owned = false;
18027 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
18030 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
18031 LDKUpdateFailMalformedHTLC this_ptr_conv;
18032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18033 this_ptr_conv.is_owned = false;
18034 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
18038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18039 LDKUpdateFailMalformedHTLC this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
18045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18046 LDKUpdateFailMalformedHTLC orig_conv;
18047 orig_conv.inner = (void*)(orig & (~1));
18048 orig_conv.is_owned = false;
18049 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
18050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18052 uint64_t ret_ref = (uint64_t)ret_var.inner;
18053 if (ret_var.is_owned) {
18059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18060 LDKCommitmentSigned this_obj_conv;
18061 this_obj_conv.inner = (void*)(this_obj & (~1));
18062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18063 CommitmentSigned_free(this_obj_conv);
18066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18067 LDKCommitmentSigned this_ptr_conv;
18068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18069 this_ptr_conv.is_owned = false;
18070 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18071 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
18075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18076 LDKCommitmentSigned this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 LDKThirtyTwoBytes val_ref;
18080 CHECK((*env)->GetArrayLength(env, val) == 32);
18081 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18082 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
18085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18086 LDKCommitmentSigned this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18090 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
18094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18095 LDKCommitmentSigned this_ptr_conv;
18096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18097 this_ptr_conv.is_owned = false;
18098 LDKSignature val_ref;
18099 CHECK((*env)->GetArrayLength(env, val) == 64);
18100 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18101 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
18104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18105 LDKCommitmentSigned this_ptr_conv;
18106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18107 this_ptr_conv.is_owned = false;
18108 LDKCVec_SignatureZ val_constr;
18109 val_constr.datalen = (*env)->GetArrayLength(env, val);
18110 if (val_constr.datalen > 0)
18111 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18113 val_constr.data = NULL;
18114 for (size_t i = 0; i < val_constr.datalen; i++) {
18115 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18116 LDKSignature val_conv_8_ref;
18117 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18118 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18119 val_constr.data[i] = val_conv_8_ref;
18121 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
18124 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) {
18125 LDKThirtyTwoBytes channel_id_arg_ref;
18126 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18127 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18128 LDKSignature signature_arg_ref;
18129 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18130 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18131 LDKCVec_SignatureZ htlc_signatures_arg_constr;
18132 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
18133 if (htlc_signatures_arg_constr.datalen > 0)
18134 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18136 htlc_signatures_arg_constr.data = NULL;
18137 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
18138 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
18139 LDKSignature htlc_signatures_arg_conv_8_ref;
18140 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
18141 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
18142 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
18144 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
18145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18147 uint64_t ret_ref = (uint64_t)ret_var.inner;
18148 if (ret_var.is_owned) {
18154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18155 LDKCommitmentSigned orig_conv;
18156 orig_conv.inner = (void*)(orig & (~1));
18157 orig_conv.is_owned = false;
18158 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
18159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18161 uint64_t ret_ref = (uint64_t)ret_var.inner;
18162 if (ret_var.is_owned) {
18168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18169 LDKRevokeAndACK this_obj_conv;
18170 this_obj_conv.inner = (void*)(this_obj & (~1));
18171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18172 RevokeAndACK_free(this_obj_conv);
18175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18176 LDKRevokeAndACK this_ptr_conv;
18177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18178 this_ptr_conv.is_owned = false;
18179 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
18184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18185 LDKRevokeAndACK this_ptr_conv;
18186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18187 this_ptr_conv.is_owned = false;
18188 LDKThirtyTwoBytes val_ref;
18189 CHECK((*env)->GetArrayLength(env, val) == 32);
18190 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18191 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
18194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18195 LDKRevokeAndACK this_ptr_conv;
18196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18197 this_ptr_conv.is_owned = false;
18198 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
18203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18204 LDKRevokeAndACK this_ptr_conv;
18205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18206 this_ptr_conv.is_owned = false;
18207 LDKThirtyTwoBytes val_ref;
18208 CHECK((*env)->GetArrayLength(env, val) == 32);
18209 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18210 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
18213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18214 LDKRevokeAndACK this_ptr_conv;
18215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18216 this_ptr_conv.is_owned = false;
18217 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18222 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) {
18223 LDKRevokeAndACK this_ptr_conv;
18224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18225 this_ptr_conv.is_owned = false;
18226 LDKPublicKey val_ref;
18227 CHECK((*env)->GetArrayLength(env, val) == 33);
18228 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18229 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18232 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) {
18233 LDKThirtyTwoBytes channel_id_arg_ref;
18234 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18235 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18236 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
18237 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
18238 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
18239 LDKPublicKey next_per_commitment_point_arg_ref;
18240 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18241 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18242 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
18243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18245 uint64_t ret_ref = (uint64_t)ret_var.inner;
18246 if (ret_var.is_owned) {
18252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18253 LDKRevokeAndACK orig_conv;
18254 orig_conv.inner = (void*)(orig & (~1));
18255 orig_conv.is_owned = false;
18256 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
18257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18259 uint64_t ret_ref = (uint64_t)ret_var.inner;
18260 if (ret_var.is_owned) {
18266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18267 LDKUpdateFee this_obj_conv;
18268 this_obj_conv.inner = (void*)(this_obj & (~1));
18269 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18270 UpdateFee_free(this_obj_conv);
18273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18274 LDKUpdateFee this_ptr_conv;
18275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18276 this_ptr_conv.is_owned = false;
18277 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18278 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
18282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18283 LDKUpdateFee this_ptr_conv;
18284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18285 this_ptr_conv.is_owned = false;
18286 LDKThirtyTwoBytes val_ref;
18287 CHECK((*env)->GetArrayLength(env, val) == 32);
18288 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18289 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
18292 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
18293 LDKUpdateFee this_ptr_conv;
18294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18295 this_ptr_conv.is_owned = false;
18296 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18301 LDKUpdateFee this_ptr_conv;
18302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18303 this_ptr_conv.is_owned = false;
18304 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18307 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) {
18308 LDKThirtyTwoBytes channel_id_arg_ref;
18309 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18310 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18311 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18314 uint64_t ret_ref = (uint64_t)ret_var.inner;
18315 if (ret_var.is_owned) {
18321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18322 LDKUpdateFee orig_conv;
18323 orig_conv.inner = (void*)(orig & (~1));
18324 orig_conv.is_owned = false;
18325 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18328 uint64_t ret_ref = (uint64_t)ret_var.inner;
18329 if (ret_var.is_owned) {
18335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18336 LDKDataLossProtect this_obj_conv;
18337 this_obj_conv.inner = (void*)(this_obj & (~1));
18338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18339 DataLossProtect_free(this_obj_conv);
18342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18343 LDKDataLossProtect this_ptr_conv;
18344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18345 this_ptr_conv.is_owned = false;
18346 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18347 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18351 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) {
18352 LDKDataLossProtect this_ptr_conv;
18353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18354 this_ptr_conv.is_owned = false;
18355 LDKThirtyTwoBytes val_ref;
18356 CHECK((*env)->GetArrayLength(env, val) == 32);
18357 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18358 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18362 LDKDataLossProtect this_ptr_conv;
18363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18364 this_ptr_conv.is_owned = false;
18365 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18366 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18370 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) {
18371 LDKDataLossProtect this_ptr_conv;
18372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18373 this_ptr_conv.is_owned = false;
18374 LDKPublicKey val_ref;
18375 CHECK((*env)->GetArrayLength(env, val) == 33);
18376 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18377 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18380 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) {
18381 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18382 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18383 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18384 LDKPublicKey my_current_per_commitment_point_arg_ref;
18385 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18386 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18387 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18390 uint64_t ret_ref = (uint64_t)ret_var.inner;
18391 if (ret_var.is_owned) {
18397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18398 LDKDataLossProtect orig_conv;
18399 orig_conv.inner = (void*)(orig & (~1));
18400 orig_conv.is_owned = false;
18401 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18404 uint64_t ret_ref = (uint64_t)ret_var.inner;
18405 if (ret_var.is_owned) {
18411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18412 LDKChannelReestablish this_obj_conv;
18413 this_obj_conv.inner = (void*)(this_obj & (~1));
18414 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18415 ChannelReestablish_free(this_obj_conv);
18418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18419 LDKChannelReestablish this_ptr_conv;
18420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18421 this_ptr_conv.is_owned = false;
18422 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18423 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18428 LDKChannelReestablish this_ptr_conv;
18429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18430 this_ptr_conv.is_owned = false;
18431 LDKThirtyTwoBytes val_ref;
18432 CHECK((*env)->GetArrayLength(env, val) == 32);
18433 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18434 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18438 LDKChannelReestablish this_ptr_conv;
18439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18440 this_ptr_conv.is_owned = false;
18441 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18445 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) {
18446 LDKChannelReestablish this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18453 LDKChannelReestablish this_ptr_conv;
18454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18455 this_ptr_conv.is_owned = false;
18456 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18460 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) {
18461 LDKChannelReestablish this_ptr_conv;
18462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18463 this_ptr_conv.is_owned = false;
18464 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18468 LDKChannelReestablish orig_conv;
18469 orig_conv.inner = (void*)(orig & (~1));
18470 orig_conv.is_owned = false;
18471 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18474 uint64_t ret_ref = (uint64_t)ret_var.inner;
18475 if (ret_var.is_owned) {
18481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18482 LDKAnnouncementSignatures this_obj_conv;
18483 this_obj_conv.inner = (void*)(this_obj & (~1));
18484 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18485 AnnouncementSignatures_free(this_obj_conv);
18488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18489 LDKAnnouncementSignatures this_ptr_conv;
18490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18491 this_ptr_conv.is_owned = false;
18492 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18493 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18498 LDKAnnouncementSignatures this_ptr_conv;
18499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18500 this_ptr_conv.is_owned = false;
18501 LDKThirtyTwoBytes val_ref;
18502 CHECK((*env)->GetArrayLength(env, val) == 32);
18503 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18504 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18508 LDKAnnouncementSignatures this_ptr_conv;
18509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18510 this_ptr_conv.is_owned = false;
18511 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18516 LDKAnnouncementSignatures this_ptr_conv;
18517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18518 this_ptr_conv.is_owned = false;
18519 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18523 LDKAnnouncementSignatures this_ptr_conv;
18524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18525 this_ptr_conv.is_owned = false;
18526 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18532 LDKAnnouncementSignatures this_ptr_conv;
18533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18534 this_ptr_conv.is_owned = false;
18535 LDKSignature val_ref;
18536 CHECK((*env)->GetArrayLength(env, val) == 64);
18537 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18538 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18542 LDKAnnouncementSignatures this_ptr_conv;
18543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18544 this_ptr_conv.is_owned = false;
18545 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18551 LDKAnnouncementSignatures this_ptr_conv;
18552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18553 this_ptr_conv.is_owned = false;
18554 LDKSignature val_ref;
18555 CHECK((*env)->GetArrayLength(env, val) == 64);
18556 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18557 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18560 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) {
18561 LDKThirtyTwoBytes channel_id_arg_ref;
18562 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18563 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18564 LDKSignature node_signature_arg_ref;
18565 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18566 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18567 LDKSignature bitcoin_signature_arg_ref;
18568 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18569 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18570 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18573 uint64_t ret_ref = (uint64_t)ret_var.inner;
18574 if (ret_var.is_owned) {
18580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18581 LDKAnnouncementSignatures orig_conv;
18582 orig_conv.inner = (void*)(orig & (~1));
18583 orig_conv.is_owned = false;
18584 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18587 uint64_t ret_ref = (uint64_t)ret_var.inner;
18588 if (ret_var.is_owned) {
18594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18595 if ((this_ptr & 1) != 0) return;
18596 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18597 FREE((void*)this_ptr);
18598 NetAddress_free(this_ptr_conv);
18601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18602 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18603 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18604 *ret_copy = NetAddress_clone(orig_conv);
18605 uint64_t ret_ref = (uint64_t)ret_copy;
18609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18610 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18611 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18612 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18613 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18614 CVec_u8Z_free(ret_var);
18618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18619 LDKu8slice ser_ref;
18620 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18621 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18622 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18623 *ret_conv = Result_read(ser_ref);
18624 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18625 return (uint64_t)ret_conv;
18628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18629 LDKu8slice ser_ref;
18630 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18631 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18632 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18633 *ret_conv = NetAddress_read(ser_ref);
18634 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18635 return (uint64_t)ret_conv;
18638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18639 LDKUnsignedNodeAnnouncement this_obj_conv;
18640 this_obj_conv.inner = (void*)(this_obj & (~1));
18641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18642 UnsignedNodeAnnouncement_free(this_obj_conv);
18645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18646 LDKUnsignedNodeAnnouncement this_ptr_conv;
18647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18648 this_ptr_conv.is_owned = false;
18649 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18652 uint64_t ret_ref = (uint64_t)ret_var.inner;
18653 if (ret_var.is_owned) {
18659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18660 LDKUnsignedNodeAnnouncement this_ptr_conv;
18661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18662 this_ptr_conv.is_owned = false;
18663 LDKNodeFeatures val_conv;
18664 val_conv.inner = (void*)(val & (~1));
18665 val_conv.is_owned = (val & 1) || (val == 0);
18666 val_conv = NodeFeatures_clone(&val_conv);
18667 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18670 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18671 LDKUnsignedNodeAnnouncement this_ptr_conv;
18672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18673 this_ptr_conv.is_owned = false;
18674 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18679 LDKUnsignedNodeAnnouncement this_ptr_conv;
18680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18681 this_ptr_conv.is_owned = false;
18682 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18686 LDKUnsignedNodeAnnouncement this_ptr_conv;
18687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18688 this_ptr_conv.is_owned = false;
18689 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18695 LDKUnsignedNodeAnnouncement this_ptr_conv;
18696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18697 this_ptr_conv.is_owned = false;
18698 LDKPublicKey val_ref;
18699 CHECK((*env)->GetArrayLength(env, val) == 33);
18700 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18701 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18705 LDKUnsignedNodeAnnouncement this_ptr_conv;
18706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18707 this_ptr_conv.is_owned = false;
18708 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18714 LDKUnsignedNodeAnnouncement this_ptr_conv;
18715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18716 this_ptr_conv.is_owned = false;
18717 LDKThreeBytes val_ref;
18718 CHECK((*env)->GetArrayLength(env, val) == 3);
18719 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18720 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18724 LDKUnsignedNodeAnnouncement this_ptr_conv;
18725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18726 this_ptr_conv.is_owned = false;
18727 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18728 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18733 LDKUnsignedNodeAnnouncement this_ptr_conv;
18734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18735 this_ptr_conv.is_owned = false;
18736 LDKThirtyTwoBytes val_ref;
18737 CHECK((*env)->GetArrayLength(env, val) == 32);
18738 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18739 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18743 LDKUnsignedNodeAnnouncement this_ptr_conv;
18744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18745 this_ptr_conv.is_owned = false;
18746 LDKCVec_NetAddressZ val_constr;
18747 val_constr.datalen = (*env)->GetArrayLength(env, val);
18748 if (val_constr.datalen > 0)
18749 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18751 val_constr.data = NULL;
18752 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18753 for (size_t m = 0; m < val_constr.datalen; m++) {
18754 int64_t val_conv_12 = val_vals[m];
18755 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18756 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18757 val_constr.data[m] = val_conv_12_conv;
18759 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18760 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18764 LDKUnsignedNodeAnnouncement orig_conv;
18765 orig_conv.inner = (void*)(orig & (~1));
18766 orig_conv.is_owned = false;
18767 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18770 uint64_t ret_ref = (uint64_t)ret_var.inner;
18771 if (ret_var.is_owned) {
18777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18778 LDKNodeAnnouncement this_obj_conv;
18779 this_obj_conv.inner = (void*)(this_obj & (~1));
18780 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18781 NodeAnnouncement_free(this_obj_conv);
18784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18785 LDKNodeAnnouncement this_ptr_conv;
18786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18787 this_ptr_conv.is_owned = false;
18788 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18794 LDKNodeAnnouncement this_ptr_conv;
18795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18796 this_ptr_conv.is_owned = false;
18797 LDKSignature val_ref;
18798 CHECK((*env)->GetArrayLength(env, val) == 64);
18799 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18800 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18804 LDKNodeAnnouncement this_ptr_conv;
18805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18806 this_ptr_conv.is_owned = false;
18807 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18810 uint64_t ret_ref = (uint64_t)ret_var.inner;
18811 if (ret_var.is_owned) {
18817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18818 LDKNodeAnnouncement this_ptr_conv;
18819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18820 this_ptr_conv.is_owned = false;
18821 LDKUnsignedNodeAnnouncement val_conv;
18822 val_conv.inner = (void*)(val & (~1));
18823 val_conv.is_owned = (val & 1) || (val == 0);
18824 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18825 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18829 LDKSignature signature_arg_ref;
18830 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18831 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18832 LDKUnsignedNodeAnnouncement contents_arg_conv;
18833 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18834 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18835 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18836 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18839 uint64_t ret_ref = (uint64_t)ret_var.inner;
18840 if (ret_var.is_owned) {
18846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18847 LDKNodeAnnouncement orig_conv;
18848 orig_conv.inner = (void*)(orig & (~1));
18849 orig_conv.is_owned = false;
18850 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18853 uint64_t ret_ref = (uint64_t)ret_var.inner;
18854 if (ret_var.is_owned) {
18860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18861 LDKUnsignedChannelAnnouncement this_obj_conv;
18862 this_obj_conv.inner = (void*)(this_obj & (~1));
18863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18864 UnsignedChannelAnnouncement_free(this_obj_conv);
18867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18868 LDKUnsignedChannelAnnouncement this_ptr_conv;
18869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18870 this_ptr_conv.is_owned = false;
18871 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18874 uint64_t ret_ref = (uint64_t)ret_var.inner;
18875 if (ret_var.is_owned) {
18881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18882 LDKUnsignedChannelAnnouncement this_ptr_conv;
18883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18884 this_ptr_conv.is_owned = false;
18885 LDKChannelFeatures val_conv;
18886 val_conv.inner = (void*)(val & (~1));
18887 val_conv.is_owned = (val & 1) || (val == 0);
18888 val_conv = ChannelFeatures_clone(&val_conv);
18889 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18893 LDKUnsignedChannelAnnouncement this_ptr_conv;
18894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18895 this_ptr_conv.is_owned = false;
18896 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18902 LDKUnsignedChannelAnnouncement this_ptr_conv;
18903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18904 this_ptr_conv.is_owned = false;
18905 LDKThirtyTwoBytes val_ref;
18906 CHECK((*env)->GetArrayLength(env, val) == 32);
18907 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18908 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18912 LDKUnsignedChannelAnnouncement this_ptr_conv;
18913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18914 this_ptr_conv.is_owned = false;
18915 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18920 LDKUnsignedChannelAnnouncement this_ptr_conv;
18921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18922 this_ptr_conv.is_owned = false;
18923 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18927 LDKUnsignedChannelAnnouncement this_ptr_conv;
18928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18929 this_ptr_conv.is_owned = false;
18930 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18931 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18936 LDKUnsignedChannelAnnouncement this_ptr_conv;
18937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18938 this_ptr_conv.is_owned = false;
18939 LDKPublicKey val_ref;
18940 CHECK((*env)->GetArrayLength(env, val) == 33);
18941 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18942 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18946 LDKUnsignedChannelAnnouncement this_ptr_conv;
18947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18948 this_ptr_conv.is_owned = false;
18949 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18955 LDKUnsignedChannelAnnouncement this_ptr_conv;
18956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18957 this_ptr_conv.is_owned = false;
18958 LDKPublicKey val_ref;
18959 CHECK((*env)->GetArrayLength(env, val) == 33);
18960 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18961 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18965 LDKUnsignedChannelAnnouncement this_ptr_conv;
18966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18967 this_ptr_conv.is_owned = false;
18968 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18969 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18974 LDKUnsignedChannelAnnouncement this_ptr_conv;
18975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18976 this_ptr_conv.is_owned = false;
18977 LDKPublicKey val_ref;
18978 CHECK((*env)->GetArrayLength(env, val) == 33);
18979 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18980 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18984 LDKUnsignedChannelAnnouncement this_ptr_conv;
18985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18986 this_ptr_conv.is_owned = false;
18987 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18988 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18993 LDKUnsignedChannelAnnouncement this_ptr_conv;
18994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18995 this_ptr_conv.is_owned = false;
18996 LDKPublicKey val_ref;
18997 CHECK((*env)->GetArrayLength(env, val) == 33);
18998 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18999 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
19002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19003 LDKUnsignedChannelAnnouncement orig_conv;
19004 orig_conv.inner = (void*)(orig & (~1));
19005 orig_conv.is_owned = false;
19006 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
19010 if (ret_var.is_owned) {
19016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19017 LDKChannelAnnouncement this_obj_conv;
19018 this_obj_conv.inner = (void*)(this_obj & (~1));
19019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19020 ChannelAnnouncement_free(this_obj_conv);
19023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19024 LDKChannelAnnouncement this_ptr_conv;
19025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19026 this_ptr_conv.is_owned = false;
19027 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19028 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
19032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19033 LDKChannelAnnouncement this_ptr_conv;
19034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19035 this_ptr_conv.is_owned = false;
19036 LDKSignature val_ref;
19037 CHECK((*env)->GetArrayLength(env, val) == 64);
19038 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19039 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
19042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19043 LDKChannelAnnouncement this_ptr_conv;
19044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19045 this_ptr_conv.is_owned = false;
19046 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
19051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19052 LDKChannelAnnouncement this_ptr_conv;
19053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19054 this_ptr_conv.is_owned = false;
19055 LDKSignature val_ref;
19056 CHECK((*env)->GetArrayLength(env, val) == 64);
19057 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19058 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
19061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19062 LDKChannelAnnouncement this_ptr_conv;
19063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19064 this_ptr_conv.is_owned = false;
19065 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
19070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19071 LDKChannelAnnouncement this_ptr_conv;
19072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19073 this_ptr_conv.is_owned = false;
19074 LDKSignature val_ref;
19075 CHECK((*env)->GetArrayLength(env, val) == 64);
19076 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19077 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
19080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19081 LDKChannelAnnouncement this_ptr_conv;
19082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19083 this_ptr_conv.is_owned = false;
19084 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19085 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
19089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19090 LDKChannelAnnouncement this_ptr_conv;
19091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19092 this_ptr_conv.is_owned = false;
19093 LDKSignature val_ref;
19094 CHECK((*env)->GetArrayLength(env, val) == 64);
19095 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19096 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
19099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19100 LDKChannelAnnouncement this_ptr_conv;
19101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19102 this_ptr_conv.is_owned = false;
19103 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
19104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19106 uint64_t ret_ref = (uint64_t)ret_var.inner;
19107 if (ret_var.is_owned) {
19113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19114 LDKChannelAnnouncement this_ptr_conv;
19115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19116 this_ptr_conv.is_owned = false;
19117 LDKUnsignedChannelAnnouncement val_conv;
19118 val_conv.inner = (void*)(val & (~1));
19119 val_conv.is_owned = (val & 1) || (val == 0);
19120 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
19121 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
19124 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) {
19125 LDKSignature node_signature_1_arg_ref;
19126 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
19127 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
19128 LDKSignature node_signature_2_arg_ref;
19129 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
19130 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
19131 LDKSignature bitcoin_signature_1_arg_ref;
19132 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
19133 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
19134 LDKSignature bitcoin_signature_2_arg_ref;
19135 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
19136 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
19137 LDKUnsignedChannelAnnouncement contents_arg_conv;
19138 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19139 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19140 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
19141 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);
19142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19144 uint64_t ret_ref = (uint64_t)ret_var.inner;
19145 if (ret_var.is_owned) {
19151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19152 LDKChannelAnnouncement orig_conv;
19153 orig_conv.inner = (void*)(orig & (~1));
19154 orig_conv.is_owned = false;
19155 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
19156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19158 uint64_t ret_ref = (uint64_t)ret_var.inner;
19159 if (ret_var.is_owned) {
19165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19166 LDKUnsignedChannelUpdate this_obj_conv;
19167 this_obj_conv.inner = (void*)(this_obj & (~1));
19168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19169 UnsignedChannelUpdate_free(this_obj_conv);
19172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19173 LDKUnsignedChannelUpdate this_ptr_conv;
19174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19175 this_ptr_conv.is_owned = false;
19176 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19177 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
19181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19182 LDKUnsignedChannelUpdate this_ptr_conv;
19183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19184 this_ptr_conv.is_owned = false;
19185 LDKThirtyTwoBytes val_ref;
19186 CHECK((*env)->GetArrayLength(env, val) == 32);
19187 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19188 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
19191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19192 LDKUnsignedChannelUpdate this_ptr_conv;
19193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19194 this_ptr_conv.is_owned = false;
19195 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
19199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19200 LDKUnsignedChannelUpdate this_ptr_conv;
19201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19202 this_ptr_conv.is_owned = false;
19203 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
19206 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19207 LDKUnsignedChannelUpdate this_ptr_conv;
19208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19209 this_ptr_conv.is_owned = false;
19210 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
19214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19215 LDKUnsignedChannelUpdate this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
19221 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19222 LDKUnsignedChannelUpdate this_ptr_conv;
19223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19224 this_ptr_conv.is_owned = false;
19225 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
19229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19230 LDKUnsignedChannelUpdate this_ptr_conv;
19231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19232 this_ptr_conv.is_owned = false;
19233 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
19236 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19237 LDKUnsignedChannelUpdate this_ptr_conv;
19238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19239 this_ptr_conv.is_owned = false;
19240 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
19244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19245 LDKUnsignedChannelUpdate this_ptr_conv;
19246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19247 this_ptr_conv.is_owned = false;
19248 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
19251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19252 LDKUnsignedChannelUpdate this_ptr_conv;
19253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19254 this_ptr_conv.is_owned = false;
19255 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
19259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19260 LDKUnsignedChannelUpdate this_ptr_conv;
19261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19262 this_ptr_conv.is_owned = false;
19263 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
19266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19267 LDKUnsignedChannelUpdate this_ptr_conv;
19268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19269 this_ptr_conv.is_owned = false;
19270 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
19274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19275 LDKUnsignedChannelUpdate this_ptr_conv;
19276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19277 this_ptr_conv.is_owned = false;
19278 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19281 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19282 LDKUnsignedChannelUpdate this_ptr_conv;
19283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19284 this_ptr_conv.is_owned = false;
19285 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19290 LDKUnsignedChannelUpdate this_ptr_conv;
19291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19292 this_ptr_conv.is_owned = false;
19293 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19297 LDKUnsignedChannelUpdate orig_conv;
19298 orig_conv.inner = (void*)(orig & (~1));
19299 orig_conv.is_owned = false;
19300 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19303 uint64_t ret_ref = (uint64_t)ret_var.inner;
19304 if (ret_var.is_owned) {
19310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19311 LDKChannelUpdate this_obj_conv;
19312 this_obj_conv.inner = (void*)(this_obj & (~1));
19313 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19314 ChannelUpdate_free(this_obj_conv);
19317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19318 LDKChannelUpdate this_ptr_conv;
19319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19320 this_ptr_conv.is_owned = false;
19321 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19327 LDKChannelUpdate this_ptr_conv;
19328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19329 this_ptr_conv.is_owned = false;
19330 LDKSignature val_ref;
19331 CHECK((*env)->GetArrayLength(env, val) == 64);
19332 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19333 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19337 LDKChannelUpdate this_ptr_conv;
19338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19339 this_ptr_conv.is_owned = false;
19340 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19343 uint64_t ret_ref = (uint64_t)ret_var.inner;
19344 if (ret_var.is_owned) {
19350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19351 LDKChannelUpdate this_ptr_conv;
19352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19353 this_ptr_conv.is_owned = false;
19354 LDKUnsignedChannelUpdate val_conv;
19355 val_conv.inner = (void*)(val & (~1));
19356 val_conv.is_owned = (val & 1) || (val == 0);
19357 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19358 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19362 LDKSignature signature_arg_ref;
19363 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19364 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19365 LDKUnsignedChannelUpdate contents_arg_conv;
19366 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19367 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19368 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19369 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19372 uint64_t ret_ref = (uint64_t)ret_var.inner;
19373 if (ret_var.is_owned) {
19379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19380 LDKChannelUpdate orig_conv;
19381 orig_conv.inner = (void*)(orig & (~1));
19382 orig_conv.is_owned = false;
19383 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19386 uint64_t ret_ref = (uint64_t)ret_var.inner;
19387 if (ret_var.is_owned) {
19393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19394 LDKQueryChannelRange this_obj_conv;
19395 this_obj_conv.inner = (void*)(this_obj & (~1));
19396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19397 QueryChannelRange_free(this_obj_conv);
19400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19401 LDKQueryChannelRange this_ptr_conv;
19402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19403 this_ptr_conv.is_owned = false;
19404 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19405 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19410 LDKQueryChannelRange this_ptr_conv;
19411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19412 this_ptr_conv.is_owned = false;
19413 LDKThirtyTwoBytes val_ref;
19414 CHECK((*env)->GetArrayLength(env, val) == 32);
19415 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19416 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19419 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19420 LDKQueryChannelRange this_ptr_conv;
19421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19422 this_ptr_conv.is_owned = false;
19423 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19428 LDKQueryChannelRange this_ptr_conv;
19429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19430 this_ptr_conv.is_owned = false;
19431 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19434 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19435 LDKQueryChannelRange this_ptr_conv;
19436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19437 this_ptr_conv.is_owned = false;
19438 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19443 LDKQueryChannelRange this_ptr_conv;
19444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19445 this_ptr_conv.is_owned = false;
19446 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19449 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) {
19450 LDKThirtyTwoBytes chain_hash_arg_ref;
19451 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19452 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19453 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19456 uint64_t ret_ref = (uint64_t)ret_var.inner;
19457 if (ret_var.is_owned) {
19463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19464 LDKQueryChannelRange orig_conv;
19465 orig_conv.inner = (void*)(orig & (~1));
19466 orig_conv.is_owned = false;
19467 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19470 uint64_t ret_ref = (uint64_t)ret_var.inner;
19471 if (ret_var.is_owned) {
19477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19478 LDKReplyChannelRange this_obj_conv;
19479 this_obj_conv.inner = (void*)(this_obj & (~1));
19480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19481 ReplyChannelRange_free(this_obj_conv);
19484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19485 LDKReplyChannelRange this_ptr_conv;
19486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19487 this_ptr_conv.is_owned = false;
19488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19494 LDKReplyChannelRange this_ptr_conv;
19495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19496 this_ptr_conv.is_owned = false;
19497 LDKThirtyTwoBytes val_ref;
19498 CHECK((*env)->GetArrayLength(env, val) == 32);
19499 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19500 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19503 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19504 LDKReplyChannelRange this_ptr_conv;
19505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19506 this_ptr_conv.is_owned = false;
19507 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19512 LDKReplyChannelRange this_ptr_conv;
19513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19514 this_ptr_conv.is_owned = false;
19515 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19518 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19519 LDKReplyChannelRange this_ptr_conv;
19520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19521 this_ptr_conv.is_owned = false;
19522 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19527 LDKReplyChannelRange this_ptr_conv;
19528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19529 this_ptr_conv.is_owned = false;
19530 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19534 LDKReplyChannelRange this_ptr_conv;
19535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19536 this_ptr_conv.is_owned = false;
19537 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19542 LDKReplyChannelRange this_ptr_conv;
19543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19544 this_ptr_conv.is_owned = false;
19545 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19549 LDKReplyChannelRange this_ptr_conv;
19550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19551 this_ptr_conv.is_owned = false;
19552 LDKCVec_u64Z val_constr;
19553 val_constr.datalen = (*env)->GetArrayLength(env, val);
19554 if (val_constr.datalen > 0)
19555 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19557 val_constr.data = NULL;
19558 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19559 for (size_t g = 0; g < val_constr.datalen; g++) {
19560 int64_t val_conv_6 = val_vals[g];
19561 val_constr.data[g] = val_conv_6;
19563 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19564 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19567 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) {
19568 LDKThirtyTwoBytes chain_hash_arg_ref;
19569 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19570 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19571 LDKCVec_u64Z short_channel_ids_arg_constr;
19572 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19573 if (short_channel_ids_arg_constr.datalen > 0)
19574 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19576 short_channel_ids_arg_constr.data = NULL;
19577 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19578 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19579 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19580 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19582 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19583 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19586 uint64_t ret_ref = (uint64_t)ret_var.inner;
19587 if (ret_var.is_owned) {
19593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19594 LDKReplyChannelRange orig_conv;
19595 orig_conv.inner = (void*)(orig & (~1));
19596 orig_conv.is_owned = false;
19597 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19600 uint64_t ret_ref = (uint64_t)ret_var.inner;
19601 if (ret_var.is_owned) {
19607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19608 LDKQueryShortChannelIds this_obj_conv;
19609 this_obj_conv.inner = (void*)(this_obj & (~1));
19610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19611 QueryShortChannelIds_free(this_obj_conv);
19614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19615 LDKQueryShortChannelIds this_ptr_conv;
19616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19617 this_ptr_conv.is_owned = false;
19618 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19624 LDKQueryShortChannelIds this_ptr_conv;
19625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19626 this_ptr_conv.is_owned = false;
19627 LDKThirtyTwoBytes val_ref;
19628 CHECK((*env)->GetArrayLength(env, val) == 32);
19629 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19630 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19634 LDKQueryShortChannelIds this_ptr_conv;
19635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19636 this_ptr_conv.is_owned = false;
19637 LDKCVec_u64Z val_constr;
19638 val_constr.datalen = (*env)->GetArrayLength(env, val);
19639 if (val_constr.datalen > 0)
19640 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19642 val_constr.data = NULL;
19643 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19644 for (size_t g = 0; g < val_constr.datalen; g++) {
19645 int64_t val_conv_6 = val_vals[g];
19646 val_constr.data[g] = val_conv_6;
19648 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19649 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19652 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) {
19653 LDKThirtyTwoBytes chain_hash_arg_ref;
19654 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19655 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19656 LDKCVec_u64Z short_channel_ids_arg_constr;
19657 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19658 if (short_channel_ids_arg_constr.datalen > 0)
19659 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19661 short_channel_ids_arg_constr.data = NULL;
19662 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19663 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19664 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19665 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19667 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19668 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19671 uint64_t ret_ref = (uint64_t)ret_var.inner;
19672 if (ret_var.is_owned) {
19678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19679 LDKQueryShortChannelIds orig_conv;
19680 orig_conv.inner = (void*)(orig & (~1));
19681 orig_conv.is_owned = false;
19682 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19685 uint64_t ret_ref = (uint64_t)ret_var.inner;
19686 if (ret_var.is_owned) {
19692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19693 LDKReplyShortChannelIdsEnd this_obj_conv;
19694 this_obj_conv.inner = (void*)(this_obj & (~1));
19695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19696 ReplyShortChannelIdsEnd_free(this_obj_conv);
19699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19700 LDKReplyShortChannelIdsEnd this_ptr_conv;
19701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19702 this_ptr_conv.is_owned = false;
19703 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19704 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19709 LDKReplyShortChannelIdsEnd this_ptr_conv;
19710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19711 this_ptr_conv.is_owned = false;
19712 LDKThirtyTwoBytes val_ref;
19713 CHECK((*env)->GetArrayLength(env, val) == 32);
19714 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19715 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19719 LDKReplyShortChannelIdsEnd this_ptr_conv;
19720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19721 this_ptr_conv.is_owned = false;
19722 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19727 LDKReplyShortChannelIdsEnd this_ptr_conv;
19728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19729 this_ptr_conv.is_owned = false;
19730 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19734 LDKThirtyTwoBytes chain_hash_arg_ref;
19735 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19736 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19737 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19740 uint64_t ret_ref = (uint64_t)ret_var.inner;
19741 if (ret_var.is_owned) {
19747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19748 LDKReplyShortChannelIdsEnd orig_conv;
19749 orig_conv.inner = (void*)(orig & (~1));
19750 orig_conv.is_owned = false;
19751 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19754 uint64_t ret_ref = (uint64_t)ret_var.inner;
19755 if (ret_var.is_owned) {
19761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19762 LDKGossipTimestampFilter this_obj_conv;
19763 this_obj_conv.inner = (void*)(this_obj & (~1));
19764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19765 GossipTimestampFilter_free(this_obj_conv);
19768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19769 LDKGossipTimestampFilter this_ptr_conv;
19770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19771 this_ptr_conv.is_owned = false;
19772 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19773 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19778 LDKGossipTimestampFilter this_ptr_conv;
19779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19780 this_ptr_conv.is_owned = false;
19781 LDKThirtyTwoBytes val_ref;
19782 CHECK((*env)->GetArrayLength(env, val) == 32);
19783 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19784 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19787 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19788 LDKGossipTimestampFilter this_ptr_conv;
19789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19790 this_ptr_conv.is_owned = false;
19791 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19796 LDKGossipTimestampFilter this_ptr_conv;
19797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19798 this_ptr_conv.is_owned = false;
19799 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19802 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19803 LDKGossipTimestampFilter this_ptr_conv;
19804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19805 this_ptr_conv.is_owned = false;
19806 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19811 LDKGossipTimestampFilter this_ptr_conv;
19812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19813 this_ptr_conv.is_owned = false;
19814 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19817 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) {
19818 LDKThirtyTwoBytes chain_hash_arg_ref;
19819 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19820 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19821 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19824 uint64_t ret_ref = (uint64_t)ret_var.inner;
19825 if (ret_var.is_owned) {
19831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19832 LDKGossipTimestampFilter orig_conv;
19833 orig_conv.inner = (void*)(orig & (~1));
19834 orig_conv.is_owned = false;
19835 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19836 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19837 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19838 uint64_t ret_ref = (uint64_t)ret_var.inner;
19839 if (ret_var.is_owned) {
19845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19846 if ((this_ptr & 1) != 0) return;
19847 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19848 FREE((void*)this_ptr);
19849 ErrorAction_free(this_ptr_conv);
19852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19853 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19854 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19855 *ret_copy = ErrorAction_clone(orig_conv);
19856 uint64_t ret_ref = (uint64_t)ret_copy;
19860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19861 LDKLightningError this_obj_conv;
19862 this_obj_conv.inner = (void*)(this_obj & (~1));
19863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19864 LightningError_free(this_obj_conv);
19867 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19868 LDKLightningError this_ptr_conv;
19869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19870 this_ptr_conv.is_owned = false;
19871 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19872 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19877 LDKLightningError this_ptr_conv;
19878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19879 this_ptr_conv.is_owned = false;
19880 LDKStr val_conv = java_to_owned_str(env, val);
19881 LightningError_set_err(&this_ptr_conv, val_conv);
19884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19885 LDKLightningError this_ptr_conv;
19886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19887 this_ptr_conv.is_owned = false;
19888 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19889 *ret_copy = LightningError_get_action(&this_ptr_conv);
19890 uint64_t ret_ref = (uint64_t)ret_copy;
19894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19895 LDKLightningError this_ptr_conv;
19896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19897 this_ptr_conv.is_owned = false;
19898 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19899 LightningError_set_action(&this_ptr_conv, val_conv);
19902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19903 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19904 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19905 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19908 uint64_t ret_ref = (uint64_t)ret_var.inner;
19909 if (ret_var.is_owned) {
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19916 LDKLightningError orig_conv;
19917 orig_conv.inner = (void*)(orig & (~1));
19918 orig_conv.is_owned = false;
19919 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19922 uint64_t ret_ref = (uint64_t)ret_var.inner;
19923 if (ret_var.is_owned) {
19929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19930 LDKCommitmentUpdate this_obj_conv;
19931 this_obj_conv.inner = (void*)(this_obj & (~1));
19932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19933 CommitmentUpdate_free(this_obj_conv);
19936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19937 LDKCommitmentUpdate this_ptr_conv;
19938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19939 this_ptr_conv.is_owned = false;
19940 LDKCVec_UpdateAddHTLCZ val_constr;
19941 val_constr.datalen = (*env)->GetArrayLength(env, val);
19942 if (val_constr.datalen > 0)
19943 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19945 val_constr.data = NULL;
19946 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19947 for (size_t p = 0; p < val_constr.datalen; p++) {
19948 int64_t val_conv_15 = val_vals[p];
19949 LDKUpdateAddHTLC val_conv_15_conv;
19950 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19951 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19952 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19953 val_constr.data[p] = val_conv_15_conv;
19955 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19956 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19960 LDKCommitmentUpdate this_ptr_conv;
19961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19962 this_ptr_conv.is_owned = false;
19963 LDKCVec_UpdateFulfillHTLCZ val_constr;
19964 val_constr.datalen = (*env)->GetArrayLength(env, val);
19965 if (val_constr.datalen > 0)
19966 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19968 val_constr.data = NULL;
19969 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19970 for (size_t t = 0; t < val_constr.datalen; t++) {
19971 int64_t val_conv_19 = val_vals[t];
19972 LDKUpdateFulfillHTLC val_conv_19_conv;
19973 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19974 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19975 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19976 val_constr.data[t] = val_conv_19_conv;
19978 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19979 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19983 LDKCommitmentUpdate this_ptr_conv;
19984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19985 this_ptr_conv.is_owned = false;
19986 LDKCVec_UpdateFailHTLCZ val_constr;
19987 val_constr.datalen = (*env)->GetArrayLength(env, val);
19988 if (val_constr.datalen > 0)
19989 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19991 val_constr.data = NULL;
19992 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19993 for (size_t q = 0; q < val_constr.datalen; q++) {
19994 int64_t val_conv_16 = val_vals[q];
19995 LDKUpdateFailHTLC val_conv_16_conv;
19996 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19997 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19998 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19999 val_constr.data[q] = val_conv_16_conv;
20001 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20002 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
20005 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) {
20006 LDKCommitmentUpdate this_ptr_conv;
20007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20008 this_ptr_conv.is_owned = false;
20009 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
20010 val_constr.datalen = (*env)->GetArrayLength(env, val);
20011 if (val_constr.datalen > 0)
20012 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20014 val_constr.data = NULL;
20015 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20016 for (size_t z = 0; z < val_constr.datalen; z++) {
20017 int64_t val_conv_25 = val_vals[z];
20018 LDKUpdateFailMalformedHTLC val_conv_25_conv;
20019 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
20020 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
20021 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
20022 val_constr.data[z] = val_conv_25_conv;
20024 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20025 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
20028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
20029 LDKCommitmentUpdate this_ptr_conv;
20030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20031 this_ptr_conv.is_owned = false;
20032 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
20033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20035 uint64_t ret_ref = (uint64_t)ret_var.inner;
20036 if (ret_var.is_owned) {
20042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20043 LDKCommitmentUpdate this_ptr_conv;
20044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20045 this_ptr_conv.is_owned = false;
20046 LDKUpdateFee val_conv;
20047 val_conv.inner = (void*)(val & (~1));
20048 val_conv.is_owned = (val & 1) || (val == 0);
20049 val_conv = UpdateFee_clone(&val_conv);
20050 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
20053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
20054 LDKCommitmentUpdate this_ptr_conv;
20055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20056 this_ptr_conv.is_owned = false;
20057 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
20058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20060 uint64_t ret_ref = (uint64_t)ret_var.inner;
20061 if (ret_var.is_owned) {
20067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20068 LDKCommitmentUpdate this_ptr_conv;
20069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20070 this_ptr_conv.is_owned = false;
20071 LDKCommitmentSigned val_conv;
20072 val_conv.inner = (void*)(val & (~1));
20073 val_conv.is_owned = (val & 1) || (val == 0);
20074 val_conv = CommitmentSigned_clone(&val_conv);
20075 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
20078 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) {
20079 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
20080 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
20081 if (update_add_htlcs_arg_constr.datalen > 0)
20082 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20084 update_add_htlcs_arg_constr.data = NULL;
20085 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
20086 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
20087 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
20088 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
20089 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
20090 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
20091 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
20092 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
20094 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
20095 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
20096 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
20097 if (update_fulfill_htlcs_arg_constr.datalen > 0)
20098 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20100 update_fulfill_htlcs_arg_constr.data = NULL;
20101 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
20102 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
20103 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
20104 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
20105 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
20106 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
20107 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
20108 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
20110 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
20111 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
20112 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
20113 if (update_fail_htlcs_arg_constr.datalen > 0)
20114 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20116 update_fail_htlcs_arg_constr.data = NULL;
20117 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
20118 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
20119 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
20120 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
20121 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
20122 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
20123 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
20124 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
20126 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
20127 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
20128 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
20129 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
20130 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20132 update_fail_malformed_htlcs_arg_constr.data = NULL;
20133 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
20134 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
20135 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
20136 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
20137 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
20138 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);
20139 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
20140 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
20142 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
20143 LDKUpdateFee update_fee_arg_conv;
20144 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
20145 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
20146 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
20147 LDKCommitmentSigned commitment_signed_arg_conv;
20148 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
20149 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
20150 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
20151 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);
20152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20154 uint64_t ret_ref = (uint64_t)ret_var.inner;
20155 if (ret_var.is_owned) {
20161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20162 LDKCommitmentUpdate orig_conv;
20163 orig_conv.inner = (void*)(orig & (~1));
20164 orig_conv.is_owned = false;
20165 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
20166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20168 uint64_t ret_ref = (uint64_t)ret_var.inner;
20169 if (ret_var.is_owned) {
20175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20176 if ((this_ptr & 1) != 0) return;
20177 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
20178 FREE((void*)this_ptr);
20179 HTLCFailChannelUpdate_free(this_ptr_conv);
20182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20183 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
20184 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
20185 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
20186 uint64_t ret_ref = (uint64_t)ret_copy;
20190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20191 if ((this_ptr & 1) != 0) return;
20192 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20193 FREE((void*)this_ptr);
20194 ChannelMessageHandler_free(this_ptr_conv);
20197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20198 if ((this_ptr & 1) != 0) return;
20199 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20200 FREE((void*)this_ptr);
20201 RoutingMessageHandler_free(this_ptr_conv);
20204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20205 LDKAcceptChannel obj_conv;
20206 obj_conv.inner = (void*)(obj & (~1));
20207 obj_conv.is_owned = false;
20208 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20209 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20210 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20211 CVec_u8Z_free(ret_var);
20215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20216 LDKu8slice ser_ref;
20217 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20218 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20219 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20220 *ret_conv = AcceptChannel_read(ser_ref);
20221 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20222 return (uint64_t)ret_conv;
20225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
20226 LDKAnnouncementSignatures obj_conv;
20227 obj_conv.inner = (void*)(obj & (~1));
20228 obj_conv.is_owned = false;
20229 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20230 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20231 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20232 CVec_u8Z_free(ret_var);
20236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20237 LDKu8slice ser_ref;
20238 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20239 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20240 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20241 *ret_conv = AnnouncementSignatures_read(ser_ref);
20242 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20243 return (uint64_t)ret_conv;
20246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
20247 LDKChannelReestablish obj_conv;
20248 obj_conv.inner = (void*)(obj & (~1));
20249 obj_conv.is_owned = false;
20250 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20251 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20252 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20253 CVec_u8Z_free(ret_var);
20257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20258 LDKu8slice ser_ref;
20259 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20260 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20261 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20262 *ret_conv = ChannelReestablish_read(ser_ref);
20263 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20264 return (uint64_t)ret_conv;
20267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20268 LDKClosingSigned obj_conv;
20269 obj_conv.inner = (void*)(obj & (~1));
20270 obj_conv.is_owned = false;
20271 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20272 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20273 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20274 CVec_u8Z_free(ret_var);
20278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20279 LDKu8slice ser_ref;
20280 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20281 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20282 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20283 *ret_conv = ClosingSigned_read(ser_ref);
20284 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20285 return (uint64_t)ret_conv;
20288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20289 LDKCommitmentSigned obj_conv;
20290 obj_conv.inner = (void*)(obj & (~1));
20291 obj_conv.is_owned = false;
20292 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20293 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20294 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20295 CVec_u8Z_free(ret_var);
20299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20300 LDKu8slice ser_ref;
20301 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20302 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20303 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20304 *ret_conv = CommitmentSigned_read(ser_ref);
20305 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20306 return (uint64_t)ret_conv;
20309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20310 LDKFundingCreated obj_conv;
20311 obj_conv.inner = (void*)(obj & (~1));
20312 obj_conv.is_owned = false;
20313 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20314 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20315 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20316 CVec_u8Z_free(ret_var);
20320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20321 LDKu8slice ser_ref;
20322 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20323 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20324 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20325 *ret_conv = FundingCreated_read(ser_ref);
20326 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20327 return (uint64_t)ret_conv;
20330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20331 LDKFundingSigned obj_conv;
20332 obj_conv.inner = (void*)(obj & (~1));
20333 obj_conv.is_owned = false;
20334 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20337 CVec_u8Z_free(ret_var);
20341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20342 LDKu8slice ser_ref;
20343 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20344 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20345 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20346 *ret_conv = FundingSigned_read(ser_ref);
20347 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20348 return (uint64_t)ret_conv;
20351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20352 LDKFundingLocked obj_conv;
20353 obj_conv.inner = (void*)(obj & (~1));
20354 obj_conv.is_owned = false;
20355 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20356 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20357 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20358 CVec_u8Z_free(ret_var);
20362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20363 LDKu8slice ser_ref;
20364 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20365 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20366 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20367 *ret_conv = FundingLocked_read(ser_ref);
20368 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20369 return (uint64_t)ret_conv;
20372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20374 obj_conv.inner = (void*)(obj & (~1));
20375 obj_conv.is_owned = false;
20376 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20377 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20378 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20379 CVec_u8Z_free(ret_var);
20383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20384 LDKu8slice ser_ref;
20385 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20386 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20387 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20388 *ret_conv = Init_read(ser_ref);
20389 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20390 return (uint64_t)ret_conv;
20393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20394 LDKOpenChannel obj_conv;
20395 obj_conv.inner = (void*)(obj & (~1));
20396 obj_conv.is_owned = false;
20397 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20398 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20399 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20400 CVec_u8Z_free(ret_var);
20404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20405 LDKu8slice ser_ref;
20406 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20407 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20408 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20409 *ret_conv = OpenChannel_read(ser_ref);
20410 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20411 return (uint64_t)ret_conv;
20414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20415 LDKRevokeAndACK obj_conv;
20416 obj_conv.inner = (void*)(obj & (~1));
20417 obj_conv.is_owned = false;
20418 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20419 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20420 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20421 CVec_u8Z_free(ret_var);
20425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20426 LDKu8slice ser_ref;
20427 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20428 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20429 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20430 *ret_conv = RevokeAndACK_read(ser_ref);
20431 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20432 return (uint64_t)ret_conv;
20435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20436 LDKShutdown obj_conv;
20437 obj_conv.inner = (void*)(obj & (~1));
20438 obj_conv.is_owned = false;
20439 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20440 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20441 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20442 CVec_u8Z_free(ret_var);
20446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20447 LDKu8slice ser_ref;
20448 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20449 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20450 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20451 *ret_conv = Shutdown_read(ser_ref);
20452 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20453 return (uint64_t)ret_conv;
20456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20457 LDKUpdateFailHTLC obj_conv;
20458 obj_conv.inner = (void*)(obj & (~1));
20459 obj_conv.is_owned = false;
20460 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20461 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20462 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20463 CVec_u8Z_free(ret_var);
20467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20468 LDKu8slice ser_ref;
20469 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20470 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20471 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20472 *ret_conv = UpdateFailHTLC_read(ser_ref);
20473 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20474 return (uint64_t)ret_conv;
20477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20478 LDKUpdateFailMalformedHTLC obj_conv;
20479 obj_conv.inner = (void*)(obj & (~1));
20480 obj_conv.is_owned = false;
20481 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20482 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20483 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20484 CVec_u8Z_free(ret_var);
20488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20489 LDKu8slice ser_ref;
20490 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20491 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20492 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20493 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20494 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20495 return (uint64_t)ret_conv;
20498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20499 LDKUpdateFee obj_conv;
20500 obj_conv.inner = (void*)(obj & (~1));
20501 obj_conv.is_owned = false;
20502 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20503 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20504 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20505 CVec_u8Z_free(ret_var);
20509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20510 LDKu8slice ser_ref;
20511 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20512 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20513 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20514 *ret_conv = UpdateFee_read(ser_ref);
20515 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20516 return (uint64_t)ret_conv;
20519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20520 LDKUpdateFulfillHTLC obj_conv;
20521 obj_conv.inner = (void*)(obj & (~1));
20522 obj_conv.is_owned = false;
20523 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20524 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20525 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20526 CVec_u8Z_free(ret_var);
20530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20531 LDKu8slice ser_ref;
20532 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20533 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20534 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20535 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20536 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20537 return (uint64_t)ret_conv;
20540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20541 LDKUpdateAddHTLC obj_conv;
20542 obj_conv.inner = (void*)(obj & (~1));
20543 obj_conv.is_owned = false;
20544 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20545 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20546 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20547 CVec_u8Z_free(ret_var);
20551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20552 LDKu8slice ser_ref;
20553 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20554 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20555 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20556 *ret_conv = UpdateAddHTLC_read(ser_ref);
20557 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20558 return (uint64_t)ret_conv;
20561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20563 obj_conv.inner = (void*)(obj & (~1));
20564 obj_conv.is_owned = false;
20565 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20566 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20567 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20568 CVec_u8Z_free(ret_var);
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20573 LDKu8slice ser_ref;
20574 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20575 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20576 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20577 *ret_conv = Ping_read(ser_ref);
20578 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20579 return (uint64_t)ret_conv;
20582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20584 obj_conv.inner = (void*)(obj & (~1));
20585 obj_conv.is_owned = false;
20586 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20589 CVec_u8Z_free(ret_var);
20593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20594 LDKu8slice ser_ref;
20595 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20596 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20597 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20598 *ret_conv = Pong_read(ser_ref);
20599 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20600 return (uint64_t)ret_conv;
20603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20604 LDKUnsignedChannelAnnouncement obj_conv;
20605 obj_conv.inner = (void*)(obj & (~1));
20606 obj_conv.is_owned = false;
20607 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20608 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20609 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20610 CVec_u8Z_free(ret_var);
20614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20615 LDKu8slice ser_ref;
20616 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20617 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20618 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20619 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20620 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20621 return (uint64_t)ret_conv;
20624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20625 LDKChannelAnnouncement obj_conv;
20626 obj_conv.inner = (void*)(obj & (~1));
20627 obj_conv.is_owned = false;
20628 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20629 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20630 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20631 CVec_u8Z_free(ret_var);
20635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20636 LDKu8slice ser_ref;
20637 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20638 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20639 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20640 *ret_conv = ChannelAnnouncement_read(ser_ref);
20641 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20642 return (uint64_t)ret_conv;
20645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20646 LDKUnsignedChannelUpdate obj_conv;
20647 obj_conv.inner = (void*)(obj & (~1));
20648 obj_conv.is_owned = false;
20649 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20650 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20651 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20652 CVec_u8Z_free(ret_var);
20656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20657 LDKu8slice ser_ref;
20658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20660 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20661 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20662 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20663 return (uint64_t)ret_conv;
20666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20667 LDKChannelUpdate obj_conv;
20668 obj_conv.inner = (void*)(obj & (~1));
20669 obj_conv.is_owned = false;
20670 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20673 CVec_u8Z_free(ret_var);
20677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20678 LDKu8slice ser_ref;
20679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20681 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20682 *ret_conv = ChannelUpdate_read(ser_ref);
20683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20684 return (uint64_t)ret_conv;
20687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20688 LDKErrorMessage obj_conv;
20689 obj_conv.inner = (void*)(obj & (~1));
20690 obj_conv.is_owned = false;
20691 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20692 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20693 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20694 CVec_u8Z_free(ret_var);
20698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20699 LDKu8slice ser_ref;
20700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20702 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20703 *ret_conv = ErrorMessage_read(ser_ref);
20704 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20705 return (uint64_t)ret_conv;
20708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20709 LDKUnsignedNodeAnnouncement obj_conv;
20710 obj_conv.inner = (void*)(obj & (~1));
20711 obj_conv.is_owned = false;
20712 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20713 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20714 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20715 CVec_u8Z_free(ret_var);
20719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20720 LDKu8slice ser_ref;
20721 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20722 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20723 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20724 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20725 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20726 return (uint64_t)ret_conv;
20729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20730 LDKNodeAnnouncement obj_conv;
20731 obj_conv.inner = (void*)(obj & (~1));
20732 obj_conv.is_owned = false;
20733 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20734 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20735 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20736 CVec_u8Z_free(ret_var);
20740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20741 LDKu8slice ser_ref;
20742 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20743 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20744 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20745 *ret_conv = NodeAnnouncement_read(ser_ref);
20746 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20747 return (uint64_t)ret_conv;
20750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20751 LDKu8slice ser_ref;
20752 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20753 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20754 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20755 *ret_conv = QueryShortChannelIds_read(ser_ref);
20756 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20757 return (uint64_t)ret_conv;
20760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20761 LDKQueryShortChannelIds obj_conv;
20762 obj_conv.inner = (void*)(obj & (~1));
20763 obj_conv.is_owned = false;
20764 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20765 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20766 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20767 CVec_u8Z_free(ret_var);
20771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20772 LDKu8slice ser_ref;
20773 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20774 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20775 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20776 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20778 return (uint64_t)ret_conv;
20781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20782 LDKReplyShortChannelIdsEnd obj_conv;
20783 obj_conv.inner = (void*)(obj & (~1));
20784 obj_conv.is_owned = false;
20785 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20786 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20787 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20788 CVec_u8Z_free(ret_var);
20792 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20793 LDKQueryChannelRange this_arg_conv;
20794 this_arg_conv.inner = (void*)(this_arg & (~1));
20795 this_arg_conv.is_owned = false;
20796 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20801 LDKu8slice ser_ref;
20802 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20803 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20804 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20805 *ret_conv = QueryChannelRange_read(ser_ref);
20806 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20807 return (uint64_t)ret_conv;
20810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20811 LDKQueryChannelRange obj_conv;
20812 obj_conv.inner = (void*)(obj & (~1));
20813 obj_conv.is_owned = false;
20814 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20815 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20816 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20817 CVec_u8Z_free(ret_var);
20821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20822 LDKu8slice ser_ref;
20823 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20824 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20825 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20826 *ret_conv = ReplyChannelRange_read(ser_ref);
20827 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20828 return (uint64_t)ret_conv;
20831 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20832 LDKReplyChannelRange obj_conv;
20833 obj_conv.inner = (void*)(obj & (~1));
20834 obj_conv.is_owned = false;
20835 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20836 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20837 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20838 CVec_u8Z_free(ret_var);
20842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20843 LDKu8slice ser_ref;
20844 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20845 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20846 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20847 *ret_conv = GossipTimestampFilter_read(ser_ref);
20848 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20849 return (uint64_t)ret_conv;
20852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20853 LDKGossipTimestampFilter obj_conv;
20854 obj_conv.inner = (void*)(obj & (~1));
20855 obj_conv.is_owned = false;
20856 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20857 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20858 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20859 CVec_u8Z_free(ret_var);
20863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20864 LDKIgnoringMessageHandler this_obj_conv;
20865 this_obj_conv.inner = (void*)(this_obj & (~1));
20866 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20867 IgnoringMessageHandler_free(this_obj_conv);
20870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20871 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20874 uint64_t ret_ref = (uint64_t)ret_var.inner;
20875 if (ret_var.is_owned) {
20881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20882 LDKIgnoringMessageHandler this_arg_conv;
20883 this_arg_conv.inner = (void*)(this_arg & (~1));
20884 this_arg_conv.is_owned = false;
20885 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20886 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20887 return (uint64_t)ret;
20890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20891 LDKIgnoringMessageHandler this_arg_conv;
20892 this_arg_conv.inner = (void*)(this_arg & (~1));
20893 this_arg_conv.is_owned = false;
20894 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20895 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20896 return (uint64_t)ret;
20899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20900 LDKErroringMessageHandler this_obj_conv;
20901 this_obj_conv.inner = (void*)(this_obj & (~1));
20902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20903 ErroringMessageHandler_free(this_obj_conv);
20906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20907 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20910 uint64_t ret_ref = (uint64_t)ret_var.inner;
20911 if (ret_var.is_owned) {
20917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20918 LDKErroringMessageHandler this_arg_conv;
20919 this_arg_conv.inner = (void*)(this_arg & (~1));
20920 this_arg_conv.is_owned = false;
20921 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20922 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20923 return (uint64_t)ret;
20926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20927 LDKErroringMessageHandler this_arg_conv;
20928 this_arg_conv.inner = (void*)(this_arg & (~1));
20929 this_arg_conv.is_owned = false;
20930 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20931 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20932 return (uint64_t)ret;
20935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20936 LDKMessageHandler this_obj_conv;
20937 this_obj_conv.inner = (void*)(this_obj & (~1));
20938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20939 MessageHandler_free(this_obj_conv);
20942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20943 LDKMessageHandler this_ptr_conv;
20944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20945 this_ptr_conv.is_owned = false;
20946 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20951 LDKMessageHandler this_ptr_conv;
20952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20953 this_ptr_conv.is_owned = false;
20954 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20955 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20956 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20957 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20959 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20963 LDKMessageHandler this_ptr_conv;
20964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20965 this_ptr_conv.is_owned = false;
20966 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20971 LDKMessageHandler this_ptr_conv;
20972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20973 this_ptr_conv.is_owned = false;
20974 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20975 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20976 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20977 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20979 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20982 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) {
20983 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20984 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20985 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20986 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20988 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20989 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20990 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20991 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20993 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20996 uint64_t ret_ref = (uint64_t)ret_var.inner;
20997 if (ret_var.is_owned) {
21003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21004 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
21005 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21006 *ret = SocketDescriptor_clone(orig_conv);
21007 return (uint64_t)ret;
21010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21011 if ((this_ptr & 1) != 0) return;
21012 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
21013 FREE((void*)this_ptr);
21014 SocketDescriptor_free(this_ptr_conv);
21017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21018 LDKPeerHandleError this_obj_conv;
21019 this_obj_conv.inner = (void*)(this_obj & (~1));
21020 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21021 PeerHandleError_free(this_obj_conv);
21024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
21025 LDKPeerHandleError this_ptr_conv;
21026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21027 this_ptr_conv.is_owned = false;
21028 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
21032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21033 LDKPeerHandleError this_ptr_conv;
21034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21035 this_ptr_conv.is_owned = false;
21036 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
21039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
21040 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
21041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21043 uint64_t ret_ref = (uint64_t)ret_var.inner;
21044 if (ret_var.is_owned) {
21050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21051 LDKPeerHandleError orig_conv;
21052 orig_conv.inner = (void*)(orig & (~1));
21053 orig_conv.is_owned = false;
21054 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
21055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21057 uint64_t ret_ref = (uint64_t)ret_var.inner;
21058 if (ret_var.is_owned) {
21064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21065 LDKPeerManager this_obj_conv;
21066 this_obj_conv.inner = (void*)(this_obj & (~1));
21067 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21068 PeerManager_free(this_obj_conv);
21071 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) {
21072 LDKMessageHandler message_handler_conv;
21073 message_handler_conv.inner = (void*)(message_handler & (~1));
21074 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
21075 // Warning: we need a move here but no clone is available for LDKMessageHandler
21076 LDKSecretKey our_node_secret_ref;
21077 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
21078 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
21079 unsigned char ephemeral_random_data_arr[32];
21080 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
21081 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
21082 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
21083 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21084 if (logger_conv.free == LDKLogger_JCalls_free) {
21085 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21086 LDKLogger_JCalls_clone(logger_conv.this_arg);
21088 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
21089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21091 uint64_t ret_ref = (uint64_t)ret_var.inner;
21092 if (ret_var.is_owned) {
21098 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
21099 LDKPeerManager this_arg_conv;
21100 this_arg_conv.inner = (void*)(this_arg & (~1));
21101 this_arg_conv.is_owned = false;
21102 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
21103 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
21105 for (size_t i = 0; i < ret_var.datalen; i++) {
21106 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
21107 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
21108 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
21110 FREE(ret_var.data);
21114 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) {
21115 LDKPeerManager this_arg_conv;
21116 this_arg_conv.inner = (void*)(this_arg & (~1));
21117 this_arg_conv.is_owned = false;
21118 LDKPublicKey their_node_id_ref;
21119 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21120 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21121 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21122 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21123 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21124 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
21126 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21127 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
21128 return (uint64_t)ret_conv;
21131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21132 LDKPeerManager this_arg_conv;
21133 this_arg_conv.inner = (void*)(this_arg & (~1));
21134 this_arg_conv.is_owned = false;
21135 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21136 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21137 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21138 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
21140 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21141 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
21142 return (uint64_t)ret_conv;
21145 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) {
21146 LDKPeerManager this_arg_conv;
21147 this_arg_conv.inner = (void*)(this_arg & (~1));
21148 this_arg_conv.is_owned = false;
21149 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21150 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21151 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
21152 return (uint64_t)ret_conv;
21155 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) {
21156 LDKPeerManager this_arg_conv;
21157 this_arg_conv.inner = (void*)(this_arg & (~1));
21158 this_arg_conv.is_owned = false;
21159 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
21160 LDKu8slice data_ref;
21161 data_ref.datalen = (*env)->GetArrayLength(env, data);
21162 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
21163 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21164 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
21165 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
21166 return (uint64_t)ret_conv;
21169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
21170 LDKPeerManager this_arg_conv;
21171 this_arg_conv.inner = (void*)(this_arg & (~1));
21172 this_arg_conv.is_owned = false;
21173 PeerManager_process_events(&this_arg_conv);
21176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21177 LDKPeerManager this_arg_conv;
21178 this_arg_conv.inner = (void*)(this_arg & (~1));
21179 this_arg_conv.is_owned = false;
21180 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21181 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
21184 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) {
21185 LDKPeerManager this_arg_conv;
21186 this_arg_conv.inner = (void*)(this_arg & (~1));
21187 this_arg_conv.is_owned = false;
21188 LDKPublicKey node_id_ref;
21189 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21190 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21191 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
21194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21195 LDKPeerManager this_arg_conv;
21196 this_arg_conv.inner = (void*)(this_arg & (~1));
21197 this_arg_conv.is_owned = false;
21198 PeerManager_timer_tick_occurred(&this_arg_conv);
21201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
21202 unsigned char commitment_seed_arr[32];
21203 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
21204 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
21205 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21206 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21207 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
21211 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) {
21212 LDKPublicKey per_commitment_point_ref;
21213 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21214 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21215 unsigned char base_secret_arr[32];
21216 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
21217 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
21218 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21219 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21220 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21221 return (uint64_t)ret_conv;
21224 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) {
21225 LDKPublicKey per_commitment_point_ref;
21226 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21227 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21228 LDKPublicKey base_point_ref;
21229 CHECK((*env)->GetArrayLength(env, base_point) == 33);
21230 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
21231 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21232 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21233 return (uint64_t)ret_conv;
21236 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) {
21237 unsigned char per_commitment_secret_arr[32];
21238 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
21239 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
21240 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21241 unsigned char countersignatory_revocation_base_secret_arr[32];
21242 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
21243 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
21244 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21245 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21246 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21247 return (uint64_t)ret_conv;
21250 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) {
21251 LDKPublicKey per_commitment_point_ref;
21252 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21253 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21254 LDKPublicKey countersignatory_revocation_base_point_ref;
21255 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
21256 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
21257 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21258 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21259 return (uint64_t)ret_conv;
21262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21263 LDKTxCreationKeys this_obj_conv;
21264 this_obj_conv.inner = (void*)(this_obj & (~1));
21265 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21266 TxCreationKeys_free(this_obj_conv);
21269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21270 LDKTxCreationKeys this_ptr_conv;
21271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21272 this_ptr_conv.is_owned = false;
21273 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21274 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
21278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21279 LDKTxCreationKeys this_ptr_conv;
21280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21281 this_ptr_conv.is_owned = false;
21282 LDKPublicKey val_ref;
21283 CHECK((*env)->GetArrayLength(env, val) == 33);
21284 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21285 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21289 LDKTxCreationKeys this_ptr_conv;
21290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21291 this_ptr_conv.is_owned = false;
21292 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
21297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21298 LDKTxCreationKeys this_ptr_conv;
21299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21300 this_ptr_conv.is_owned = false;
21301 LDKPublicKey val_ref;
21302 CHECK((*env)->GetArrayLength(env, val) == 33);
21303 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21304 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21308 LDKTxCreationKeys this_ptr_conv;
21309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21310 this_ptr_conv.is_owned = false;
21311 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21317 LDKTxCreationKeys this_ptr_conv;
21318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21319 this_ptr_conv.is_owned = false;
21320 LDKPublicKey val_ref;
21321 CHECK((*env)->GetArrayLength(env, val) == 33);
21322 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21323 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21327 LDKTxCreationKeys this_ptr_conv;
21328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21329 this_ptr_conv.is_owned = false;
21330 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21336 LDKTxCreationKeys this_ptr_conv;
21337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21338 this_ptr_conv.is_owned = false;
21339 LDKPublicKey val_ref;
21340 CHECK((*env)->GetArrayLength(env, val) == 33);
21341 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21342 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21346 LDKTxCreationKeys this_ptr_conv;
21347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21348 this_ptr_conv.is_owned = false;
21349 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21354 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) {
21355 LDKTxCreationKeys this_ptr_conv;
21356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21357 this_ptr_conv.is_owned = false;
21358 LDKPublicKey val_ref;
21359 CHECK((*env)->GetArrayLength(env, val) == 33);
21360 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21361 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21364 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) {
21365 LDKPublicKey per_commitment_point_arg_ref;
21366 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21367 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21368 LDKPublicKey revocation_key_arg_ref;
21369 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21370 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21371 LDKPublicKey broadcaster_htlc_key_arg_ref;
21372 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21373 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21374 LDKPublicKey countersignatory_htlc_key_arg_ref;
21375 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21376 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21377 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21378 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21379 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21380 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);
21381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21383 uint64_t ret_ref = (uint64_t)ret_var.inner;
21384 if (ret_var.is_owned) {
21390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21391 LDKTxCreationKeys orig_conv;
21392 orig_conv.inner = (void*)(orig & (~1));
21393 orig_conv.is_owned = false;
21394 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21397 uint64_t ret_ref = (uint64_t)ret_var.inner;
21398 if (ret_var.is_owned) {
21404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21405 LDKTxCreationKeys obj_conv;
21406 obj_conv.inner = (void*)(obj & (~1));
21407 obj_conv.is_owned = false;
21408 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21409 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21410 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21411 CVec_u8Z_free(ret_var);
21415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21416 LDKu8slice ser_ref;
21417 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21418 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21419 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21420 *ret_conv = TxCreationKeys_read(ser_ref);
21421 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21422 return (uint64_t)ret_conv;
21425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21426 LDKChannelPublicKeys this_obj_conv;
21427 this_obj_conv.inner = (void*)(this_obj & (~1));
21428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21429 ChannelPublicKeys_free(this_obj_conv);
21432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21433 LDKChannelPublicKeys this_ptr_conv;
21434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21435 this_ptr_conv.is_owned = false;
21436 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21437 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21442 LDKChannelPublicKeys this_ptr_conv;
21443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21444 this_ptr_conv.is_owned = false;
21445 LDKPublicKey val_ref;
21446 CHECK((*env)->GetArrayLength(env, val) == 33);
21447 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21448 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21452 LDKChannelPublicKeys this_ptr_conv;
21453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21454 this_ptr_conv.is_owned = false;
21455 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21456 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21461 LDKChannelPublicKeys this_ptr_conv;
21462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21463 this_ptr_conv.is_owned = false;
21464 LDKPublicKey val_ref;
21465 CHECK((*env)->GetArrayLength(env, val) == 33);
21466 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21467 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21471 LDKChannelPublicKeys this_ptr_conv;
21472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21473 this_ptr_conv.is_owned = false;
21474 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21475 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21480 LDKChannelPublicKeys this_ptr_conv;
21481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21482 this_ptr_conv.is_owned = false;
21483 LDKPublicKey val_ref;
21484 CHECK((*env)->GetArrayLength(env, val) == 33);
21485 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21486 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21490 LDKChannelPublicKeys this_ptr_conv;
21491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21492 this_ptr_conv.is_owned = false;
21493 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21494 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21499 LDKChannelPublicKeys this_ptr_conv;
21500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21501 this_ptr_conv.is_owned = false;
21502 LDKPublicKey val_ref;
21503 CHECK((*env)->GetArrayLength(env, val) == 33);
21504 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21505 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21509 LDKChannelPublicKeys this_ptr_conv;
21510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21511 this_ptr_conv.is_owned = false;
21512 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21513 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21518 LDKChannelPublicKeys this_ptr_conv;
21519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21520 this_ptr_conv.is_owned = false;
21521 LDKPublicKey val_ref;
21522 CHECK((*env)->GetArrayLength(env, val) == 33);
21523 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21524 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21527 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) {
21528 LDKPublicKey funding_pubkey_arg_ref;
21529 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21530 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21531 LDKPublicKey revocation_basepoint_arg_ref;
21532 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21533 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21534 LDKPublicKey payment_point_arg_ref;
21535 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21536 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21537 LDKPublicKey delayed_payment_basepoint_arg_ref;
21538 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21539 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21540 LDKPublicKey htlc_basepoint_arg_ref;
21541 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21542 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21543 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);
21544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21546 uint64_t ret_ref = (uint64_t)ret_var.inner;
21547 if (ret_var.is_owned) {
21553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21554 LDKChannelPublicKeys orig_conv;
21555 orig_conv.inner = (void*)(orig & (~1));
21556 orig_conv.is_owned = false;
21557 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21558 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21559 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21560 uint64_t ret_ref = (uint64_t)ret_var.inner;
21561 if (ret_var.is_owned) {
21567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21568 LDKChannelPublicKeys obj_conv;
21569 obj_conv.inner = (void*)(obj & (~1));
21570 obj_conv.is_owned = false;
21571 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21572 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21573 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21574 CVec_u8Z_free(ret_var);
21578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21579 LDKu8slice ser_ref;
21580 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21581 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21582 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21583 *ret_conv = ChannelPublicKeys_read(ser_ref);
21584 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21585 return (uint64_t)ret_conv;
21588 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) {
21589 LDKPublicKey per_commitment_point_ref;
21590 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21591 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21592 LDKPublicKey broadcaster_delayed_payment_base_ref;
21593 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21594 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21595 LDKPublicKey broadcaster_htlc_base_ref;
21596 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21597 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21598 LDKPublicKey countersignatory_revocation_base_ref;
21599 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21600 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21601 LDKPublicKey countersignatory_htlc_base_ref;
21602 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21603 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21604 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21605 *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);
21606 return (uint64_t)ret_conv;
21609 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) {
21610 LDKPublicKey per_commitment_point_ref;
21611 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21612 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21613 LDKChannelPublicKeys broadcaster_keys_conv;
21614 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21615 broadcaster_keys_conv.is_owned = false;
21616 LDKChannelPublicKeys countersignatory_keys_conv;
21617 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21618 countersignatory_keys_conv.is_owned = false;
21619 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21620 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21621 return (uint64_t)ret_conv;
21624 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) {
21625 LDKPublicKey revocation_key_ref;
21626 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21627 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21628 LDKPublicKey broadcaster_delayed_payment_key_ref;
21629 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21630 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21631 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21632 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21633 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21634 CVec_u8Z_free(ret_var);
21638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21639 LDKHTLCOutputInCommitment this_obj_conv;
21640 this_obj_conv.inner = (void*)(this_obj & (~1));
21641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21642 HTLCOutputInCommitment_free(this_obj_conv);
21645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21646 LDKHTLCOutputInCommitment this_ptr_conv;
21647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21648 this_ptr_conv.is_owned = false;
21649 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21654 LDKHTLCOutputInCommitment this_ptr_conv;
21655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21656 this_ptr_conv.is_owned = false;
21657 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21661 LDKHTLCOutputInCommitment this_ptr_conv;
21662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21663 this_ptr_conv.is_owned = false;
21664 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21669 LDKHTLCOutputInCommitment this_ptr_conv;
21670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21671 this_ptr_conv.is_owned = false;
21672 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21675 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21676 LDKHTLCOutputInCommitment this_ptr_conv;
21677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21678 this_ptr_conv.is_owned = false;
21679 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21684 LDKHTLCOutputInCommitment this_ptr_conv;
21685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21686 this_ptr_conv.is_owned = false;
21687 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21691 LDKHTLCOutputInCommitment this_ptr_conv;
21692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21693 this_ptr_conv.is_owned = false;
21694 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21695 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21700 LDKHTLCOutputInCommitment this_ptr_conv;
21701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21702 this_ptr_conv.is_owned = false;
21703 LDKThirtyTwoBytes val_ref;
21704 CHECK((*env)->GetArrayLength(env, val) == 32);
21705 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21706 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21710 LDKHTLCOutputInCommitment this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21714 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21715 uint64_t ret_ref = (uint64_t)ret_copy;
21719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21720 LDKHTLCOutputInCommitment this_ptr_conv;
21721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21722 this_ptr_conv.is_owned = false;
21723 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21724 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21727 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) {
21728 LDKThirtyTwoBytes payment_hash_arg_ref;
21729 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21730 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21731 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21732 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21735 uint64_t ret_ref = (uint64_t)ret_var.inner;
21736 if (ret_var.is_owned) {
21742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21743 LDKHTLCOutputInCommitment orig_conv;
21744 orig_conv.inner = (void*)(orig & (~1));
21745 orig_conv.is_owned = false;
21746 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21749 uint64_t ret_ref = (uint64_t)ret_var.inner;
21750 if (ret_var.is_owned) {
21756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21757 LDKHTLCOutputInCommitment obj_conv;
21758 obj_conv.inner = (void*)(obj & (~1));
21759 obj_conv.is_owned = false;
21760 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21761 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21762 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21763 CVec_u8Z_free(ret_var);
21767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21768 LDKu8slice ser_ref;
21769 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21770 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21771 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21772 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21773 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21774 return (uint64_t)ret_conv;
21777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21778 LDKHTLCOutputInCommitment htlc_conv;
21779 htlc_conv.inner = (void*)(htlc & (~1));
21780 htlc_conv.is_owned = false;
21781 LDKTxCreationKeys keys_conv;
21782 keys_conv.inner = (void*)(keys & (~1));
21783 keys_conv.is_owned = false;
21784 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21785 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21786 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21787 CVec_u8Z_free(ret_var);
21791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21792 LDKPublicKey broadcaster_ref;
21793 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21794 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21795 LDKPublicKey countersignatory_ref;
21796 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21797 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21798 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21799 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21800 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21801 CVec_u8Z_free(ret_var);
21805 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) {
21806 unsigned char commitment_txid_arr[32];
21807 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21808 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21809 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21810 LDKHTLCOutputInCommitment htlc_conv;
21811 htlc_conv.inner = (void*)(htlc & (~1));
21812 htlc_conv.is_owned = false;
21813 LDKPublicKey broadcaster_delayed_payment_key_ref;
21814 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21815 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21816 LDKPublicKey revocation_key_ref;
21817 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21818 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21819 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21820 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21821 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21822 Transaction_free(ret_var);
21826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21827 LDKChannelTransactionParameters this_obj_conv;
21828 this_obj_conv.inner = (void*)(this_obj & (~1));
21829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21830 ChannelTransactionParameters_free(this_obj_conv);
21833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21834 LDKChannelTransactionParameters this_ptr_conv;
21835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21836 this_ptr_conv.is_owned = false;
21837 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21838 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21839 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21840 uint64_t ret_ref = (uint64_t)ret_var.inner;
21841 if (ret_var.is_owned) {
21847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21848 LDKChannelTransactionParameters this_ptr_conv;
21849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21850 this_ptr_conv.is_owned = false;
21851 LDKChannelPublicKeys val_conv;
21852 val_conv.inner = (void*)(val & (~1));
21853 val_conv.is_owned = (val & 1) || (val == 0);
21854 val_conv = ChannelPublicKeys_clone(&val_conv);
21855 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21858 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21859 LDKChannelTransactionParameters this_ptr_conv;
21860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21861 this_ptr_conv.is_owned = false;
21862 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21866 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) {
21867 LDKChannelTransactionParameters this_ptr_conv;
21868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21869 this_ptr_conv.is_owned = false;
21870 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21874 LDKChannelTransactionParameters this_ptr_conv;
21875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21876 this_ptr_conv.is_owned = false;
21877 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21882 LDKChannelTransactionParameters this_ptr_conv;
21883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21884 this_ptr_conv.is_owned = false;
21885 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21889 LDKChannelTransactionParameters this_ptr_conv;
21890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21891 this_ptr_conv.is_owned = false;
21892 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21895 uint64_t ret_ref = (uint64_t)ret_var.inner;
21896 if (ret_var.is_owned) {
21902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21903 LDKChannelTransactionParameters this_ptr_conv;
21904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21905 this_ptr_conv.is_owned = false;
21906 LDKCounterpartyChannelTransactionParameters val_conv;
21907 val_conv.inner = (void*)(val & (~1));
21908 val_conv.is_owned = (val & 1) || (val == 0);
21909 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21910 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21914 LDKChannelTransactionParameters this_ptr_conv;
21915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21916 this_ptr_conv.is_owned = false;
21917 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21920 uint64_t ret_ref = (uint64_t)ret_var.inner;
21921 if (ret_var.is_owned) {
21927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21928 LDKChannelTransactionParameters this_ptr_conv;
21929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21930 this_ptr_conv.is_owned = false;
21931 LDKOutPoint val_conv;
21932 val_conv.inner = (void*)(val & (~1));
21933 val_conv.is_owned = (val & 1) || (val == 0);
21934 val_conv = OutPoint_clone(&val_conv);
21935 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21938 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) {
21939 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21940 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21941 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21942 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21943 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21944 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21945 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21946 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21947 LDKOutPoint funding_outpoint_arg_conv;
21948 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21949 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21950 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21951 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);
21952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21954 uint64_t ret_ref = (uint64_t)ret_var.inner;
21955 if (ret_var.is_owned) {
21961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21962 LDKChannelTransactionParameters orig_conv;
21963 orig_conv.inner = (void*)(orig & (~1));
21964 orig_conv.is_owned = false;
21965 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21968 uint64_t ret_ref = (uint64_t)ret_var.inner;
21969 if (ret_var.is_owned) {
21975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21976 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21977 this_obj_conv.inner = (void*)(this_obj & (~1));
21978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21979 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21983 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21985 this_ptr_conv.is_owned = false;
21986 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21989 uint64_t ret_ref = (uint64_t)ret_var.inner;
21990 if (ret_var.is_owned) {
21996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21997 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21999 this_ptr_conv.is_owned = false;
22000 LDKChannelPublicKeys val_conv;
22001 val_conv.inner = (void*)(val & (~1));
22002 val_conv.is_owned = (val & 1) || (val == 0);
22003 val_conv = ChannelPublicKeys_clone(&val_conv);
22004 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
22007 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22008 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22010 this_ptr_conv.is_owned = false;
22011 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
22015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22016 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22018 this_ptr_conv.is_owned = false;
22019 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
22022 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) {
22023 LDKChannelPublicKeys pubkeys_arg_conv;
22024 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
22025 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
22026 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
22027 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
22028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22030 uint64_t ret_ref = (uint64_t)ret_var.inner;
22031 if (ret_var.is_owned) {
22037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22038 LDKCounterpartyChannelTransactionParameters orig_conv;
22039 orig_conv.inner = (void*)(orig & (~1));
22040 orig_conv.is_owned = false;
22041 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
22042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22044 uint64_t ret_ref = (uint64_t)ret_var.inner;
22045 if (ret_var.is_owned) {
22051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
22052 LDKChannelTransactionParameters this_arg_conv;
22053 this_arg_conv.inner = (void*)(this_arg & (~1));
22054 this_arg_conv.is_owned = false;
22055 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
22059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22060 LDKChannelTransactionParameters this_arg_conv;
22061 this_arg_conv.inner = (void*)(this_arg & (~1));
22062 this_arg_conv.is_owned = false;
22063 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
22064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22066 uint64_t ret_ref = (uint64_t)ret_var.inner;
22067 if (ret_var.is_owned) {
22073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22074 LDKChannelTransactionParameters this_arg_conv;
22075 this_arg_conv.inner = (void*)(this_arg & (~1));
22076 this_arg_conv.is_owned = false;
22077 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
22078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22080 uint64_t ret_ref = (uint64_t)ret_var.inner;
22081 if (ret_var.is_owned) {
22087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22088 LDKCounterpartyChannelTransactionParameters obj_conv;
22089 obj_conv.inner = (void*)(obj & (~1));
22090 obj_conv.is_owned = false;
22091 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
22092 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22093 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22094 CVec_u8Z_free(ret_var);
22098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22099 LDKu8slice ser_ref;
22100 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22101 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22102 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
22103 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
22104 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22105 return (uint64_t)ret_conv;
22108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22109 LDKChannelTransactionParameters obj_conv;
22110 obj_conv.inner = (void*)(obj & (~1));
22111 obj_conv.is_owned = false;
22112 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
22113 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22114 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22115 CVec_u8Z_free(ret_var);
22119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22120 LDKu8slice ser_ref;
22121 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22122 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22123 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
22124 *ret_conv = ChannelTransactionParameters_read(ser_ref);
22125 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22126 return (uint64_t)ret_conv;
22129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22130 LDKDirectedChannelTransactionParameters this_obj_conv;
22131 this_obj_conv.inner = (void*)(this_obj & (~1));
22132 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22133 DirectedChannelTransactionParameters_free(this_obj_conv);
22136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22137 LDKDirectedChannelTransactionParameters this_arg_conv;
22138 this_arg_conv.inner = (void*)(this_arg & (~1));
22139 this_arg_conv.is_owned = false;
22140 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
22141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22143 uint64_t ret_ref = (uint64_t)ret_var.inner;
22144 if (ret_var.is_owned) {
22150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22151 LDKDirectedChannelTransactionParameters this_arg_conv;
22152 this_arg_conv.inner = (void*)(this_arg & (~1));
22153 this_arg_conv.is_owned = false;
22154 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
22158 if (ret_var.is_owned) {
22164 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
22165 LDKDirectedChannelTransactionParameters this_arg_conv;
22166 this_arg_conv.inner = (void*)(this_arg & (~1));
22167 this_arg_conv.is_owned = false;
22168 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
22172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
22173 LDKDirectedChannelTransactionParameters this_arg_conv;
22174 this_arg_conv.inner = (void*)(this_arg & (~1));
22175 this_arg_conv.is_owned = false;
22176 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
22181 LDKDirectedChannelTransactionParameters this_arg_conv;
22182 this_arg_conv.inner = (void*)(this_arg & (~1));
22183 this_arg_conv.is_owned = false;
22184 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22187 uint64_t ret_ref = (uint64_t)ret_var.inner;
22188 if (ret_var.is_owned) {
22194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22195 LDKHolderCommitmentTransaction this_obj_conv;
22196 this_obj_conv.inner = (void*)(this_obj & (~1));
22197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22198 HolderCommitmentTransaction_free(this_obj_conv);
22201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
22202 LDKHolderCommitmentTransaction this_ptr_conv;
22203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22204 this_ptr_conv.is_owned = false;
22205 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22206 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
22210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22211 LDKHolderCommitmentTransaction this_ptr_conv;
22212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22213 this_ptr_conv.is_owned = false;
22214 LDKSignature val_ref;
22215 CHECK((*env)->GetArrayLength(env, val) == 64);
22216 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22217 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22221 LDKHolderCommitmentTransaction this_ptr_conv;
22222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22223 this_ptr_conv.is_owned = false;
22224 LDKCVec_SignatureZ val_constr;
22225 val_constr.datalen = (*env)->GetArrayLength(env, val);
22226 if (val_constr.datalen > 0)
22227 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22229 val_constr.data = NULL;
22230 for (size_t i = 0; i < val_constr.datalen; i++) {
22231 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
22232 LDKSignature val_conv_8_ref;
22233 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
22234 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
22235 val_constr.data[i] = val_conv_8_ref;
22237 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22241 LDKHolderCommitmentTransaction orig_conv;
22242 orig_conv.inner = (void*)(orig & (~1));
22243 orig_conv.is_owned = false;
22244 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22247 uint64_t ret_ref = (uint64_t)ret_var.inner;
22248 if (ret_var.is_owned) {
22254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22255 LDKHolderCommitmentTransaction obj_conv;
22256 obj_conv.inner = (void*)(obj & (~1));
22257 obj_conv.is_owned = false;
22258 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22259 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22260 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22261 CVec_u8Z_free(ret_var);
22265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22266 LDKu8slice ser_ref;
22267 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22268 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22269 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22270 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22271 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22272 return (uint64_t)ret_conv;
22275 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) {
22276 LDKCommitmentTransaction commitment_tx_conv;
22277 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22278 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22279 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22280 LDKSignature counterparty_sig_ref;
22281 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
22282 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
22283 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22284 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
22285 if (counterparty_htlc_sigs_constr.datalen > 0)
22286 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22288 counterparty_htlc_sigs_constr.data = NULL;
22289 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
22290 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
22291 LDKSignature counterparty_htlc_sigs_conv_8_ref;
22292 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
22293 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
22294 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
22296 LDKPublicKey holder_funding_key_ref;
22297 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
22298 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
22299 LDKPublicKey counterparty_funding_key_ref;
22300 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22301 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22302 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22305 uint64_t ret_ref = (uint64_t)ret_var.inner;
22306 if (ret_var.is_owned) {
22312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22313 LDKBuiltCommitmentTransaction this_obj_conv;
22314 this_obj_conv.inner = (void*)(this_obj & (~1));
22315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22316 BuiltCommitmentTransaction_free(this_obj_conv);
22319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22320 LDKBuiltCommitmentTransaction this_ptr_conv;
22321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22322 this_ptr_conv.is_owned = false;
22323 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22324 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22325 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22326 Transaction_free(ret_var);
22330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22331 LDKBuiltCommitmentTransaction this_ptr_conv;
22332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22333 this_ptr_conv.is_owned = false;
22334 LDKTransaction val_ref;
22335 val_ref.datalen = (*env)->GetArrayLength(env, val);
22336 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22337 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22338 val_ref.data_is_owned = true;
22339 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22343 LDKBuiltCommitmentTransaction this_ptr_conv;
22344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22345 this_ptr_conv.is_owned = false;
22346 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22347 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22352 LDKBuiltCommitmentTransaction this_ptr_conv;
22353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22354 this_ptr_conv.is_owned = false;
22355 LDKThirtyTwoBytes val_ref;
22356 CHECK((*env)->GetArrayLength(env, val) == 32);
22357 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22358 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22362 LDKTransaction transaction_arg_ref;
22363 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22364 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22365 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22366 transaction_arg_ref.data_is_owned = true;
22367 LDKThirtyTwoBytes txid_arg_ref;
22368 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22369 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22370 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22373 uint64_t ret_ref = (uint64_t)ret_var.inner;
22374 if (ret_var.is_owned) {
22380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22381 LDKBuiltCommitmentTransaction orig_conv;
22382 orig_conv.inner = (void*)(orig & (~1));
22383 orig_conv.is_owned = false;
22384 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22387 uint64_t ret_ref = (uint64_t)ret_var.inner;
22388 if (ret_var.is_owned) {
22394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22395 LDKBuiltCommitmentTransaction obj_conv;
22396 obj_conv.inner = (void*)(obj & (~1));
22397 obj_conv.is_owned = false;
22398 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22399 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22400 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22401 CVec_u8Z_free(ret_var);
22405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22406 LDKu8slice ser_ref;
22407 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22408 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22409 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22410 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22411 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22412 return (uint64_t)ret_conv;
22415 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) {
22416 LDKBuiltCommitmentTransaction this_arg_conv;
22417 this_arg_conv.inner = (void*)(this_arg & (~1));
22418 this_arg_conv.is_owned = false;
22419 LDKu8slice funding_redeemscript_ref;
22420 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22421 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22422 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22423 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22424 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22428 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) {
22429 LDKBuiltCommitmentTransaction this_arg_conv;
22430 this_arg_conv.inner = (void*)(this_arg & (~1));
22431 this_arg_conv.is_owned = false;
22432 unsigned char funding_key_arr[32];
22433 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22434 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22435 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22436 LDKu8slice funding_redeemscript_ref;
22437 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22438 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22439 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22441 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22446 LDKCommitmentTransaction this_obj_conv;
22447 this_obj_conv.inner = (void*)(this_obj & (~1));
22448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22449 CommitmentTransaction_free(this_obj_conv);
22452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22453 LDKCommitmentTransaction orig_conv;
22454 orig_conv.inner = (void*)(orig & (~1));
22455 orig_conv.is_owned = false;
22456 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22459 uint64_t ret_ref = (uint64_t)ret_var.inner;
22460 if (ret_var.is_owned) {
22466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22467 LDKCommitmentTransaction obj_conv;
22468 obj_conv.inner = (void*)(obj & (~1));
22469 obj_conv.is_owned = false;
22470 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22471 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22472 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22473 CVec_u8Z_free(ret_var);
22477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22478 LDKu8slice ser_ref;
22479 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22480 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22481 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22482 *ret_conv = CommitmentTransaction_read(ser_ref);
22483 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22484 return (uint64_t)ret_conv;
22487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22488 LDKCommitmentTransaction this_arg_conv;
22489 this_arg_conv.inner = (void*)(this_arg & (~1));
22490 this_arg_conv.is_owned = false;
22491 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22496 LDKCommitmentTransaction this_arg_conv;
22497 this_arg_conv.inner = (void*)(this_arg & (~1));
22498 this_arg_conv.is_owned = false;
22499 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22504 LDKCommitmentTransaction this_arg_conv;
22505 this_arg_conv.inner = (void*)(this_arg & (~1));
22506 this_arg_conv.is_owned = false;
22507 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22511 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22512 LDKCommitmentTransaction this_arg_conv;
22513 this_arg_conv.inner = (void*)(this_arg & (~1));
22514 this_arg_conv.is_owned = false;
22515 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22520 LDKCommitmentTransaction this_arg_conv;
22521 this_arg_conv.inner = (void*)(this_arg & (~1));
22522 this_arg_conv.is_owned = false;
22523 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22526 uint64_t ret_ref = (uint64_t)ret_var.inner;
22527 if (ret_var.is_owned) {
22533 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) {
22534 LDKCommitmentTransaction this_arg_conv;
22535 this_arg_conv.inner = (void*)(this_arg & (~1));
22536 this_arg_conv.is_owned = false;
22537 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22538 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22539 channel_parameters_conv.is_owned = false;
22540 LDKChannelPublicKeys broadcaster_keys_conv;
22541 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22542 broadcaster_keys_conv.is_owned = false;
22543 LDKChannelPublicKeys countersignatory_keys_conv;
22544 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22545 countersignatory_keys_conv.is_owned = false;
22546 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22547 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22548 return (uint64_t)ret_conv;
22551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22552 LDKTrustedCommitmentTransaction this_obj_conv;
22553 this_obj_conv.inner = (void*)(this_obj & (~1));
22554 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22555 TrustedCommitmentTransaction_free(this_obj_conv);
22558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22559 LDKTrustedCommitmentTransaction this_arg_conv;
22560 this_arg_conv.inner = (void*)(this_arg & (~1));
22561 this_arg_conv.is_owned = false;
22562 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22563 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22568 LDKTrustedCommitmentTransaction this_arg_conv;
22569 this_arg_conv.inner = (void*)(this_arg & (~1));
22570 this_arg_conv.is_owned = false;
22571 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22572 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22573 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22574 uint64_t ret_ref = (uint64_t)ret_var.inner;
22575 if (ret_var.is_owned) {
22581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22582 LDKTrustedCommitmentTransaction this_arg_conv;
22583 this_arg_conv.inner = (void*)(this_arg & (~1));
22584 this_arg_conv.is_owned = false;
22585 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22588 uint64_t ret_ref = (uint64_t)ret_var.inner;
22589 if (ret_var.is_owned) {
22595 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) {
22596 LDKTrustedCommitmentTransaction this_arg_conv;
22597 this_arg_conv.inner = (void*)(this_arg & (~1));
22598 this_arg_conv.is_owned = false;
22599 unsigned char htlc_base_key_arr[32];
22600 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22601 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22602 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22603 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22604 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22605 channel_parameters_conv.is_owned = false;
22606 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22607 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22608 return (uint64_t)ret_conv;
22611 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) {
22612 LDKPublicKey broadcaster_payment_basepoint_ref;
22613 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22614 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22615 LDKPublicKey countersignatory_payment_basepoint_ref;
22616 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22617 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22618 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22623 LDKInitFeatures a_conv;
22624 a_conv.inner = (void*)(a & (~1));
22625 a_conv.is_owned = false;
22626 LDKInitFeatures b_conv;
22627 b_conv.inner = (void*)(b & (~1));
22628 b_conv.is_owned = false;
22629 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22634 LDKNodeFeatures a_conv;
22635 a_conv.inner = (void*)(a & (~1));
22636 a_conv.is_owned = false;
22637 LDKNodeFeatures b_conv;
22638 b_conv.inner = (void*)(b & (~1));
22639 b_conv.is_owned = false;
22640 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22645 LDKChannelFeatures a_conv;
22646 a_conv.inner = (void*)(a & (~1));
22647 a_conv.is_owned = false;
22648 LDKChannelFeatures b_conv;
22649 b_conv.inner = (void*)(b & (~1));
22650 b_conv.is_owned = false;
22651 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22656 LDKInvoiceFeatures a_conv;
22657 a_conv.inner = (void*)(a & (~1));
22658 a_conv.is_owned = false;
22659 LDKInvoiceFeatures b_conv;
22660 b_conv.inner = (void*)(b & (~1));
22661 b_conv.is_owned = false;
22662 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22667 LDKInitFeatures orig_conv;
22668 orig_conv.inner = (void*)(orig & (~1));
22669 orig_conv.is_owned = false;
22670 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22673 uint64_t ret_ref = (uint64_t)ret_var.inner;
22674 if (ret_var.is_owned) {
22680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22681 LDKNodeFeatures orig_conv;
22682 orig_conv.inner = (void*)(orig & (~1));
22683 orig_conv.is_owned = false;
22684 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22687 uint64_t ret_ref = (uint64_t)ret_var.inner;
22688 if (ret_var.is_owned) {
22694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22695 LDKChannelFeatures orig_conv;
22696 orig_conv.inner = (void*)(orig & (~1));
22697 orig_conv.is_owned = false;
22698 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22701 uint64_t ret_ref = (uint64_t)ret_var.inner;
22702 if (ret_var.is_owned) {
22708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22709 LDKInvoiceFeatures orig_conv;
22710 orig_conv.inner = (void*)(orig & (~1));
22711 orig_conv.is_owned = false;
22712 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22715 uint64_t ret_ref = (uint64_t)ret_var.inner;
22716 if (ret_var.is_owned) {
22722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22723 LDKInitFeatures this_obj_conv;
22724 this_obj_conv.inner = (void*)(this_obj & (~1));
22725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22726 InitFeatures_free(this_obj_conv);
22729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22730 LDKNodeFeatures this_obj_conv;
22731 this_obj_conv.inner = (void*)(this_obj & (~1));
22732 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22733 NodeFeatures_free(this_obj_conv);
22736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22737 LDKChannelFeatures this_obj_conv;
22738 this_obj_conv.inner = (void*)(this_obj & (~1));
22739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22740 ChannelFeatures_free(this_obj_conv);
22743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22744 LDKInvoiceFeatures this_obj_conv;
22745 this_obj_conv.inner = (void*)(this_obj & (~1));
22746 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22747 InvoiceFeatures_free(this_obj_conv);
22750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22751 LDKInitFeatures ret_var = InitFeatures_empty();
22752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22754 uint64_t ret_ref = (uint64_t)ret_var.inner;
22755 if (ret_var.is_owned) {
22761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22762 LDKInitFeatures ret_var = InitFeatures_known();
22763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22765 uint64_t ret_ref = (uint64_t)ret_var.inner;
22766 if (ret_var.is_owned) {
22772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22773 LDKNodeFeatures ret_var = NodeFeatures_empty();
22774 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22775 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22776 uint64_t ret_ref = (uint64_t)ret_var.inner;
22777 if (ret_var.is_owned) {
22783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22784 LDKNodeFeatures ret_var = NodeFeatures_known();
22785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22787 uint64_t ret_ref = (uint64_t)ret_var.inner;
22788 if (ret_var.is_owned) {
22794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22795 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22798 uint64_t ret_ref = (uint64_t)ret_var.inner;
22799 if (ret_var.is_owned) {
22805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22806 LDKChannelFeatures ret_var = ChannelFeatures_known();
22807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22809 uint64_t ret_ref = (uint64_t)ret_var.inner;
22810 if (ret_var.is_owned) {
22816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22817 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22820 uint64_t ret_ref = (uint64_t)ret_var.inner;
22821 if (ret_var.is_owned) {
22827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22828 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22831 uint64_t ret_ref = (uint64_t)ret_var.inner;
22832 if (ret_var.is_owned) {
22838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22839 LDKInitFeatures this_arg_conv;
22840 this_arg_conv.inner = (void*)(this_arg & (~1));
22841 this_arg_conv.is_owned = false;
22842 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22847 LDKNodeFeatures this_arg_conv;
22848 this_arg_conv.inner = (void*)(this_arg & (~1));
22849 this_arg_conv.is_owned = false;
22850 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22855 LDKInvoiceFeatures this_arg_conv;
22856 this_arg_conv.inner = (void*)(this_arg & (~1));
22857 this_arg_conv.is_owned = false;
22858 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22863 LDKInitFeatures obj_conv;
22864 obj_conv.inner = (void*)(obj & (~1));
22865 obj_conv.is_owned = false;
22866 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22867 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22868 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22869 CVec_u8Z_free(ret_var);
22873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22874 LDKNodeFeatures obj_conv;
22875 obj_conv.inner = (void*)(obj & (~1));
22876 obj_conv.is_owned = false;
22877 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22878 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22879 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22880 CVec_u8Z_free(ret_var);
22884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22885 LDKChannelFeatures obj_conv;
22886 obj_conv.inner = (void*)(obj & (~1));
22887 obj_conv.is_owned = false;
22888 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22889 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22890 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22891 CVec_u8Z_free(ret_var);
22895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22896 LDKInvoiceFeatures obj_conv;
22897 obj_conv.inner = (void*)(obj & (~1));
22898 obj_conv.is_owned = false;
22899 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22900 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22901 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22902 CVec_u8Z_free(ret_var);
22906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22907 LDKu8slice ser_ref;
22908 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22909 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22910 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22911 *ret_conv = InitFeatures_read(ser_ref);
22912 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22913 return (uint64_t)ret_conv;
22916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22917 LDKu8slice ser_ref;
22918 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22919 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22920 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22921 *ret_conv = NodeFeatures_read(ser_ref);
22922 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22923 return (uint64_t)ret_conv;
22926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22927 LDKu8slice ser_ref;
22928 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22929 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22930 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22931 *ret_conv = ChannelFeatures_read(ser_ref);
22932 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22933 return (uint64_t)ret_conv;
22936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22937 LDKu8slice ser_ref;
22938 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22939 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22940 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22941 *ret_conv = InvoiceFeatures_read(ser_ref);
22942 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22943 return (uint64_t)ret_conv;
22946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22947 LDKRouteHop this_obj_conv;
22948 this_obj_conv.inner = (void*)(this_obj & (~1));
22949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22950 RouteHop_free(this_obj_conv);
22953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22954 LDKRouteHop this_ptr_conv;
22955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22956 this_ptr_conv.is_owned = false;
22957 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22958 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22963 LDKRouteHop this_ptr_conv;
22964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22965 this_ptr_conv.is_owned = false;
22966 LDKPublicKey val_ref;
22967 CHECK((*env)->GetArrayLength(env, val) == 33);
22968 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22969 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22973 LDKRouteHop this_ptr_conv;
22974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22975 this_ptr_conv.is_owned = false;
22976 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
22977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22979 uint64_t ret_ref = (uint64_t)ret_var.inner;
22980 if (ret_var.is_owned) {
22986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22987 LDKRouteHop this_ptr_conv;
22988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22989 this_ptr_conv.is_owned = false;
22990 LDKNodeFeatures val_conv;
22991 val_conv.inner = (void*)(val & (~1));
22992 val_conv.is_owned = (val & 1) || (val == 0);
22993 val_conv = NodeFeatures_clone(&val_conv);
22994 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22998 LDKRouteHop this_ptr_conv;
22999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23000 this_ptr_conv.is_owned = false;
23001 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23006 LDKRouteHop this_ptr_conv;
23007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23008 this_ptr_conv.is_owned = false;
23009 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23013 LDKRouteHop this_ptr_conv;
23014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23015 this_ptr_conv.is_owned = false;
23016 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23017 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23018 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23019 uint64_t ret_ref = (uint64_t)ret_var.inner;
23020 if (ret_var.is_owned) {
23026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23027 LDKRouteHop this_ptr_conv;
23028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23029 this_ptr_conv.is_owned = false;
23030 LDKChannelFeatures val_conv;
23031 val_conv.inner = (void*)(val & (~1));
23032 val_conv.is_owned = (val & 1) || (val == 0);
23033 val_conv = ChannelFeatures_clone(&val_conv);
23034 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23038 LDKRouteHop this_ptr_conv;
23039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23040 this_ptr_conv.is_owned = false;
23041 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23046 LDKRouteHop this_ptr_conv;
23047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23048 this_ptr_conv.is_owned = false;
23049 RouteHop_set_fee_msat(&this_ptr_conv, val);
23052 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23053 LDKRouteHop this_ptr_conv;
23054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23055 this_ptr_conv.is_owned = false;
23056 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23061 LDKRouteHop this_ptr_conv;
23062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23063 this_ptr_conv.is_owned = false;
23064 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23067 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) {
23068 LDKPublicKey pubkey_arg_ref;
23069 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
23070 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
23071 LDKNodeFeatures node_features_arg_conv;
23072 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23073 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23074 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23075 LDKChannelFeatures channel_features_arg_conv;
23076 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23077 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23078 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23079 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);
23080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23082 uint64_t ret_ref = (uint64_t)ret_var.inner;
23083 if (ret_var.is_owned) {
23089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23090 LDKRouteHop orig_conv;
23091 orig_conv.inner = (void*)(orig & (~1));
23092 orig_conv.is_owned = false;
23093 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23096 uint64_t ret_ref = (uint64_t)ret_var.inner;
23097 if (ret_var.is_owned) {
23103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
23104 LDKRouteHop obj_conv;
23105 obj_conv.inner = (void*)(obj & (~1));
23106 obj_conv.is_owned = false;
23107 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23108 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23109 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23110 CVec_u8Z_free(ret_var);
23114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23115 LDKu8slice ser_ref;
23116 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23117 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23118 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23119 *ret_conv = RouteHop_read(ser_ref);
23120 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23121 return (uint64_t)ret_conv;
23124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23125 LDKRoute this_obj_conv;
23126 this_obj_conv.inner = (void*)(this_obj & (~1));
23127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23128 Route_free(this_obj_conv);
23131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23132 LDKRoute this_ptr_conv;
23133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23134 this_ptr_conv.is_owned = false;
23135 LDKCVec_CVec_RouteHopZZ val_constr;
23136 val_constr.datalen = (*env)->GetArrayLength(env, val);
23137 if (val_constr.datalen > 0)
23138 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23140 val_constr.data = NULL;
23141 for (size_t m = 0; m < val_constr.datalen; m++) {
23142 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
23143 LDKCVec_RouteHopZ val_conv_12_constr;
23144 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
23145 if (val_conv_12_constr.datalen > 0)
23146 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23148 val_conv_12_constr.data = NULL;
23149 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
23150 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23151 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
23152 LDKRouteHop val_conv_12_conv_10_conv;
23153 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23154 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23155 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23156 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23158 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
23159 val_constr.data[m] = val_conv_12_constr;
23161 Route_set_paths(&this_ptr_conv, val_constr);
23164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
23165 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23166 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
23167 if (paths_arg_constr.datalen > 0)
23168 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23170 paths_arg_constr.data = NULL;
23171 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23172 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
23173 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23174 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
23175 if (paths_arg_conv_12_constr.datalen > 0)
23176 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23178 paths_arg_conv_12_constr.data = NULL;
23179 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
23180 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23181 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23182 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23183 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23184 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23185 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23186 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23188 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
23189 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23191 LDKRoute ret_var = Route_new(paths_arg_constr);
23192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23194 uint64_t ret_ref = (uint64_t)ret_var.inner;
23195 if (ret_var.is_owned) {
23201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23202 LDKRoute orig_conv;
23203 orig_conv.inner = (void*)(orig & (~1));
23204 orig_conv.is_owned = false;
23205 LDKRoute ret_var = Route_clone(&orig_conv);
23206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23208 uint64_t ret_ref = (uint64_t)ret_var.inner;
23209 if (ret_var.is_owned) {
23215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
23217 obj_conv.inner = (void*)(obj & (~1));
23218 obj_conv.is_owned = false;
23219 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23220 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23221 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23222 CVec_u8Z_free(ret_var);
23226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23227 LDKu8slice ser_ref;
23228 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23229 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23230 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23231 *ret_conv = Route_read(ser_ref);
23232 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23233 return (uint64_t)ret_conv;
23236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23237 LDKRouteHint this_obj_conv;
23238 this_obj_conv.inner = (void*)(this_obj & (~1));
23239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23240 RouteHint_free(this_obj_conv);
23243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23244 LDKRouteHint a_conv;
23245 a_conv.inner = (void*)(a & (~1));
23246 a_conv.is_owned = false;
23247 LDKRouteHint b_conv;
23248 b_conv.inner = (void*)(b & (~1));
23249 b_conv.is_owned = false;
23250 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23255 LDKRouteHint orig_conv;
23256 orig_conv.inner = (void*)(orig & (~1));
23257 orig_conv.is_owned = false;
23258 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23261 uint64_t ret_ref = (uint64_t)ret_var.inner;
23262 if (ret_var.is_owned) {
23268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23269 LDKRouteHintHop this_obj_conv;
23270 this_obj_conv.inner = (void*)(this_obj & (~1));
23271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23272 RouteHintHop_free(this_obj_conv);
23275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23276 LDKRouteHintHop this_ptr_conv;
23277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23278 this_ptr_conv.is_owned = false;
23279 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23280 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
23284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23285 LDKRouteHintHop this_ptr_conv;
23286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23287 this_ptr_conv.is_owned = false;
23288 LDKPublicKey val_ref;
23289 CHECK((*env)->GetArrayLength(env, val) == 33);
23290 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23291 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23295 LDKRouteHintHop this_ptr_conv;
23296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23297 this_ptr_conv.is_owned = false;
23298 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23303 LDKRouteHintHop this_ptr_conv;
23304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23305 this_ptr_conv.is_owned = false;
23306 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23310 LDKRouteHintHop this_ptr_conv;
23311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23312 this_ptr_conv.is_owned = false;
23313 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23316 uint64_t ret_ref = (uint64_t)ret_var.inner;
23317 if (ret_var.is_owned) {
23323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23324 LDKRouteHintHop this_ptr_conv;
23325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23326 this_ptr_conv.is_owned = false;
23327 LDKRoutingFees val_conv;
23328 val_conv.inner = (void*)(val & (~1));
23329 val_conv.is_owned = (val & 1) || (val == 0);
23330 val_conv = RoutingFees_clone(&val_conv);
23331 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23334 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23335 LDKRouteHintHop this_ptr_conv;
23336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23337 this_ptr_conv.is_owned = false;
23338 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23343 LDKRouteHintHop this_ptr_conv;
23344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23345 this_ptr_conv.is_owned = false;
23346 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23350 LDKRouteHintHop this_ptr_conv;
23351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23352 this_ptr_conv.is_owned = false;
23353 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23354 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23355 uint64_t ret_ref = (uint64_t)ret_copy;
23359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23360 LDKRouteHintHop this_ptr_conv;
23361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23362 this_ptr_conv.is_owned = false;
23363 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23364 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23368 LDKRouteHintHop this_ptr_conv;
23369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23370 this_ptr_conv.is_owned = false;
23371 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23372 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23373 uint64_t ret_ref = (uint64_t)ret_copy;
23377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23378 LDKRouteHintHop this_ptr_conv;
23379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23380 this_ptr_conv.is_owned = false;
23381 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23382 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23385 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) {
23386 LDKPublicKey src_node_id_arg_ref;
23387 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23388 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23389 LDKRoutingFees fees_arg_conv;
23390 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23391 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23392 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23393 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23394 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23395 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);
23396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23398 uint64_t ret_ref = (uint64_t)ret_var.inner;
23399 if (ret_var.is_owned) {
23405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23406 LDKRouteHintHop a_conv;
23407 a_conv.inner = (void*)(a & (~1));
23408 a_conv.is_owned = false;
23409 LDKRouteHintHop b_conv;
23410 b_conv.inner = (void*)(b & (~1));
23411 b_conv.is_owned = false;
23412 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23417 LDKRouteHintHop orig_conv;
23418 orig_conv.inner = (void*)(orig & (~1));
23419 orig_conv.is_owned = false;
23420 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23423 uint64_t ret_ref = (uint64_t)ret_var.inner;
23424 if (ret_var.is_owned) {
23430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
23431 LDKPublicKey our_node_id_ref;
23432 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23433 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23434 LDKNetworkGraph network_conv;
23435 network_conv.inner = (void*)(network & (~1));
23436 network_conv.is_owned = false;
23437 LDKPublicKey payee_ref;
23438 CHECK((*env)->GetArrayLength(env, payee) == 33);
23439 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23440 LDKInvoiceFeatures payee_features_conv;
23441 payee_features_conv.inner = (void*)(payee_features & (~1));
23442 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23443 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23444 LDKCVec_ChannelDetailsZ first_hops_constr;
23445 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23446 if (first_hops_constr.datalen > 0)
23447 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23449 first_hops_constr.data = NULL;
23450 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23451 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23452 int64_t first_hops_conv_16 = first_hops_vals[q];
23453 LDKChannelDetails first_hops_conv_16_conv;
23454 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23455 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23456 first_hops_constr.data[q] = first_hops_conv_16_conv;
23458 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23459 LDKCVec_RouteHintZ last_hops_constr;
23460 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23461 if (last_hops_constr.datalen > 0)
23462 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23464 last_hops_constr.data = NULL;
23465 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23466 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23467 int64_t last_hops_conv_11 = last_hops_vals[l];
23468 LDKRouteHint last_hops_conv_11_conv;
23469 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23470 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23471 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23472 last_hops_constr.data[l] = last_hops_conv_11_conv;
23474 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23475 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23476 if (logger_conv.free == LDKLogger_JCalls_free) {
23477 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23478 LDKLogger_JCalls_clone(logger_conv.this_arg);
23480 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23481 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23482 FREE(first_hops_constr.data);
23483 return (uint64_t)ret_conv;
23486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23487 LDKNetworkGraph this_obj_conv;
23488 this_obj_conv.inner = (void*)(this_obj & (~1));
23489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23490 NetworkGraph_free(this_obj_conv);
23493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23494 LDKNetworkGraph orig_conv;
23495 orig_conv.inner = (void*)(orig & (~1));
23496 orig_conv.is_owned = false;
23497 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
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 uint64_t ret_ref = (uint64_t)ret_var.inner;
23501 if (ret_var.is_owned) {
23507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23508 LDKLockedNetworkGraph 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 LockedNetworkGraph_free(this_obj_conv);
23514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23515 LDKNetGraphMsgHandler this_obj_conv;
23516 this_obj_conv.inner = (void*)(this_obj & (~1));
23517 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23518 NetGraphMsgHandler_free(this_obj_conv);
23521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
23522 LDKThirtyTwoBytes genesis_hash_ref;
23523 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23524 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23525 LDKAccess *chain_access_conv_ptr = NULL;
23526 if (chain_access != 0) {
23527 LDKAccess chain_access_conv;
23528 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23529 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23530 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23531 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23533 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23534 *chain_access_conv_ptr = chain_access_conv;
23536 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23537 if (logger_conv.free == LDKLogger_JCalls_free) {
23538 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23539 LDKLogger_JCalls_clone(logger_conv.this_arg);
23541 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23544 uint64_t ret_ref = (uint64_t)ret_var.inner;
23545 if (ret_var.is_owned) {
23551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
23552 LDKAccess *chain_access_conv_ptr = NULL;
23553 if (chain_access != 0) {
23554 LDKAccess chain_access_conv;
23555 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23556 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23557 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23558 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23560 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23561 *chain_access_conv_ptr = chain_access_conv;
23563 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23564 if (logger_conv.free == LDKLogger_JCalls_free) {
23565 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23566 LDKLogger_JCalls_clone(logger_conv.this_arg);
23568 LDKNetworkGraph network_graph_conv;
23569 network_graph_conv.inner = (void*)(network_graph & (~1));
23570 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23571 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23572 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23575 uint64_t ret_ref = (uint64_t)ret_var.inner;
23576 if (ret_var.is_owned) {
23582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23583 LDKNetGraphMsgHandler this_arg_conv;
23584 this_arg_conv.inner = (void*)(this_arg & (~1));
23585 this_arg_conv.is_owned = false;
23586 LDKAccess *chain_access_conv_ptr = NULL;
23587 if (chain_access != 0) {
23588 LDKAccess chain_access_conv;
23589 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23590 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23591 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23592 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23594 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23595 *chain_access_conv_ptr = chain_access_conv;
23597 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23601 LDKNetGraphMsgHandler this_arg_conv;
23602 this_arg_conv.inner = (void*)(this_arg & (~1));
23603 this_arg_conv.is_owned = false;
23604 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23607 uint64_t ret_ref = (uint64_t)ret_var.inner;
23608 if (ret_var.is_owned) {
23614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23615 LDKLockedNetworkGraph this_arg_conv;
23616 this_arg_conv.inner = (void*)(this_arg & (~1));
23617 this_arg_conv.is_owned = false;
23618 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23621 uint64_t ret_ref = (uint64_t)ret_var.inner;
23622 if (ret_var.is_owned) {
23628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23629 LDKNetGraphMsgHandler this_arg_conv;
23630 this_arg_conv.inner = (void*)(this_arg & (~1));
23631 this_arg_conv.is_owned = false;
23632 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23633 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23634 return (uint64_t)ret;
23637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23638 LDKNetGraphMsgHandler this_arg_conv;
23639 this_arg_conv.inner = (void*)(this_arg & (~1));
23640 this_arg_conv.is_owned = false;
23641 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23642 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23643 return (uint64_t)ret;
23646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23647 LDKDirectionalChannelInfo this_obj_conv;
23648 this_obj_conv.inner = (void*)(this_obj & (~1));
23649 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23650 DirectionalChannelInfo_free(this_obj_conv);
23653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23654 LDKDirectionalChannelInfo this_ptr_conv;
23655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23656 this_ptr_conv.is_owned = false;
23657 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23662 LDKDirectionalChannelInfo this_ptr_conv;
23663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23664 this_ptr_conv.is_owned = false;
23665 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23669 LDKDirectionalChannelInfo this_ptr_conv;
23670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23671 this_ptr_conv.is_owned = false;
23672 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23677 LDKDirectionalChannelInfo this_ptr_conv;
23678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23679 this_ptr_conv.is_owned = false;
23680 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23683 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23684 LDKDirectionalChannelInfo this_ptr_conv;
23685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23686 this_ptr_conv.is_owned = false;
23687 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23692 LDKDirectionalChannelInfo this_ptr_conv;
23693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23694 this_ptr_conv.is_owned = false;
23695 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23699 LDKDirectionalChannelInfo this_ptr_conv;
23700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23701 this_ptr_conv.is_owned = false;
23702 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23707 LDKDirectionalChannelInfo this_ptr_conv;
23708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23709 this_ptr_conv.is_owned = false;
23710 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23714 LDKDirectionalChannelInfo this_ptr_conv;
23715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23716 this_ptr_conv.is_owned = false;
23717 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23718 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23719 uint64_t ret_ref = (uint64_t)ret_copy;
23723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23724 LDKDirectionalChannelInfo this_ptr_conv;
23725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23726 this_ptr_conv.is_owned = false;
23727 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23728 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23732 LDKDirectionalChannelInfo this_ptr_conv;
23733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23734 this_ptr_conv.is_owned = false;
23735 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23738 uint64_t ret_ref = (uint64_t)ret_var.inner;
23739 if (ret_var.is_owned) {
23745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23746 LDKDirectionalChannelInfo this_ptr_conv;
23747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23748 this_ptr_conv.is_owned = false;
23749 LDKRoutingFees val_conv;
23750 val_conv.inner = (void*)(val & (~1));
23751 val_conv.is_owned = (val & 1) || (val == 0);
23752 val_conv = RoutingFees_clone(&val_conv);
23753 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23757 LDKDirectionalChannelInfo this_ptr_conv;
23758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23759 this_ptr_conv.is_owned = false;
23760 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23763 uint64_t ret_ref = (uint64_t)ret_var.inner;
23764 if (ret_var.is_owned) {
23770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23771 LDKDirectionalChannelInfo this_ptr_conv;
23772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23773 this_ptr_conv.is_owned = false;
23774 LDKChannelUpdate val_conv;
23775 val_conv.inner = (void*)(val & (~1));
23776 val_conv.is_owned = (val & 1) || (val == 0);
23777 val_conv = ChannelUpdate_clone(&val_conv);
23778 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23781 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) {
23782 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23783 LDKRoutingFees fees_arg_conv;
23784 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23785 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23786 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23787 LDKChannelUpdate last_update_message_arg_conv;
23788 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23789 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23790 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23791 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);
23792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23794 uint64_t ret_ref = (uint64_t)ret_var.inner;
23795 if (ret_var.is_owned) {
23801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23802 LDKDirectionalChannelInfo orig_conv;
23803 orig_conv.inner = (void*)(orig & (~1));
23804 orig_conv.is_owned = false;
23805 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23808 uint64_t ret_ref = (uint64_t)ret_var.inner;
23809 if (ret_var.is_owned) {
23815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23816 LDKDirectionalChannelInfo obj_conv;
23817 obj_conv.inner = (void*)(obj & (~1));
23818 obj_conv.is_owned = false;
23819 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23820 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23821 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23822 CVec_u8Z_free(ret_var);
23826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23827 LDKu8slice ser_ref;
23828 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23829 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23830 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23831 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23832 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23833 return (uint64_t)ret_conv;
23836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23837 LDKChannelInfo this_obj_conv;
23838 this_obj_conv.inner = (void*)(this_obj & (~1));
23839 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23840 ChannelInfo_free(this_obj_conv);
23843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23844 LDKChannelInfo this_ptr_conv;
23845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23846 this_ptr_conv.is_owned = false;
23847 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23850 uint64_t ret_ref = (uint64_t)ret_var.inner;
23851 if (ret_var.is_owned) {
23857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23858 LDKChannelInfo this_ptr_conv;
23859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23860 this_ptr_conv.is_owned = false;
23861 LDKChannelFeatures val_conv;
23862 val_conv.inner = (void*)(val & (~1));
23863 val_conv.is_owned = (val & 1) || (val == 0);
23864 val_conv = ChannelFeatures_clone(&val_conv);
23865 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23869 LDKChannelInfo this_ptr_conv;
23870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23871 this_ptr_conv.is_owned = false;
23872 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23878 LDKChannelInfo this_ptr_conv;
23879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23880 this_ptr_conv.is_owned = false;
23881 LDKPublicKey val_ref;
23882 CHECK((*env)->GetArrayLength(env, val) == 33);
23883 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23884 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23888 LDKChannelInfo this_ptr_conv;
23889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23890 this_ptr_conv.is_owned = false;
23891 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23894 uint64_t ret_ref = (uint64_t)ret_var.inner;
23895 if (ret_var.is_owned) {
23901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23902 LDKChannelInfo this_ptr_conv;
23903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23904 this_ptr_conv.is_owned = false;
23905 LDKDirectionalChannelInfo val_conv;
23906 val_conv.inner = (void*)(val & (~1));
23907 val_conv.is_owned = (val & 1) || (val == 0);
23908 val_conv = DirectionalChannelInfo_clone(&val_conv);
23909 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23913 LDKChannelInfo this_ptr_conv;
23914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23915 this_ptr_conv.is_owned = false;
23916 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23917 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23922 LDKChannelInfo this_ptr_conv;
23923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23924 this_ptr_conv.is_owned = false;
23925 LDKPublicKey val_ref;
23926 CHECK((*env)->GetArrayLength(env, val) == 33);
23927 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23928 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23932 LDKChannelInfo this_ptr_conv;
23933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23934 this_ptr_conv.is_owned = false;
23935 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
23936 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23937 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23938 uint64_t ret_ref = (uint64_t)ret_var.inner;
23939 if (ret_var.is_owned) {
23945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23946 LDKChannelInfo this_ptr_conv;
23947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23948 this_ptr_conv.is_owned = false;
23949 LDKDirectionalChannelInfo val_conv;
23950 val_conv.inner = (void*)(val & (~1));
23951 val_conv.is_owned = (val & 1) || (val == 0);
23952 val_conv = DirectionalChannelInfo_clone(&val_conv);
23953 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23957 LDKChannelInfo this_ptr_conv;
23958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23959 this_ptr_conv.is_owned = false;
23960 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23961 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23962 uint64_t ret_ref = (uint64_t)ret_copy;
23966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23967 LDKChannelInfo this_ptr_conv;
23968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23969 this_ptr_conv.is_owned = false;
23970 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23971 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23975 LDKChannelInfo this_ptr_conv;
23976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23977 this_ptr_conv.is_owned = false;
23978 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23981 uint64_t ret_ref = (uint64_t)ret_var.inner;
23982 if (ret_var.is_owned) {
23988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23989 LDKChannelInfo this_ptr_conv;
23990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23991 this_ptr_conv.is_owned = false;
23992 LDKChannelAnnouncement val_conv;
23993 val_conv.inner = (void*)(val & (~1));
23994 val_conv.is_owned = (val & 1) || (val == 0);
23995 val_conv = ChannelAnnouncement_clone(&val_conv);
23996 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
23999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
24000 LDKChannelFeatures features_arg_conv;
24001 features_arg_conv.inner = (void*)(features_arg & (~1));
24002 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24003 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24004 LDKPublicKey node_one_arg_ref;
24005 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
24006 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
24007 LDKDirectionalChannelInfo one_to_two_arg_conv;
24008 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24009 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24010 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24011 LDKPublicKey node_two_arg_ref;
24012 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
24013 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
24014 LDKDirectionalChannelInfo two_to_one_arg_conv;
24015 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24016 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24017 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24018 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24019 LDKChannelAnnouncement announcement_message_arg_conv;
24020 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24021 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24022 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24023 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
24024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24026 uint64_t ret_ref = (uint64_t)ret_var.inner;
24027 if (ret_var.is_owned) {
24033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24034 LDKChannelInfo orig_conv;
24035 orig_conv.inner = (void*)(orig & (~1));
24036 orig_conv.is_owned = false;
24037 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24040 uint64_t ret_ref = (uint64_t)ret_var.inner;
24041 if (ret_var.is_owned) {
24047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24048 LDKChannelInfo obj_conv;
24049 obj_conv.inner = (void*)(obj & (~1));
24050 obj_conv.is_owned = false;
24051 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24052 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24053 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24054 CVec_u8Z_free(ret_var);
24058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24059 LDKu8slice ser_ref;
24060 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24061 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24062 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24063 *ret_conv = ChannelInfo_read(ser_ref);
24064 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24065 return (uint64_t)ret_conv;
24068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24069 LDKRoutingFees this_obj_conv;
24070 this_obj_conv.inner = (void*)(this_obj & (~1));
24071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24072 RoutingFees_free(this_obj_conv);
24075 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24076 LDKRoutingFees this_ptr_conv;
24077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24078 this_ptr_conv.is_owned = false;
24079 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24084 LDKRoutingFees this_ptr_conv;
24085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24086 this_ptr_conv.is_owned = false;
24087 RoutingFees_set_base_msat(&this_ptr_conv, val);
24090 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24091 LDKRoutingFees this_ptr_conv;
24092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24093 this_ptr_conv.is_owned = false;
24094 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24099 LDKRoutingFees this_ptr_conv;
24100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24101 this_ptr_conv.is_owned = false;
24102 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24105 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) {
24106 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24109 uint64_t ret_ref = (uint64_t)ret_var.inner;
24110 if (ret_var.is_owned) {
24116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24117 LDKRoutingFees a_conv;
24118 a_conv.inner = (void*)(a & (~1));
24119 a_conv.is_owned = false;
24120 LDKRoutingFees b_conv;
24121 b_conv.inner = (void*)(b & (~1));
24122 b_conv.is_owned = false;
24123 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24128 LDKRoutingFees orig_conv;
24129 orig_conv.inner = (void*)(orig & (~1));
24130 orig_conv.is_owned = false;
24131 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24134 uint64_t ret_ref = (uint64_t)ret_var.inner;
24135 if (ret_var.is_owned) {
24141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
24142 LDKRoutingFees obj_conv;
24143 obj_conv.inner = (void*)(obj & (~1));
24144 obj_conv.is_owned = false;
24145 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24146 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24147 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24148 CVec_u8Z_free(ret_var);
24152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24153 LDKu8slice ser_ref;
24154 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24155 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24156 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24157 *ret_conv = RoutingFees_read(ser_ref);
24158 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24159 return (uint64_t)ret_conv;
24162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24163 LDKNodeAnnouncementInfo this_obj_conv;
24164 this_obj_conv.inner = (void*)(this_obj & (~1));
24165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24166 NodeAnnouncementInfo_free(this_obj_conv);
24169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24170 LDKNodeAnnouncementInfo this_ptr_conv;
24171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24172 this_ptr_conv.is_owned = false;
24173 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24176 uint64_t ret_ref = (uint64_t)ret_var.inner;
24177 if (ret_var.is_owned) {
24183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24184 LDKNodeAnnouncementInfo this_ptr_conv;
24185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24186 this_ptr_conv.is_owned = false;
24187 LDKNodeFeatures val_conv;
24188 val_conv.inner = (void*)(val & (~1));
24189 val_conv.is_owned = (val & 1) || (val == 0);
24190 val_conv = NodeFeatures_clone(&val_conv);
24191 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24194 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
24195 LDKNodeAnnouncementInfo this_ptr_conv;
24196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24197 this_ptr_conv.is_owned = false;
24198 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24203 LDKNodeAnnouncementInfo this_ptr_conv;
24204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24205 this_ptr_conv.is_owned = false;
24206 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
24210 LDKNodeAnnouncementInfo this_ptr_conv;
24211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24212 this_ptr_conv.is_owned = false;
24213 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
24214 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
24218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24219 LDKNodeAnnouncementInfo this_ptr_conv;
24220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24221 this_ptr_conv.is_owned = false;
24222 LDKThreeBytes val_ref;
24223 CHECK((*env)->GetArrayLength(env, val) == 3);
24224 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
24225 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
24229 LDKNodeAnnouncementInfo this_ptr_conv;
24230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24231 this_ptr_conv.is_owned = false;
24232 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24233 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
24237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24238 LDKNodeAnnouncementInfo this_ptr_conv;
24239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24240 this_ptr_conv.is_owned = false;
24241 LDKThirtyTwoBytes val_ref;
24242 CHECK((*env)->GetArrayLength(env, val) == 32);
24243 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24244 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24248 LDKNodeAnnouncementInfo this_ptr_conv;
24249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24250 this_ptr_conv.is_owned = false;
24251 LDKCVec_NetAddressZ val_constr;
24252 val_constr.datalen = (*env)->GetArrayLength(env, val);
24253 if (val_constr.datalen > 0)
24254 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24256 val_constr.data = NULL;
24257 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24258 for (size_t m = 0; m < val_constr.datalen; m++) {
24259 int64_t val_conv_12 = val_vals[m];
24260 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24261 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24262 val_constr.data[m] = val_conv_12_conv;
24264 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24265 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
24269 LDKNodeAnnouncementInfo this_ptr_conv;
24270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24271 this_ptr_conv.is_owned = false;
24272 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24275 uint64_t ret_ref = (uint64_t)ret_var.inner;
24276 if (ret_var.is_owned) {
24282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24283 LDKNodeAnnouncementInfo this_ptr_conv;
24284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24285 this_ptr_conv.is_owned = false;
24286 LDKNodeAnnouncement val_conv;
24287 val_conv.inner = (void*)(val & (~1));
24288 val_conv.is_owned = (val & 1) || (val == 0);
24289 val_conv = NodeAnnouncement_clone(&val_conv);
24290 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24293 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) {
24294 LDKNodeFeatures features_arg_conv;
24295 features_arg_conv.inner = (void*)(features_arg & (~1));
24296 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24297 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24298 LDKThreeBytes rgb_arg_ref;
24299 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
24300 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24301 LDKThirtyTwoBytes alias_arg_ref;
24302 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24303 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24304 LDKCVec_NetAddressZ addresses_arg_constr;
24305 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24306 if (addresses_arg_constr.datalen > 0)
24307 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24309 addresses_arg_constr.data = NULL;
24310 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24311 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24312 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24313 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24314 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24316 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24317 LDKNodeAnnouncement announcement_message_arg_conv;
24318 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24319 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24320 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24321 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24324 uint64_t ret_ref = (uint64_t)ret_var.inner;
24325 if (ret_var.is_owned) {
24331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24332 LDKNodeAnnouncementInfo orig_conv;
24333 orig_conv.inner = (void*)(orig & (~1));
24334 orig_conv.is_owned = false;
24335 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24338 uint64_t ret_ref = (uint64_t)ret_var.inner;
24339 if (ret_var.is_owned) {
24345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24346 LDKNodeAnnouncementInfo obj_conv;
24347 obj_conv.inner = (void*)(obj & (~1));
24348 obj_conv.is_owned = false;
24349 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24350 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24351 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24352 CVec_u8Z_free(ret_var);
24356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24357 LDKu8slice ser_ref;
24358 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24359 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24360 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24361 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24362 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24363 return (uint64_t)ret_conv;
24366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24367 LDKNodeInfo this_obj_conv;
24368 this_obj_conv.inner = (void*)(this_obj & (~1));
24369 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24370 NodeInfo_free(this_obj_conv);
24373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24374 LDKNodeInfo this_ptr_conv;
24375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24376 this_ptr_conv.is_owned = false;
24377 LDKCVec_u64Z val_constr;
24378 val_constr.datalen = (*env)->GetArrayLength(env, val);
24379 if (val_constr.datalen > 0)
24380 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24382 val_constr.data = NULL;
24383 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24384 for (size_t g = 0; g < val_constr.datalen; g++) {
24385 int64_t val_conv_6 = val_vals[g];
24386 val_constr.data[g] = val_conv_6;
24388 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24389 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24393 LDKNodeInfo this_ptr_conv;
24394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24395 this_ptr_conv.is_owned = false;
24396 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24399 uint64_t ret_ref = (uint64_t)ret_var.inner;
24400 if (ret_var.is_owned) {
24406 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) {
24407 LDKNodeInfo this_ptr_conv;
24408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24409 this_ptr_conv.is_owned = false;
24410 LDKRoutingFees val_conv;
24411 val_conv.inner = (void*)(val & (~1));
24412 val_conv.is_owned = (val & 1) || (val == 0);
24413 val_conv = RoutingFees_clone(&val_conv);
24414 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24418 LDKNodeInfo this_ptr_conv;
24419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24420 this_ptr_conv.is_owned = false;
24421 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24424 uint64_t ret_ref = (uint64_t)ret_var.inner;
24425 if (ret_var.is_owned) {
24431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24432 LDKNodeInfo this_ptr_conv;
24433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24434 this_ptr_conv.is_owned = false;
24435 LDKNodeAnnouncementInfo val_conv;
24436 val_conv.inner = (void*)(val & (~1));
24437 val_conv.is_owned = (val & 1) || (val == 0);
24438 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24439 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24442 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) {
24443 LDKCVec_u64Z channels_arg_constr;
24444 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24445 if (channels_arg_constr.datalen > 0)
24446 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24448 channels_arg_constr.data = NULL;
24449 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24450 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24451 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24452 channels_arg_constr.data[g] = channels_arg_conv_6;
24454 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24455 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24456 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24457 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24458 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24459 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24460 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24461 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24462 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24463 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24466 uint64_t ret_ref = (uint64_t)ret_var.inner;
24467 if (ret_var.is_owned) {
24473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24474 LDKNodeInfo orig_conv;
24475 orig_conv.inner = (void*)(orig & (~1));
24476 orig_conv.is_owned = false;
24477 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24480 uint64_t ret_ref = (uint64_t)ret_var.inner;
24481 if (ret_var.is_owned) {
24487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24488 LDKNodeInfo obj_conv;
24489 obj_conv.inner = (void*)(obj & (~1));
24490 obj_conv.is_owned = false;
24491 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24492 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24493 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24494 CVec_u8Z_free(ret_var);
24498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24499 LDKu8slice ser_ref;
24500 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24501 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24502 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24503 *ret_conv = NodeInfo_read(ser_ref);
24504 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24505 return (uint64_t)ret_conv;
24508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24509 LDKNetworkGraph obj_conv;
24510 obj_conv.inner = (void*)(obj & (~1));
24511 obj_conv.is_owned = false;
24512 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24513 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24514 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24515 CVec_u8Z_free(ret_var);
24519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24520 LDKu8slice ser_ref;
24521 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24522 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24523 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24524 *ret_conv = NetworkGraph_read(ser_ref);
24525 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24526 return (uint64_t)ret_conv;
24529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24530 LDKThirtyTwoBytes genesis_hash_ref;
24531 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24532 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24533 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24536 uint64_t ret_ref = (uint64_t)ret_var.inner;
24537 if (ret_var.is_owned) {
24543 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) {
24544 LDKNetworkGraph this_arg_conv;
24545 this_arg_conv.inner = (void*)(this_arg & (~1));
24546 this_arg_conv.is_owned = false;
24547 LDKNodeAnnouncement msg_conv;
24548 msg_conv.inner = (void*)(msg & (~1));
24549 msg_conv.is_owned = false;
24550 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24551 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24552 return (uint64_t)ret_conv;
24555 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) {
24556 LDKNetworkGraph this_arg_conv;
24557 this_arg_conv.inner = (void*)(this_arg & (~1));
24558 this_arg_conv.is_owned = false;
24559 LDKUnsignedNodeAnnouncement msg_conv;
24560 msg_conv.inner = (void*)(msg & (~1));
24561 msg_conv.is_owned = false;
24562 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24563 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24564 return (uint64_t)ret_conv;
24567 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) {
24568 LDKNetworkGraph this_arg_conv;
24569 this_arg_conv.inner = (void*)(this_arg & (~1));
24570 this_arg_conv.is_owned = false;
24571 LDKChannelAnnouncement msg_conv;
24572 msg_conv.inner = (void*)(msg & (~1));
24573 msg_conv.is_owned = false;
24574 LDKAccess *chain_access_conv_ptr = NULL;
24575 if (chain_access != 0) {
24576 LDKAccess chain_access_conv;
24577 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24578 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24579 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24580 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24582 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24583 *chain_access_conv_ptr = chain_access_conv;
24585 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24586 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24587 return (uint64_t)ret_conv;
24590 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) {
24591 LDKNetworkGraph this_arg_conv;
24592 this_arg_conv.inner = (void*)(this_arg & (~1));
24593 this_arg_conv.is_owned = false;
24594 LDKUnsignedChannelAnnouncement msg_conv;
24595 msg_conv.inner = (void*)(msg & (~1));
24596 msg_conv.is_owned = false;
24597 LDKAccess *chain_access_conv_ptr = NULL;
24598 if (chain_access != 0) {
24599 LDKAccess chain_access_conv;
24600 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24601 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24603 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24605 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24606 *chain_access_conv_ptr = chain_access_conv;
24608 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24609 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24610 return (uint64_t)ret_conv;
24613 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) {
24614 LDKNetworkGraph this_arg_conv;
24615 this_arg_conv.inner = (void*)(this_arg & (~1));
24616 this_arg_conv.is_owned = false;
24617 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24621 LDKNetworkGraph this_arg_conv;
24622 this_arg_conv.inner = (void*)(this_arg & (~1));
24623 this_arg_conv.is_owned = false;
24624 LDKChannelUpdate msg_conv;
24625 msg_conv.inner = (void*)(msg & (~1));
24626 msg_conv.is_owned = false;
24627 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24628 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24629 return (uint64_t)ret_conv;
24632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24633 LDKNetworkGraph this_arg_conv;
24634 this_arg_conv.inner = (void*)(this_arg & (~1));
24635 this_arg_conv.is_owned = false;
24636 LDKUnsignedChannelUpdate msg_conv;
24637 msg_conv.inner = (void*)(msg & (~1));
24638 msg_conv.is_owned = false;
24639 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24640 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24641 return (uint64_t)ret_conv;
24644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24645 LDKFilesystemPersister this_obj_conv;
24646 this_obj_conv.inner = (void*)(this_obj & (~1));
24647 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24648 FilesystemPersister_free(this_obj_conv);
24651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24652 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24653 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24656 uint64_t ret_ref = (uint64_t)ret_var.inner;
24657 if (ret_var.is_owned) {
24663 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24664 LDKFilesystemPersister this_arg_conv;
24665 this_arg_conv.inner = (void*)(this_arg & (~1));
24666 this_arg_conv.is_owned = false;
24667 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24668 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24673 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24674 LDKChannelManager manager_conv;
24675 manager_conv.inner = (void*)(manager & (~1));
24676 manager_conv.is_owned = false;
24677 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24678 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24679 return (uint64_t)ret_conv;
24682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24683 LDKFilesystemPersister this_arg_conv;
24684 this_arg_conv.inner = (void*)(this_arg & (~1));
24685 this_arg_conv.is_owned = false;
24686 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24687 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24688 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24689 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24691 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24692 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24693 return (uint64_t)ret_conv;
24696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24697 LDKFilesystemPersister this_arg_conv;
24698 this_arg_conv.inner = (void*)(this_arg & (~1));
24699 this_arg_conv.is_owned = false;
24700 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24701 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24702 return (uint64_t)ret;
24705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24706 LDKBackgroundProcessor this_obj_conv;
24707 this_obj_conv.inner = (void*)(this_obj & (~1));
24708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24709 BackgroundProcessor_free(this_obj_conv);
24712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24713 if ((this_ptr & 1) != 0) return;
24714 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24715 FREE((void*)this_ptr);
24716 ChannelManagerPersister_free(this_ptr_conv);
24719 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 peer_manager, int64_t logger) {
24720 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24721 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24722 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24723 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24725 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24726 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24727 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24728 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24730 LDKChainMonitor chain_monitor_conv;
24731 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24732 chain_monitor_conv.is_owned = false;
24733 LDKChannelManager channel_manager_conv;
24734 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24735 channel_manager_conv.is_owned = false;
24736 LDKPeerManager peer_manager_conv;
24737 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24738 peer_manager_conv.is_owned = false;
24739 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24740 if (logger_conv.free == LDKLogger_JCalls_free) {
24741 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24742 LDKLogger_JCalls_clone(logger_conv.this_arg);
24744 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24747 uint64_t ret_ref = (uint64_t)ret_var.inner;
24748 if (ret_var.is_owned) {
24754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24755 LDKBackgroundProcessor this_arg_conv;
24756 this_arg_conv.inner = (void*)(this_arg & (~1));
24757 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24758 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24759 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24760 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24761 return (uint64_t)ret_conv;
24764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24769 LDKInvoice this_obj_conv;
24770 this_obj_conv.inner = (void*)(this_obj & (~1));
24771 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24772 Invoice_free(this_obj_conv);
24775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24777 a_conv.inner = (void*)(a & (~1));
24778 a_conv.is_owned = false;
24780 b_conv.inner = (void*)(b & (~1));
24781 b_conv.is_owned = false;
24782 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24787 LDKInvoice orig_conv;
24788 orig_conv.inner = (void*)(orig & (~1));
24789 orig_conv.is_owned = false;
24790 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24793 uint64_t ret_ref = (uint64_t)ret_var.inner;
24794 if (ret_var.is_owned) {
24800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24801 LDKSignedRawInvoice this_obj_conv;
24802 this_obj_conv.inner = (void*)(this_obj & (~1));
24803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24804 SignedRawInvoice_free(this_obj_conv);
24807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24808 LDKSignedRawInvoice a_conv;
24809 a_conv.inner = (void*)(a & (~1));
24810 a_conv.is_owned = false;
24811 LDKSignedRawInvoice b_conv;
24812 b_conv.inner = (void*)(b & (~1));
24813 b_conv.is_owned = false;
24814 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24819 LDKSignedRawInvoice orig_conv;
24820 orig_conv.inner = (void*)(orig & (~1));
24821 orig_conv.is_owned = false;
24822 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24825 uint64_t ret_ref = (uint64_t)ret_var.inner;
24826 if (ret_var.is_owned) {
24832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24833 LDKRawInvoice this_obj_conv;
24834 this_obj_conv.inner = (void*)(this_obj & (~1));
24835 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24836 RawInvoice_free(this_obj_conv);
24839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24840 LDKRawInvoice this_ptr_conv;
24841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24842 this_ptr_conv.is_owned = false;
24843 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24846 uint64_t ret_ref = (uint64_t)ret_var.inner;
24847 if (ret_var.is_owned) {
24853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24854 LDKRawInvoice this_ptr_conv;
24855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24856 this_ptr_conv.is_owned = false;
24857 LDKRawDataPart val_conv;
24858 val_conv.inner = (void*)(val & (~1));
24859 val_conv.is_owned = (val & 1) || (val == 0);
24860 val_conv = RawDataPart_clone(&val_conv);
24861 RawInvoice_set_data(&this_ptr_conv, val_conv);
24864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24865 LDKRawInvoice a_conv;
24866 a_conv.inner = (void*)(a & (~1));
24867 a_conv.is_owned = false;
24868 LDKRawInvoice b_conv;
24869 b_conv.inner = (void*)(b & (~1));
24870 b_conv.is_owned = false;
24871 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24876 LDKRawInvoice orig_conv;
24877 orig_conv.inner = (void*)(orig & (~1));
24878 orig_conv.is_owned = false;
24879 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24882 uint64_t ret_ref = (uint64_t)ret_var.inner;
24883 if (ret_var.is_owned) {
24889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24890 LDKRawDataPart this_obj_conv;
24891 this_obj_conv.inner = (void*)(this_obj & (~1));
24892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24893 RawDataPart_free(this_obj_conv);
24896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24897 LDKRawDataPart this_ptr_conv;
24898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24899 this_ptr_conv.is_owned = false;
24900 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24903 uint64_t ret_ref = (uint64_t)ret_var.inner;
24904 if (ret_var.is_owned) {
24910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24911 LDKRawDataPart this_ptr_conv;
24912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24913 this_ptr_conv.is_owned = false;
24914 LDKPositiveTimestamp val_conv;
24915 val_conv.inner = (void*)(val & (~1));
24916 val_conv.is_owned = (val & 1) || (val == 0);
24917 val_conv = PositiveTimestamp_clone(&val_conv);
24918 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24922 LDKRawDataPart a_conv;
24923 a_conv.inner = (void*)(a & (~1));
24924 a_conv.is_owned = false;
24925 LDKRawDataPart b_conv;
24926 b_conv.inner = (void*)(b & (~1));
24927 b_conv.is_owned = false;
24928 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24933 LDKRawDataPart orig_conv;
24934 orig_conv.inner = (void*)(orig & (~1));
24935 orig_conv.is_owned = false;
24936 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24939 uint64_t ret_ref = (uint64_t)ret_var.inner;
24940 if (ret_var.is_owned) {
24946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24947 LDKPositiveTimestamp this_obj_conv;
24948 this_obj_conv.inner = (void*)(this_obj & (~1));
24949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24950 PositiveTimestamp_free(this_obj_conv);
24953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24954 LDKPositiveTimestamp a_conv;
24955 a_conv.inner = (void*)(a & (~1));
24956 a_conv.is_owned = false;
24957 LDKPositiveTimestamp b_conv;
24958 b_conv.inner = (void*)(b & (~1));
24959 b_conv.is_owned = false;
24960 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24965 LDKPositiveTimestamp orig_conv;
24966 orig_conv.inner = (void*)(orig & (~1));
24967 orig_conv.is_owned = false;
24968 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24971 uint64_t ret_ref = (uint64_t)ret_var.inner;
24972 if (ret_var.is_owned) {
24978 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24979 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24980 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24985 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24986 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24987 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24992 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24993 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24997 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24998 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
24999 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
25003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25004 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25005 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25006 jboolean ret_val = Currency_eq(a_conv, b_conv);
25010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25011 LDKSha256 this_obj_conv;
25012 this_obj_conv.inner = (void*)(this_obj & (~1));
25013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25014 Sha256_free(this_obj_conv);
25017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25019 a_conv.inner = (void*)(a & (~1));
25020 a_conv.is_owned = false;
25022 b_conv.inner = (void*)(b & (~1));
25023 b_conv.is_owned = false;
25024 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25029 LDKSha256 orig_conv;
25030 orig_conv.inner = (void*)(orig & (~1));
25031 orig_conv.is_owned = false;
25032 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25035 uint64_t ret_ref = (uint64_t)ret_var.inner;
25036 if (ret_var.is_owned) {
25042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25043 LDKDescription this_obj_conv;
25044 this_obj_conv.inner = (void*)(this_obj & (~1));
25045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25046 Description_free(this_obj_conv);
25049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25050 LDKDescription a_conv;
25051 a_conv.inner = (void*)(a & (~1));
25052 a_conv.is_owned = false;
25053 LDKDescription b_conv;
25054 b_conv.inner = (void*)(b & (~1));
25055 b_conv.is_owned = false;
25056 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25061 LDKDescription orig_conv;
25062 orig_conv.inner = (void*)(orig & (~1));
25063 orig_conv.is_owned = false;
25064 LDKDescription ret_var = Description_clone(&orig_conv);
25065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25067 uint64_t ret_ref = (uint64_t)ret_var.inner;
25068 if (ret_var.is_owned) {
25074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25075 LDKPayeePubKey this_obj_conv;
25076 this_obj_conv.inner = (void*)(this_obj & (~1));
25077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25078 PayeePubKey_free(this_obj_conv);
25081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25082 LDKPayeePubKey a_conv;
25083 a_conv.inner = (void*)(a & (~1));
25084 a_conv.is_owned = false;
25085 LDKPayeePubKey b_conv;
25086 b_conv.inner = (void*)(b & (~1));
25087 b_conv.is_owned = false;
25088 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25093 LDKPayeePubKey orig_conv;
25094 orig_conv.inner = (void*)(orig & (~1));
25095 orig_conv.is_owned = false;
25096 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25099 uint64_t ret_ref = (uint64_t)ret_var.inner;
25100 if (ret_var.is_owned) {
25106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25107 LDKExpiryTime this_obj_conv;
25108 this_obj_conv.inner = (void*)(this_obj & (~1));
25109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25110 ExpiryTime_free(this_obj_conv);
25113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25114 LDKExpiryTime a_conv;
25115 a_conv.inner = (void*)(a & (~1));
25116 a_conv.is_owned = false;
25117 LDKExpiryTime b_conv;
25118 b_conv.inner = (void*)(b & (~1));
25119 b_conv.is_owned = false;
25120 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25125 LDKExpiryTime orig_conv;
25126 orig_conv.inner = (void*)(orig & (~1));
25127 orig_conv.is_owned = false;
25128 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25131 uint64_t ret_ref = (uint64_t)ret_var.inner;
25132 if (ret_var.is_owned) {
25138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25139 LDKMinFinalCltvExpiry this_obj_conv;
25140 this_obj_conv.inner = (void*)(this_obj & (~1));
25141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25142 MinFinalCltvExpiry_free(this_obj_conv);
25145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25146 LDKMinFinalCltvExpiry a_conv;
25147 a_conv.inner = (void*)(a & (~1));
25148 a_conv.is_owned = false;
25149 LDKMinFinalCltvExpiry b_conv;
25150 b_conv.inner = (void*)(b & (~1));
25151 b_conv.is_owned = false;
25152 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25157 LDKMinFinalCltvExpiry orig_conv;
25158 orig_conv.inner = (void*)(orig & (~1));
25159 orig_conv.is_owned = false;
25160 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25163 uint64_t ret_ref = (uint64_t)ret_var.inner;
25164 if (ret_var.is_owned) {
25170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25171 if ((this_ptr & 1) != 0) return;
25172 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25173 FREE((void*)this_ptr);
25174 Fallback_free(this_ptr_conv);
25177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25178 LDKFallback* orig_conv = (LDKFallback*)orig;
25179 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25180 *ret_copy = Fallback_clone(orig_conv);
25181 uint64_t ret_ref = (uint64_t)ret_copy;
25185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25186 LDKFallback* a_conv = (LDKFallback*)a;
25187 LDKFallback* b_conv = (LDKFallback*)b;
25188 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25193 LDKInvoiceSignature this_obj_conv;
25194 this_obj_conv.inner = (void*)(this_obj & (~1));
25195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25196 InvoiceSignature_free(this_obj_conv);
25199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25200 LDKInvoiceSignature a_conv;
25201 a_conv.inner = (void*)(a & (~1));
25202 a_conv.is_owned = false;
25203 LDKInvoiceSignature b_conv;
25204 b_conv.inner = (void*)(b & (~1));
25205 b_conv.is_owned = false;
25206 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25211 LDKInvoiceSignature orig_conv;
25212 orig_conv.inner = (void*)(orig & (~1));
25213 orig_conv.is_owned = false;
25214 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25217 uint64_t ret_ref = (uint64_t)ret_var.inner;
25218 if (ret_var.is_owned) {
25224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25225 LDKPrivateRoute this_obj_conv;
25226 this_obj_conv.inner = (void*)(this_obj & (~1));
25227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25228 PrivateRoute_free(this_obj_conv);
25231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25232 LDKPrivateRoute a_conv;
25233 a_conv.inner = (void*)(a & (~1));
25234 a_conv.is_owned = false;
25235 LDKPrivateRoute b_conv;
25236 b_conv.inner = (void*)(b & (~1));
25237 b_conv.is_owned = false;
25238 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25243 LDKPrivateRoute orig_conv;
25244 orig_conv.inner = (void*)(orig & (~1));
25245 orig_conv.is_owned = false;
25246 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25249 uint64_t ret_ref = (uint64_t)ret_var.inner;
25250 if (ret_var.is_owned) {
25256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
25257 LDKSignedRawInvoice this_arg_conv;
25258 this_arg_conv.inner = (void*)(this_arg & (~1));
25259 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25260 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25261 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25262 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
25263 return (uint64_t)ret_ref;
25266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
25267 LDKSignedRawInvoice this_arg_conv;
25268 this_arg_conv.inner = (void*)(this_arg & (~1));
25269 this_arg_conv.is_owned = false;
25270 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25273 uint64_t ret_ref = (uint64_t)ret_var.inner;
25274 if (ret_var.is_owned) {
25280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25281 LDKSignedRawInvoice this_arg_conv;
25282 this_arg_conv.inner = (void*)(this_arg & (~1));
25283 this_arg_conv.is_owned = false;
25284 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25285 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
25289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25290 LDKSignedRawInvoice this_arg_conv;
25291 this_arg_conv.inner = (void*)(this_arg & (~1));
25292 this_arg_conv.is_owned = false;
25293 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25296 uint64_t ret_ref = (uint64_t)ret_var.inner;
25297 if (ret_var.is_owned) {
25303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25304 LDKSignedRawInvoice this_arg_conv;
25305 this_arg_conv.inner = (void*)(this_arg & (~1));
25306 this_arg_conv.is_owned = false;
25307 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25308 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25309 return (uint64_t)ret_conv;
25312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25313 LDKSignedRawInvoice this_arg_conv;
25314 this_arg_conv.inner = (void*)(this_arg & (~1));
25315 this_arg_conv.is_owned = false;
25316 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25321 LDKRawInvoice this_arg_conv;
25322 this_arg_conv.inner = (void*)(this_arg & (~1));
25323 this_arg_conv.is_owned = false;
25324 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25330 LDKRawInvoice this_arg_conv;
25331 this_arg_conv.inner = (void*)(this_arg & (~1));
25332 this_arg_conv.is_owned = false;
25333 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25336 uint64_t ret_ref = (uint64_t)ret_var.inner;
25337 if (ret_var.is_owned) {
25343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25344 LDKRawInvoice this_arg_conv;
25345 this_arg_conv.inner = (void*)(this_arg & (~1));
25346 this_arg_conv.is_owned = false;
25347 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25350 uint64_t ret_ref = (uint64_t)ret_var.inner;
25351 if (ret_var.is_owned) {
25357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25358 LDKRawInvoice this_arg_conv;
25359 this_arg_conv.inner = (void*)(this_arg & (~1));
25360 this_arg_conv.is_owned = false;
25361 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25364 uint64_t ret_ref = (uint64_t)ret_var.inner;
25365 if (ret_var.is_owned) {
25371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25372 LDKRawInvoice this_arg_conv;
25373 this_arg_conv.inner = (void*)(this_arg & (~1));
25374 this_arg_conv.is_owned = false;
25375 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25376 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25377 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25378 uint64_t ret_ref = (uint64_t)ret_var.inner;
25379 if (ret_var.is_owned) {
25385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25386 LDKRawInvoice this_arg_conv;
25387 this_arg_conv.inner = (void*)(this_arg & (~1));
25388 this_arg_conv.is_owned = false;
25389 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25392 uint64_t ret_ref = (uint64_t)ret_var.inner;
25393 if (ret_var.is_owned) {
25399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25400 LDKRawInvoice this_arg_conv;
25401 this_arg_conv.inner = (void*)(this_arg & (~1));
25402 this_arg_conv.is_owned = false;
25403 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25406 uint64_t ret_ref = (uint64_t)ret_var.inner;
25407 if (ret_var.is_owned) {
25413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25414 LDKRawInvoice this_arg_conv;
25415 this_arg_conv.inner = (void*)(this_arg & (~1));
25416 this_arg_conv.is_owned = false;
25417 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25418 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25423 LDKRawInvoice this_arg_conv;
25424 this_arg_conv.inner = (void*)(this_arg & (~1));
25425 this_arg_conv.is_owned = false;
25426 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25429 uint64_t ret_ref = (uint64_t)ret_var.inner;
25430 if (ret_var.is_owned) {
25436 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25437 LDKRawInvoice this_arg_conv;
25438 this_arg_conv.inner = (void*)(this_arg & (~1));
25439 this_arg_conv.is_owned = false;
25440 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25441 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25442 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25443 for (size_t o = 0; o < ret_var.datalen; o++) {
25444 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25445 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25446 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25447 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25448 if (ret_conv_14_var.is_owned) {
25449 ret_conv_14_ref |= 1;
25451 ret_arr_ptr[o] = ret_conv_14_ref;
25453 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25454 FREE(ret_var.data);
25458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25459 LDKRawInvoice this_arg_conv;
25460 this_arg_conv.inner = (void*)(this_arg & (~1));
25461 this_arg_conv.is_owned = false;
25462 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25463 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25464 uint64_t ret_ref = (uint64_t)ret_copy;
25468 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25469 LDKRawInvoice this_arg_conv;
25470 this_arg_conv.inner = (void*)(this_arg & (~1));
25471 this_arg_conv.is_owned = false;
25472 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25477 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25478 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25479 return (uint64_t)ret_conv;
25482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25483 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25484 *ret_conv = PositiveTimestamp_from_system_time(time);
25485 return (uint64_t)ret_conv;
25488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25489 LDKPositiveTimestamp this_arg_conv;
25490 this_arg_conv.inner = (void*)(this_arg & (~1));
25491 this_arg_conv.is_owned = false;
25492 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25497 LDKPositiveTimestamp this_arg_conv;
25498 this_arg_conv.inner = (void*)(this_arg & (~1));
25499 this_arg_conv.is_owned = false;
25500 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25505 LDKInvoice this_arg_conv;
25506 this_arg_conv.inner = (void*)(this_arg & (~1));
25507 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25508 this_arg_conv = Invoice_clone(&this_arg_conv);
25509 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25512 uint64_t ret_ref = (uint64_t)ret_var.inner;
25513 if (ret_var.is_owned) {
25519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25520 LDKInvoice this_arg_conv;
25521 this_arg_conv.inner = (void*)(this_arg & (~1));
25522 this_arg_conv.is_owned = false;
25523 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25524 *ret_conv = Invoice_check_signature(&this_arg_conv);
25525 return (uint64_t)ret_conv;
25528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25529 LDKSignedRawInvoice signed_invoice_conv;
25530 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25531 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25532 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25533 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25534 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25535 return (uint64_t)ret_conv;
25538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25539 LDKInvoice this_arg_conv;
25540 this_arg_conv.inner = (void*)(this_arg & (~1));
25541 this_arg_conv.is_owned = false;
25542 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25547 LDKInvoice this_arg_conv;
25548 this_arg_conv.inner = (void*)(this_arg & (~1));
25549 this_arg_conv.is_owned = false;
25550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25556 LDKInvoice this_arg_conv;
25557 this_arg_conv.inner = (void*)(this_arg & (~1));
25558 this_arg_conv.is_owned = false;
25559 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25560 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25565 LDKInvoice this_arg_conv;
25566 this_arg_conv.inner = (void*)(this_arg & (~1));
25567 this_arg_conv.is_owned = false;
25568 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25569 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25574 LDKInvoice this_arg_conv;
25575 this_arg_conv.inner = (void*)(this_arg & (~1));
25576 this_arg_conv.is_owned = false;
25577 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25580 uint64_t ret_ref = (uint64_t)ret_var.inner;
25581 if (ret_var.is_owned) {
25587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25588 LDKInvoice this_arg_conv;
25589 this_arg_conv.inner = (void*)(this_arg & (~1));
25590 this_arg_conv.is_owned = false;
25591 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25592 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25597 LDKInvoice this_arg_conv;
25598 this_arg_conv.inner = (void*)(this_arg & (~1));
25599 this_arg_conv.is_owned = false;
25600 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25605 LDKInvoice this_arg_conv;
25606 this_arg_conv.inner = (void*)(this_arg & (~1));
25607 this_arg_conv.is_owned = false;
25608 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25612 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25613 LDKInvoice this_arg_conv;
25614 this_arg_conv.inner = (void*)(this_arg & (~1));
25615 this_arg_conv.is_owned = false;
25616 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
25617 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25618 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25619 for (size_t o = 0; o < ret_var.datalen; o++) {
25620 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25621 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25622 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25623 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25624 if (ret_conv_14_var.is_owned) {
25625 ret_conv_14_ref |= 1;
25627 ret_arr_ptr[o] = ret_conv_14_ref;
25629 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25630 FREE(ret_var.data);
25634 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
25635 LDKInvoice this_arg_conv;
25636 this_arg_conv.inner = (void*)(this_arg & (~1));
25637 this_arg_conv.is_owned = false;
25638 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
25639 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25640 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25641 for (size_t l = 0; l < ret_var.datalen; l++) {
25642 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25643 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25644 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25645 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25646 if (ret_conv_11_var.is_owned) {
25647 ret_conv_11_ref |= 1;
25649 ret_arr_ptr[l] = ret_conv_11_ref;
25651 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25652 FREE(ret_var.data);
25656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25657 LDKInvoice this_arg_conv;
25658 this_arg_conv.inner = (void*)(this_arg & (~1));
25659 this_arg_conv.is_owned = false;
25660 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25665 LDKInvoice this_arg_conv;
25666 this_arg_conv.inner = (void*)(this_arg & (~1));
25667 this_arg_conv.is_owned = false;
25668 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25669 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25670 uint64_t ret_ref = (uint64_t)ret_copy;
25674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25675 LDKStr description_conv = java_to_owned_str(env, description);
25676 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25677 *ret_conv = Description_new(description_conv);
25678 return (uint64_t)ret_conv;
25681 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25682 LDKDescription this_arg_conv;
25683 this_arg_conv.inner = (void*)(this_arg & (~1));
25684 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25685 this_arg_conv = Description_clone(&this_arg_conv);
25686 LDKStr ret_str = Description_into_inner(this_arg_conv);
25687 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25692 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25693 *ret_conv = ExpiryTime_from_seconds(seconds);
25694 return (uint64_t)ret_conv;
25697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25698 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25699 *ret_conv = ExpiryTime_from_duration(duration);
25700 return (uint64_t)ret_conv;
25703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25704 LDKExpiryTime this_arg_conv;
25705 this_arg_conv.inner = (void*)(this_arg & (~1));
25706 this_arg_conv.is_owned = false;
25707 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25712 LDKExpiryTime this_arg_conv;
25713 this_arg_conv.inner = (void*)(this_arg & (~1));
25714 this_arg_conv.is_owned = false;
25715 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
25720 LDKRouteHint hops_conv;
25721 hops_conv.inner = (void*)(hops & (~1));
25722 hops_conv.is_owned = (hops & 1) || (hops == 0);
25723 hops_conv = RouteHint_clone(&hops_conv);
25724 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
25725 *ret_conv = PrivateRoute_new(hops_conv);
25726 return (uint64_t)ret_conv;
25729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25730 LDKPrivateRoute this_arg_conv;
25731 this_arg_conv.inner = (void*)(this_arg & (~1));
25732 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25733 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
25734 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
25735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25737 uint64_t ret_ref = (uint64_t)ret_var.inner;
25738 if (ret_var.is_owned) {
25744 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25745 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25746 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25751 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25752 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25753 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25757 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25758 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25759 LDKStr ret_str = CreationError_to_str(o_conv);
25760 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25765 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25766 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25771 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25772 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25773 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25777 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25778 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25779 LDKStr ret_str = SemanticError_to_str(o_conv);
25780 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25785 if ((this_ptr & 1) != 0) return;
25786 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25787 FREE((void*)this_ptr);
25788 SignOrCreationError_free(this_ptr_conv);
25791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25792 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25793 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25794 *ret_copy = SignOrCreationError_clone(orig_conv);
25795 uint64_t ret_ref = (uint64_t)ret_copy;
25799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25800 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25801 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25802 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25806 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25807 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25808 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25809 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25813 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) {
25814 LDKChannelManager channelmanager_conv;
25815 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25816 channelmanager_conv.is_owned = false;
25817 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25818 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25819 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25820 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25822 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25823 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25824 LDKStr description_conv = java_to_owned_str(env, description);
25825 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25826 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25827 return (uint64_t)ret_conv;
25830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25831 LDKStr s_conv = java_to_owned_str(env, s);
25832 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25833 *ret_conv = SiPrefix_from_str(s_conv);
25834 return (uint64_t)ret_conv;
25837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25838 LDKStr s_conv = java_to_owned_str(env, s);
25839 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25840 *ret_conv = Invoice_from_str(s_conv);
25841 return (uint64_t)ret_conv;
25844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25845 LDKStr s_conv = java_to_owned_str(env, s);
25846 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25847 *ret_conv = SignedRawInvoice_from_str(s_conv);
25848 return (uint64_t)ret_conv;
25851 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25853 o_conv.inner = (void*)(o & (~1));
25854 o_conv.is_owned = false;
25855 LDKStr ret_str = Invoice_to_str(&o_conv);
25856 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25860 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25861 LDKSignedRawInvoice o_conv;
25862 o_conv.inner = (void*)(o & (~1));
25863 o_conv.is_owned = false;
25864 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25865 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25869 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25870 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25871 LDKStr ret_str = Currency_to_str(o_conv);
25872 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25876 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25877 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25878 LDKStr ret_str = SiPrefix_to_str(o_conv);
25879 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);